e7ef65a19347b9a621e2eb196ca58d4223530f78
[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 LDKBolt11SemanticError LDKBolt11SemanticError_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 Bolt11SemanticError.ordinal() from rust threw an exception.");
255         }
256         switch (ord) {
257                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
258                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
259                 case 2: return LDKBolt11SemanticError_NoDescription;
260                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
261                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
262                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
263                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
264                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
265                 case 8: return LDKBolt11SemanticError_InvalidSignature;
266                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
267         }
268         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
269         abort(); // Unreachable, but will let the compiler know we don't return here
270 }
271 static jclass Bolt11SemanticError_class = NULL;
272 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
273 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
274 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
275 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
276 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
277 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
278 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
279 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
280 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
281 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
282 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
283         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
284         CHECK(Bolt11SemanticError_class != NULL);
285         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
286         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
287         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
288         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
289         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
290         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
291         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
292         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
293         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
294         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
295         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
296         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
297         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
298         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
299         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
300         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
301         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
302         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
303         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
304         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
305 }
306 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
307         switch (val) {
308                 case LDKBolt11SemanticError_NoPaymentHash:
309                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
310                 case LDKBolt11SemanticError_MultiplePaymentHashes:
311                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
312                 case LDKBolt11SemanticError_NoDescription:
313                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
314                 case LDKBolt11SemanticError_MultipleDescriptions:
315                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
316                 case LDKBolt11SemanticError_NoPaymentSecret:
317                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
318                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
319                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
320                 case LDKBolt11SemanticError_InvalidFeatures:
321                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
322                 case LDKBolt11SemanticError_InvalidRecoveryId:
323                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
324                 case LDKBolt11SemanticError_InvalidSignature:
325                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
326                 case LDKBolt11SemanticError_ImpreciseAmount:
327                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
328                 default: abort();
329         }
330 }
331
332 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
333         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
334         if (UNLIKELY((*env)->ExceptionCheck(env))) {
335                 (*env)->ExceptionDescribe(env);
336                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
337         }
338         switch (ord) {
339                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
340                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
341                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
342                 case 3: return LDKBolt12SemanticError_MissingAmount;
343                 case 4: return LDKBolt12SemanticError_InvalidAmount;
344                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
345                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
346                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
347                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
348                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
349                 case 10: return LDKBolt12SemanticError_MissingDescription;
350                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
351                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
352                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
353                 case 14: return LDKBolt12SemanticError_MissingQuantity;
354                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
355                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
356                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
357                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
358                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
359                 case 20: return LDKBolt12SemanticError_MissingPayerId;
360                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
361                 case 22: return LDKBolt12SemanticError_MissingPaths;
362                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
363                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
364                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
365                 case 26: return LDKBolt12SemanticError_MissingSignature;
366         }
367         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
368         abort(); // Unreachable, but will let the compiler know we don't return here
369 }
370 static jclass Bolt12SemanticError_class = NULL;
371 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
372 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
373 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
374 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
375 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
376 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
377 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
378 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
379 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
380 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
381 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
382 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
383 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
384 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
385 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
386 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
387 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
388 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
389 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
390 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
391 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
392 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = NULL;
393 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
394 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
395 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
396 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
397 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
398 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
399         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
400         CHECK(Bolt12SemanticError_class != NULL);
401         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
402         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
403         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
404         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
405         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
406         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
407         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
408         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
409         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
410         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
411         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
412         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
413         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
414         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
415         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
416         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
417         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
418         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
419         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
420         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
421         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
422         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
423         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
424         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
425         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
426         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
427         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
428         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
429         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
430         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
431         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
432         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
433         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
434         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
435         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
436         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_DuplicatePaymentId", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
447         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
448         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
449         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
450         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
451         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
452         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
453         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
454         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
455 }
456 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
457         switch (val) {
458                 case LDKBolt12SemanticError_AlreadyExpired:
459                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
460                 case LDKBolt12SemanticError_UnsupportedChain:
461                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
462                 case LDKBolt12SemanticError_UnexpectedChain:
463                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
464                 case LDKBolt12SemanticError_MissingAmount:
465                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
466                 case LDKBolt12SemanticError_InvalidAmount:
467                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
468                 case LDKBolt12SemanticError_InsufficientAmount:
469                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
470                 case LDKBolt12SemanticError_UnexpectedAmount:
471                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
472                 case LDKBolt12SemanticError_UnsupportedCurrency:
473                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
474                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
475                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
476                 case LDKBolt12SemanticError_UnexpectedFeatures:
477                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
478                 case LDKBolt12SemanticError_MissingDescription:
479                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
480                 case LDKBolt12SemanticError_MissingSigningPubkey:
481                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
482                 case LDKBolt12SemanticError_InvalidSigningPubkey:
483                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
484                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
485                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
486                 case LDKBolt12SemanticError_MissingQuantity:
487                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
488                 case LDKBolt12SemanticError_InvalidQuantity:
489                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
490                 case LDKBolt12SemanticError_UnexpectedQuantity:
491                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
492                 case LDKBolt12SemanticError_InvalidMetadata:
493                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
494                 case LDKBolt12SemanticError_UnexpectedMetadata:
495                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
496                 case LDKBolt12SemanticError_MissingPayerMetadata:
497                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
498                 case LDKBolt12SemanticError_MissingPayerId:
499                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
500                 case LDKBolt12SemanticError_DuplicatePaymentId:
501                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId);
502                 case LDKBolt12SemanticError_MissingPaths:
503                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
504                 case LDKBolt12SemanticError_InvalidPayInfo:
505                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
506                 case LDKBolt12SemanticError_MissingCreationTime:
507                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
508                 case LDKBolt12SemanticError_MissingPaymentHash:
509                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
510                 case LDKBolt12SemanticError_MissingSignature:
511                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
512                 default: abort();
513         }
514 }
515
516 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
517         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
518         if (UNLIKELY((*env)->ExceptionCheck(env))) {
519                 (*env)->ExceptionDescribe(env);
520                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
521         }
522         switch (ord) {
523                 case 0: return LDKCOption_NoneZ_Some;
524                 case 1: return LDKCOption_NoneZ_None;
525         }
526         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
527         abort(); // Unreachable, but will let the compiler know we don't return here
528 }
529 static jclass COption_NoneZ_class = NULL;
530 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
531 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
532 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
533         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
534         CHECK(COption_NoneZ_class != NULL);
535         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
536         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
537         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
538         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
539 }
540 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
541         switch (val) {
542                 case LDKCOption_NoneZ_Some:
543                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
544                 case LDKCOption_NoneZ_None:
545                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
546                 default: abort();
547         }
548 }
549
550 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
551         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
552         if (UNLIKELY((*env)->ExceptionCheck(env))) {
553                 (*env)->ExceptionDescribe(env);
554                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
555         }
556         switch (ord) {
557                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
558                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
559                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
560         }
561         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
562         abort(); // Unreachable, but will let the compiler know we don't return here
563 }
564 static jclass ChannelMonitorUpdateStatus_class = NULL;
565 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
566 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
567 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
568 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
569         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
570         CHECK(ChannelMonitorUpdateStatus_class != NULL);
571         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
572         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
573         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
574         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
575         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
576         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
577 }
578 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
579         switch (val) {
580                 case LDKChannelMonitorUpdateStatus_Completed:
581                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
582                 case LDKChannelMonitorUpdateStatus_InProgress:
583                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
584                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
585                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
586                 default: abort();
587         }
588 }
589
590 static inline LDKChannelShutdownState LDKChannelShutdownState_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 ChannelShutdownState.ordinal() from rust threw an exception.");
595         }
596         switch (ord) {
597                 case 0: return LDKChannelShutdownState_NotShuttingDown;
598                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
599                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
600                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
601                 case 4: return LDKChannelShutdownState_ShutdownComplete;
602         }
603         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
604         abort(); // Unreachable, but will let the compiler know we don't return here
605 }
606 static jclass ChannelShutdownState_class = NULL;
607 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
608 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
609 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
610 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
611 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
612 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
613         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
614         CHECK(ChannelShutdownState_class != NULL);
615         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
616         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
617         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
618         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
619         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
620         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
621         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
622         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
623         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
624         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
625 }
626 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
627         switch (val) {
628                 case LDKChannelShutdownState_NotShuttingDown:
629                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
630                 case LDKChannelShutdownState_ShutdownInitiated:
631                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
632                 case LDKChannelShutdownState_ResolvingHTLCs:
633                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
634                 case LDKChannelShutdownState_NegotiatingClosingFee:
635                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
636                 case LDKChannelShutdownState_ShutdownComplete:
637                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
638                 default: abort();
639         }
640 }
641
642 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
643         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
644         if (UNLIKELY((*env)->ExceptionCheck(env))) {
645                 (*env)->ExceptionDescribe(env);
646                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
647         }
648         switch (ord) {
649                 case 0: return LDKConfirmationTarget_OnChainSweep;
650                 case 1: return LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee;
651                 case 2: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
652                 case 3: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
653                 case 4: return LDKConfirmationTarget_AnchorChannelFee;
654                 case 5: return LDKConfirmationTarget_NonAnchorChannelFee;
655                 case 6: return LDKConfirmationTarget_ChannelCloseMinimum;
656         }
657         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
658         abort(); // Unreachable, but will let the compiler know we don't return here
659 }
660 static jclass ConfirmationTarget_class = NULL;
661 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = NULL;
662 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee = NULL;
663 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = NULL;
664 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = NULL;
665 static jfieldID ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = NULL;
666 static jfieldID ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = NULL;
667 static jfieldID ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = NULL;
668 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
669         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
670         CHECK(ConfirmationTarget_class != NULL);
671         ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OnChainSweep", "Lorg/ldk/enums/ConfirmationTarget;");
672         CHECK(ConfirmationTarget_LDKConfirmationTarget_OnChainSweep != NULL);
673         ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
674         CHECK(ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee != NULL);
675         ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
676         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee != NULL);
677         ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
678         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee != NULL);
679         ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_AnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
680         CHECK(ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee != NULL);
681         ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_NonAnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
682         CHECK(ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee != NULL);
683         ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_ChannelCloseMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
684         CHECK(ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum != NULL);
685 }
686 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
687         switch (val) {
688                 case LDKConfirmationTarget_OnChainSweep:
689                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OnChainSweep);
690                 case LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee:
691                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee);
692                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee:
693                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee);
694                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee:
695                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee);
696                 case LDKConfirmationTarget_AnchorChannelFee:
697                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee);
698                 case LDKConfirmationTarget_NonAnchorChannelFee:
699                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee);
700                 case LDKConfirmationTarget_ChannelCloseMinimum:
701                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum);
702                 default: abort();
703         }
704 }
705
706 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
707         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
708         if (UNLIKELY((*env)->ExceptionCheck(env))) {
709                 (*env)->ExceptionDescribe(env);
710                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
711         }
712         switch (ord) {
713                 case 0: return LDKCreationError_DescriptionTooLong;
714                 case 1: return LDKCreationError_RouteTooLong;
715                 case 2: return LDKCreationError_TimestampOutOfBounds;
716                 case 3: return LDKCreationError_InvalidAmount;
717                 case 4: return LDKCreationError_MissingRouteHints;
718                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
719         }
720         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
721         abort(); // Unreachable, but will let the compiler know we don't return here
722 }
723 static jclass CreationError_class = NULL;
724 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
725 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
726 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
727 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
728 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
729 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
730 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
731         CreationError_class = (*env)->NewGlobalRef(env, clz);
732         CHECK(CreationError_class != NULL);
733         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
734         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
735         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
736         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
737         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
738         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
739         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
740         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
741         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
742         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
743         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
744         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
745 }
746 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
747         switch (val) {
748                 case LDKCreationError_DescriptionTooLong:
749                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
750                 case LDKCreationError_RouteTooLong:
751                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
752                 case LDKCreationError_TimestampOutOfBounds:
753                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
754                 case LDKCreationError_InvalidAmount:
755                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
756                 case LDKCreationError_MissingRouteHints:
757                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
758                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
759                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
760                 default: abort();
761         }
762 }
763
764 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
765         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
766         if (UNLIKELY((*env)->ExceptionCheck(env))) {
767                 (*env)->ExceptionDescribe(env);
768                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
769         }
770         switch (ord) {
771                 case 0: return LDKCurrency_Bitcoin;
772                 case 1: return LDKCurrency_BitcoinTestnet;
773                 case 2: return LDKCurrency_Regtest;
774                 case 3: return LDKCurrency_Simnet;
775                 case 4: return LDKCurrency_Signet;
776         }
777         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
778         abort(); // Unreachable, but will let the compiler know we don't return here
779 }
780 static jclass Currency_class = NULL;
781 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
782 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
783 static jfieldID Currency_LDKCurrency_Regtest = NULL;
784 static jfieldID Currency_LDKCurrency_Simnet = NULL;
785 static jfieldID Currency_LDKCurrency_Signet = NULL;
786 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
787         Currency_class = (*env)->NewGlobalRef(env, clz);
788         CHECK(Currency_class != NULL);
789         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
790         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
791         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
792         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
793         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
794         CHECK(Currency_LDKCurrency_Regtest != NULL);
795         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
796         CHECK(Currency_LDKCurrency_Simnet != NULL);
797         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
798         CHECK(Currency_LDKCurrency_Signet != NULL);
799 }
800 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
801         switch (val) {
802                 case LDKCurrency_Bitcoin:
803                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
804                 case LDKCurrency_BitcoinTestnet:
805                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
806                 case LDKCurrency_Regtest:
807                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
808                 case LDKCurrency_Simnet:
809                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
810                 case LDKCurrency_Signet:
811                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
812                 default: abort();
813         }
814 }
815
816 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
817         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
818         if (UNLIKELY((*env)->ExceptionCheck(env))) {
819                 (*env)->ExceptionDescribe(env);
820                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
821         }
822         switch (ord) {
823                 case 0: return LDKHTLCClaim_OfferedTimeout;
824                 case 1: return LDKHTLCClaim_OfferedPreimage;
825                 case 2: return LDKHTLCClaim_AcceptedTimeout;
826                 case 3: return LDKHTLCClaim_AcceptedPreimage;
827                 case 4: return LDKHTLCClaim_Revocation;
828         }
829         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
830         abort(); // Unreachable, but will let the compiler know we don't return here
831 }
832 static jclass HTLCClaim_class = NULL;
833 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
834 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
835 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
836 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
837 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
838 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
839         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
840         CHECK(HTLCClaim_class != NULL);
841         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
842         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
843         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
844         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
845         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
846         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
847         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
848         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
849         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
850         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
851 }
852 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
853         switch (val) {
854                 case LDKHTLCClaim_OfferedTimeout:
855                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
856                 case LDKHTLCClaim_OfferedPreimage:
857                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
858                 case LDKHTLCClaim_AcceptedTimeout:
859                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
860                 case LDKHTLCClaim_AcceptedPreimage:
861                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
862                 case LDKHTLCClaim_Revocation:
863                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
864                 default: abort();
865         }
866 }
867
868 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
869         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
870         if (UNLIKELY((*env)->ExceptionCheck(env))) {
871                 (*env)->ExceptionDescribe(env);
872                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
873         }
874         switch (ord) {
875                 case 0: return LDKIOError_NotFound;
876                 case 1: return LDKIOError_PermissionDenied;
877                 case 2: return LDKIOError_ConnectionRefused;
878                 case 3: return LDKIOError_ConnectionReset;
879                 case 4: return LDKIOError_ConnectionAborted;
880                 case 5: return LDKIOError_NotConnected;
881                 case 6: return LDKIOError_AddrInUse;
882                 case 7: return LDKIOError_AddrNotAvailable;
883                 case 8: return LDKIOError_BrokenPipe;
884                 case 9: return LDKIOError_AlreadyExists;
885                 case 10: return LDKIOError_WouldBlock;
886                 case 11: return LDKIOError_InvalidInput;
887                 case 12: return LDKIOError_InvalidData;
888                 case 13: return LDKIOError_TimedOut;
889                 case 14: return LDKIOError_WriteZero;
890                 case 15: return LDKIOError_Interrupted;
891                 case 16: return LDKIOError_Other;
892                 case 17: return LDKIOError_UnexpectedEof;
893         }
894         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
895         abort(); // Unreachable, but will let the compiler know we don't return here
896 }
897 static jclass IOError_class = NULL;
898 static jfieldID IOError_LDKIOError_NotFound = NULL;
899 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
900 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
901 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
902 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
903 static jfieldID IOError_LDKIOError_NotConnected = NULL;
904 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
905 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
906 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
907 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
908 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
909 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
910 static jfieldID IOError_LDKIOError_InvalidData = NULL;
911 static jfieldID IOError_LDKIOError_TimedOut = NULL;
912 static jfieldID IOError_LDKIOError_WriteZero = NULL;
913 static jfieldID IOError_LDKIOError_Interrupted = NULL;
914 static jfieldID IOError_LDKIOError_Other = NULL;
915 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
916 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
917         IOError_class = (*env)->NewGlobalRef(env, clz);
918         CHECK(IOError_class != NULL);
919         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
920         CHECK(IOError_LDKIOError_NotFound != NULL);
921         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
922         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
923         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
924         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
925         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
926         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
927         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
928         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
929         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
930         CHECK(IOError_LDKIOError_NotConnected != NULL);
931         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
932         CHECK(IOError_LDKIOError_AddrInUse != NULL);
933         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
934         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
935         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
936         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
937         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
938         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
939         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
940         CHECK(IOError_LDKIOError_WouldBlock != NULL);
941         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
942         CHECK(IOError_LDKIOError_InvalidInput != NULL);
943         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
944         CHECK(IOError_LDKIOError_InvalidData != NULL);
945         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
946         CHECK(IOError_LDKIOError_TimedOut != NULL);
947         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
948         CHECK(IOError_LDKIOError_WriteZero != NULL);
949         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
950         CHECK(IOError_LDKIOError_Interrupted != NULL);
951         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
952         CHECK(IOError_LDKIOError_Other != NULL);
953         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
954         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
955 }
956 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
957         switch (val) {
958                 case LDKIOError_NotFound:
959                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
960                 case LDKIOError_PermissionDenied:
961                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
962                 case LDKIOError_ConnectionRefused:
963                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
964                 case LDKIOError_ConnectionReset:
965                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
966                 case LDKIOError_ConnectionAborted:
967                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
968                 case LDKIOError_NotConnected:
969                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
970                 case LDKIOError_AddrInUse:
971                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
972                 case LDKIOError_AddrNotAvailable:
973                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
974                 case LDKIOError_BrokenPipe:
975                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
976                 case LDKIOError_AlreadyExists:
977                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
978                 case LDKIOError_WouldBlock:
979                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
980                 case LDKIOError_InvalidInput:
981                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
982                 case LDKIOError_InvalidData:
983                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
984                 case LDKIOError_TimedOut:
985                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
986                 case LDKIOError_WriteZero:
987                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
988                 case LDKIOError_Interrupted:
989                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
990                 case LDKIOError_Other:
991                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
992                 case LDKIOError_UnexpectedEof:
993                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
994                 default: abort();
995         }
996 }
997
998 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
999         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1000         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1001                 (*env)->ExceptionDescribe(env);
1002                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
1003         }
1004         switch (ord) {
1005                 case 0: return LDKLevel_Gossip;
1006                 case 1: return LDKLevel_Trace;
1007                 case 2: return LDKLevel_Debug;
1008                 case 3: return LDKLevel_Info;
1009                 case 4: return LDKLevel_Warn;
1010                 case 5: return LDKLevel_Error;
1011         }
1012         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
1013         abort(); // Unreachable, but will let the compiler know we don't return here
1014 }
1015 static jclass Level_class = NULL;
1016 static jfieldID Level_LDKLevel_Gossip = NULL;
1017 static jfieldID Level_LDKLevel_Trace = NULL;
1018 static jfieldID Level_LDKLevel_Debug = NULL;
1019 static jfieldID Level_LDKLevel_Info = NULL;
1020 static jfieldID Level_LDKLevel_Warn = NULL;
1021 static jfieldID Level_LDKLevel_Error = NULL;
1022 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
1023         Level_class = (*env)->NewGlobalRef(env, clz);
1024         CHECK(Level_class != NULL);
1025         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
1026         CHECK(Level_LDKLevel_Gossip != NULL);
1027         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1028         CHECK(Level_LDKLevel_Trace != NULL);
1029         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1030         CHECK(Level_LDKLevel_Debug != NULL);
1031         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1032         CHECK(Level_LDKLevel_Info != NULL);
1033         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1034         CHECK(Level_LDKLevel_Warn != NULL);
1035         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1036         CHECK(Level_LDKLevel_Error != NULL);
1037 }
1038 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1039         switch (val) {
1040                 case LDKLevel_Gossip:
1041                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1042                 case LDKLevel_Trace:
1043                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1044                 case LDKLevel_Debug:
1045                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1046                 case LDKLevel_Info:
1047                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1048                 case LDKLevel_Warn:
1049                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1050                 case LDKLevel_Error:
1051                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1052                 default: abort();
1053         }
1054 }
1055
1056 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
1057         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1058         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1059                 (*env)->ExceptionDescribe(env);
1060                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
1061         }
1062         switch (ord) {
1063                 case 0: return LDKNetwork_Bitcoin;
1064                 case 1: return LDKNetwork_Testnet;
1065                 case 2: return LDKNetwork_Regtest;
1066                 case 3: return LDKNetwork_Signet;
1067         }
1068         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1069         abort(); // Unreachable, but will let the compiler know we don't return here
1070 }
1071 static jclass Network_class = NULL;
1072 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1073 static jfieldID Network_LDKNetwork_Testnet = NULL;
1074 static jfieldID Network_LDKNetwork_Regtest = NULL;
1075 static jfieldID Network_LDKNetwork_Signet = NULL;
1076 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1077         Network_class = (*env)->NewGlobalRef(env, clz);
1078         CHECK(Network_class != NULL);
1079         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1080         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1081         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1082         CHECK(Network_LDKNetwork_Testnet != NULL);
1083         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1084         CHECK(Network_LDKNetwork_Regtest != NULL);
1085         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1086         CHECK(Network_LDKNetwork_Signet != NULL);
1087 }
1088 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1089         switch (val) {
1090                 case LDKNetwork_Bitcoin:
1091                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1092                 case LDKNetwork_Testnet:
1093                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1094                 case LDKNetwork_Regtest:
1095                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1096                 case LDKNetwork_Signet:
1097                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1098                 default: abort();
1099         }
1100 }
1101
1102 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1103         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1104         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1105                 (*env)->ExceptionDescribe(env);
1106                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1107         }
1108         switch (ord) {
1109                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1110                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1111                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1112                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1113                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1114                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1115         }
1116         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1117         abort(); // Unreachable, but will let the compiler know we don't return here
1118 }
1119 static jclass PaymentFailureReason_class = NULL;
1120 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1121 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1122 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1123 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1124 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1125 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1126 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1127         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1128         CHECK(PaymentFailureReason_class != NULL);
1129         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1130         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1131         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1132         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1133         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1134         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1135         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1136         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1137         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1138         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1139         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1140         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1141 }
1142 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1143         switch (val) {
1144                 case LDKPaymentFailureReason_RecipientRejected:
1145                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1146                 case LDKPaymentFailureReason_UserAbandoned:
1147                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1148                 case LDKPaymentFailureReason_RetriesExhausted:
1149                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1150                 case LDKPaymentFailureReason_PaymentExpired:
1151                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1152                 case LDKPaymentFailureReason_RouteNotFound:
1153                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1154                 case LDKPaymentFailureReason_UnexpectedError:
1155                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1156                 default: abort();
1157         }
1158 }
1159
1160 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1161         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1162         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1163                 (*env)->ExceptionDescribe(env);
1164                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1165         }
1166         switch (ord) {
1167                 case 0: return LDKRecipient_Node;
1168                 case 1: return LDKRecipient_PhantomNode;
1169         }
1170         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1171         abort(); // Unreachable, but will let the compiler know we don't return here
1172 }
1173 static jclass Recipient_class = NULL;
1174 static jfieldID Recipient_LDKRecipient_Node = NULL;
1175 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1176 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1177         Recipient_class = (*env)->NewGlobalRef(env, clz);
1178         CHECK(Recipient_class != NULL);
1179         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1180         CHECK(Recipient_LDKRecipient_Node != NULL);
1181         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1182         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1183 }
1184 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1185         switch (val) {
1186                 case LDKRecipient_Node:
1187                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1188                 case LDKRecipient_PhantomNode:
1189                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1190                 default: abort();
1191         }
1192 }
1193
1194 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1195         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1196         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1197                 (*env)->ExceptionDescribe(env);
1198                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1199         }
1200         switch (ord) {
1201                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1202                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1203                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1204         }
1205         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1206         abort(); // Unreachable, but will let the compiler know we don't return here
1207 }
1208 static jclass RetryableSendFailure_class = NULL;
1209 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1210 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1211 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1212 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1213         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1214         CHECK(RetryableSendFailure_class != NULL);
1215         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1216         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1217         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1218         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1219         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1220         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1221 }
1222 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1223         switch (val) {
1224                 case LDKRetryableSendFailure_PaymentExpired:
1225                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1226                 case LDKRetryableSendFailure_RouteNotFound:
1227                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1228                 case LDKRetryableSendFailure_DuplicatePayment:
1229                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1230                 default: abort();
1231         }
1232 }
1233
1234 static inline LDKSecp256k1Error LDKSecp256k1Error_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 Secp256k1Error.ordinal() from rust threw an exception.");
1239         }
1240         switch (ord) {
1241                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1242                 case 1: return LDKSecp256k1Error_InvalidMessage;
1243                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1244                 case 3: return LDKSecp256k1Error_InvalidSignature;
1245                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1246                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1247                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1248                 case 7: return LDKSecp256k1Error_InvalidTweak;
1249                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1250                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1251                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1252         }
1253         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1254         abort(); // Unreachable, but will let the compiler know we don't return here
1255 }
1256 static jclass Secp256k1Error_class = NULL;
1257 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1258 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1259 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1260 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1261 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1262 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1263 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1264 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1265 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1266 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1267 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1268 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1269         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1270         CHECK(Secp256k1Error_class != NULL);
1271         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1272         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1273         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1274         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1275         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1276         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1277         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1278         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1279         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1280         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1281         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1282         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1283         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1284         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1285         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1286         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1287         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1288         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1289         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1290         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1291         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1292         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1293 }
1294 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1295         switch (val) {
1296                 case LDKSecp256k1Error_IncorrectSignature:
1297                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1298                 case LDKSecp256k1Error_InvalidMessage:
1299                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1300                 case LDKSecp256k1Error_InvalidPublicKey:
1301                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1302                 case LDKSecp256k1Error_InvalidSignature:
1303                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1304                 case LDKSecp256k1Error_InvalidSecretKey:
1305                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1306                 case LDKSecp256k1Error_InvalidSharedSecret:
1307                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1308                 case LDKSecp256k1Error_InvalidRecoveryId:
1309                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1310                 case LDKSecp256k1Error_InvalidTweak:
1311                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1312                 case LDKSecp256k1Error_NotEnoughMemory:
1313                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1314                 case LDKSecp256k1Error_InvalidPublicKeySum:
1315                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1316                 case LDKSecp256k1Error_InvalidParityValue:
1317                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1318                 default: abort();
1319         }
1320 }
1321
1322 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1323         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1324         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1325                 (*env)->ExceptionDescribe(env);
1326                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1327         }
1328         switch (ord) {
1329                 case 0: return LDKSiPrefix_Milli;
1330                 case 1: return LDKSiPrefix_Micro;
1331                 case 2: return LDKSiPrefix_Nano;
1332                 case 3: return LDKSiPrefix_Pico;
1333         }
1334         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1335         abort(); // Unreachable, but will let the compiler know we don't return here
1336 }
1337 static jclass SiPrefix_class = NULL;
1338 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1339 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1340 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1341 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1342 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1343         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1344         CHECK(SiPrefix_class != NULL);
1345         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1346         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1347         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1348         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1349         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1350         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1351         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1352         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1353 }
1354 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1355         switch (val) {
1356                 case LDKSiPrefix_Milli:
1357                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1358                 case LDKSiPrefix_Micro:
1359                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1360                 case LDKSiPrefix_Nano:
1361                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1362                 case LDKSiPrefix_Pico:
1363                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1364                 default: abort();
1365         }
1366 }
1367
1368 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1369         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1370         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1371                 (*env)->ExceptionDescribe(env);
1372                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1373         }
1374         switch (ord) {
1375                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1376                 case 1: return LDKSocketAddressParseError_InvalidInput;
1377                 case 2: return LDKSocketAddressParseError_InvalidPort;
1378                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1379         }
1380         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1381         abort(); // Unreachable, but will let the compiler know we don't return here
1382 }
1383 static jclass SocketAddressParseError_class = NULL;
1384 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1385 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1386 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1387 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1388 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1389         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1390         CHECK(SocketAddressParseError_class != NULL);
1391         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1392         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1393         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1394         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1395         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1396         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1397         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1398         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1399 }
1400 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1401         switch (val) {
1402                 case LDKSocketAddressParseError_SocketAddrParse:
1403                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1404                 case LDKSocketAddressParseError_InvalidInput:
1405                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1406                 case LDKSocketAddressParseError_InvalidPort:
1407                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1408                 case LDKSocketAddressParseError_InvalidOnionV3:
1409                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1410                 default: abort();
1411         }
1412 }
1413
1414 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1415         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1416         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1417                 (*env)->ExceptionDescribe(env);
1418                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1419         }
1420         switch (ord) {
1421                 case 0: return LDKUtxoLookupError_UnknownChain;
1422                 case 1: return LDKUtxoLookupError_UnknownTx;
1423         }
1424         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1425         abort(); // Unreachable, but will let the compiler know we don't return here
1426 }
1427 static jclass UtxoLookupError_class = NULL;
1428 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1429 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1430 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1431         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1432         CHECK(UtxoLookupError_class != NULL);
1433         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1434         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1435         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1436         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1437 }
1438 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1439         switch (val) {
1440                 case LDKUtxoLookupError_UnknownChain:
1441                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1442                 case LDKUtxoLookupError_UnknownTx:
1443                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1444                 default: abort();
1445         }
1446 }
1447
1448 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1449         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1450         return ret;
1451 }
1452 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1453         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1454         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1455         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1456         return ret_arr;
1457 }
1458
1459 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1461         if (!ptr_is_owned(thing)) return;
1462         void* thing_ptr = untag_ptr(thing);
1463         CHECK_ACCESS(thing_ptr);
1464         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1465         FREE(untag_ptr(thing));
1466         BigEndianScalar_free(thing_conv);
1467 }
1468
1469 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1470 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1471 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1472 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1473 static jclass LDKBech32Error_InvalidLength_class = NULL;
1474 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1475 static jclass LDKBech32Error_InvalidChar_class = NULL;
1476 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1477 static jclass LDKBech32Error_InvalidData_class = NULL;
1478 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1479 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1480 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1481 static jclass LDKBech32Error_MixedCase_class = NULL;
1482 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1484         LDKBech32Error_MissingSeparator_class =
1485                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1486         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1487         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1488         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1489         LDKBech32Error_InvalidChecksum_class =
1490                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1491         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1492         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1493         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1494         LDKBech32Error_InvalidLength_class =
1495                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1496         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1497         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1498         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1499         LDKBech32Error_InvalidChar_class =
1500                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1501         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1502         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1503         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1504         LDKBech32Error_InvalidData_class =
1505                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1506         CHECK(LDKBech32Error_InvalidData_class != NULL);
1507         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1508         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1509         LDKBech32Error_InvalidPadding_class =
1510                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1511         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1512         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1513         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1514         LDKBech32Error_MixedCase_class =
1515                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1516         CHECK(LDKBech32Error_MixedCase_class != NULL);
1517         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1518         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1519 }
1520 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1521         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1522         switch(obj->tag) {
1523                 case LDKBech32Error_MissingSeparator: {
1524                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1525                 }
1526                 case LDKBech32Error_InvalidChecksum: {
1527                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1528                 }
1529                 case LDKBech32Error_InvalidLength: {
1530                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1531                 }
1532                 case LDKBech32Error_InvalidChar: {
1533                         int32_t invalid_char_conv = obj->invalid_char;
1534                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1535                 }
1536                 case LDKBech32Error_InvalidData: {
1537                         int8_t invalid_data_conv = obj->invalid_data;
1538                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1539                 }
1540                 case LDKBech32Error_InvalidPadding: {
1541                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1542                 }
1543                 case LDKBech32Error_MixedCase: {
1544                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1545                 }
1546                 default: abort();
1547         }
1548 }
1549 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1550         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1551         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1552         return ret;
1553 }
1554 struct LDKWitness TxIn_get_witness (struct LDKTxIn* thing) {    return Witness_clone(&thing->witness);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t thing) {
1555         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1556         LDKWitness ret_var = TxIn_get_witness(thing_conv);
1557         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1558         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1559         Witness_free(ret_var);
1560         return ret_arr;
1561 }
1562
1563 struct LDKCVec_u8Z TxIn_get_script_sig (struct LDKTxIn* thing) {        return CVec_u8Z_clone(&thing->script_sig);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t thing) {
1564         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1565         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
1566         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1567         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1568         CVec_u8Z_free(ret_var);
1569         return ret_arr;
1570 }
1571
1572 LDKThirtyTwoBytes TxIn_get_previous_txid (struct LDKTxIn* thing) {      return thing->previous_txid;}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t thing) {
1573         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1574         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1575         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(thing_conv).data);
1576         return ret_arr;
1577 }
1578
1579 uint32_t TxIn_get_previous_vout (struct LDKTxIn* thing) {       return thing->previous_vout;}JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t thing) {
1580         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1581         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
1582         return ret_conv;
1583 }
1584
1585 uint32_t TxIn_get_sequence (struct LDKTxIn* thing) {    return thing->sequence;}JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t thing) {
1586         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1587         int32_t ret_conv = TxIn_get_sequence(thing_conv);
1588         return ret_conv;
1589 }
1590
1591 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {   return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
1592         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1593         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1594         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1595         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1596         CVec_u8Z_free(ret_var);
1597         return ret_arr;
1598 }
1599
1600 uint64_t TxOut_get_value (struct LDKTxOut* thing) {     return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
1601         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1602         int64_t ret_conv = TxOut_get_value(thing_conv);
1603         return ret_conv;
1604 }
1605
1606 static jclass LDKCOption_u64Z_Some_class = NULL;
1607 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1608 static jclass LDKCOption_u64Z_None_class = NULL;
1609 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1611         LDKCOption_u64Z_Some_class =
1612                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1613         CHECK(LDKCOption_u64Z_Some_class != NULL);
1614         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1615         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1616         LDKCOption_u64Z_None_class =
1617                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1618         CHECK(LDKCOption_u64Z_None_class != NULL);
1619         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1620         CHECK(LDKCOption_u64Z_None_meth != NULL);
1621 }
1622 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1623         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1624         switch(obj->tag) {
1625                 case LDKCOption_u64Z_Some: {
1626                         int64_t some_conv = obj->some;
1627                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1628                 }
1629                 case LDKCOption_u64Z_None: {
1630                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1631                 }
1632                 default: abort();
1633         }
1634 }
1635 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1636         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1637         for (size_t i = 0; i < ret.datalen; i++) {
1638                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1639         }
1640         return ret;
1641 }
1642 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1643         LDKRefund ret = *owner->contents.result;
1644         ret.is_owned = false;
1645         return ret;
1646 }
1647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1648         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1649         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1650         int64_t ret_ref = 0;
1651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1653         return ret_ref;
1654 }
1655
1656 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1657         LDKBolt12ParseError ret = *owner->contents.err;
1658         ret.is_owned = false;
1659         return ret;
1660 }
1661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1662         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1663         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1664         int64_t ret_ref = 0;
1665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1667         return ret_ref;
1668 }
1669
1670 static jclass LDKRetry_Attempts_class = NULL;
1671 static jmethodID LDKRetry_Attempts_meth = NULL;
1672 static jclass LDKRetry_Timeout_class = NULL;
1673 static jmethodID LDKRetry_Timeout_meth = NULL;
1674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
1675         LDKRetry_Attempts_class =
1676                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
1677         CHECK(LDKRetry_Attempts_class != NULL);
1678         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(I)V");
1679         CHECK(LDKRetry_Attempts_meth != NULL);
1680         LDKRetry_Timeout_class =
1681                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
1682         CHECK(LDKRetry_Timeout_class != NULL);
1683         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
1684         CHECK(LDKRetry_Timeout_meth != NULL);
1685 }
1686 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1687         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1688         switch(obj->tag) {
1689                 case LDKRetry_Attempts: {
1690                         int32_t attempts_conv = obj->attempts;
1691                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
1692                 }
1693                 case LDKRetry_Timeout: {
1694                         int64_t timeout_conv = obj->timeout;
1695                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
1696                 }
1697                 default: abort();
1698         }
1699 }
1700 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1701 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1702 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1703 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1704 static jclass LDKDecodeError_InvalidValue_class = NULL;
1705 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1706 static jclass LDKDecodeError_ShortRead_class = NULL;
1707 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1708 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1709 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1710 static jclass LDKDecodeError_Io_class = NULL;
1711 static jmethodID LDKDecodeError_Io_meth = NULL;
1712 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1713 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1715         LDKDecodeError_UnknownVersion_class =
1716                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1717         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1718         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1719         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1720         LDKDecodeError_UnknownRequiredFeature_class =
1721                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1722         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1723         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1724         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1725         LDKDecodeError_InvalidValue_class =
1726                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1727         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1728         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1729         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1730         LDKDecodeError_ShortRead_class =
1731                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1732         CHECK(LDKDecodeError_ShortRead_class != NULL);
1733         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1734         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1735         LDKDecodeError_BadLengthDescriptor_class =
1736                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1737         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1738         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1739         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1740         LDKDecodeError_Io_class =
1741                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1742         CHECK(LDKDecodeError_Io_class != NULL);
1743         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1744         CHECK(LDKDecodeError_Io_meth != NULL);
1745         LDKDecodeError_UnsupportedCompression_class =
1746                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1747         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1748         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1749         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1750 }
1751 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1752         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1753         switch(obj->tag) {
1754                 case LDKDecodeError_UnknownVersion: {
1755                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1756                 }
1757                 case LDKDecodeError_UnknownRequiredFeature: {
1758                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1759                 }
1760                 case LDKDecodeError_InvalidValue: {
1761                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1762                 }
1763                 case LDKDecodeError_ShortRead: {
1764                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1765                 }
1766                 case LDKDecodeError_BadLengthDescriptor: {
1767                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1768                 }
1769                 case LDKDecodeError_Io: {
1770                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1771                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1772                 }
1773                 case LDKDecodeError_UnsupportedCompression: {
1774                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1775                 }
1776                 default: abort();
1777         }
1778 }
1779 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1780 CHECK(owner->result_ok);
1781         return Retry_clone(&*owner->contents.result);
1782 }
1783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1784         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1785         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1786         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1787         int64_t ret_ref = tag_ptr(ret_copy, true);
1788         return ret_ref;
1789 }
1790
1791 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1792 CHECK(!owner->result_ok);
1793         return DecodeError_clone(&*owner->contents.err);
1794 }
1795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1796         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1797         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1798         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1799         int64_t ret_ref = tag_ptr(ret_copy, true);
1800         return ret_ref;
1801 }
1802
1803 static jclass LDKAPIError_APIMisuseError_class = NULL;
1804 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1805 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1806 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1807 static jclass LDKAPIError_InvalidRoute_class = NULL;
1808 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1809 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1810 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1811 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1812 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1813 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1814 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1816         LDKAPIError_APIMisuseError_class =
1817                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1818         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1819         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1820         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1821         LDKAPIError_FeeRateTooHigh_class =
1822                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1823         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1824         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1825         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1826         LDKAPIError_InvalidRoute_class =
1827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1828         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1829         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1830         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1831         LDKAPIError_ChannelUnavailable_class =
1832                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1833         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1834         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1835         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1836         LDKAPIError_MonitorUpdateInProgress_class =
1837                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1838         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1839         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1840         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1841         LDKAPIError_IncompatibleShutdownScript_class =
1842                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1843         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1844         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1845         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1846 }
1847 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1848         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1849         switch(obj->tag) {
1850                 case LDKAPIError_APIMisuseError: {
1851                         LDKStr err_str = obj->api_misuse_error.err;
1852                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1853                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1854                 }
1855                 case LDKAPIError_FeeRateTooHigh: {
1856                         LDKStr err_str = obj->fee_rate_too_high.err;
1857                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1858                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1859                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1860                 }
1861                 case LDKAPIError_InvalidRoute: {
1862                         LDKStr err_str = obj->invalid_route.err;
1863                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1864                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1865                 }
1866                 case LDKAPIError_ChannelUnavailable: {
1867                         LDKStr err_str = obj->channel_unavailable.err;
1868                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1869                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1870                 }
1871                 case LDKAPIError_MonitorUpdateInProgress: {
1872                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1873                 }
1874                 case LDKAPIError_IncompatibleShutdownScript: {
1875                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1876                         int64_t script_ref = 0;
1877                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1878                         script_ref = tag_ptr(script_var.inner, false);
1879                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1880                 }
1881                 default: abort();
1882         }
1883 }
1884 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1885 CHECK(owner->result_ok);
1886         return *owner->contents.result;
1887 }
1888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1889         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1890         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1891 }
1892
1893 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1894 CHECK(!owner->result_ok);
1895         return APIError_clone(&*owner->contents.err);
1896 }
1897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1898         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1899         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1900         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1901         int64_t ret_ref = tag_ptr(ret_copy, true);
1902         return ret_ref;
1903 }
1904
1905 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1906         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1907         for (size_t i = 0; i < ret.datalen; i++) {
1908                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1909         }
1910         return ret;
1911 }
1912 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1913         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1914         for (size_t i = 0; i < ret.datalen; i++) {
1915                 ret.data[i] = APIError_clone(&orig->data[i]);
1916         }
1917         return ret;
1918 }
1919 static jclass LDKCOption_ThirtyTwoBytesZ_Some_class = NULL;
1920 static jmethodID LDKCOption_ThirtyTwoBytesZ_Some_meth = NULL;
1921 static jclass LDKCOption_ThirtyTwoBytesZ_None_class = NULL;
1922 static jmethodID LDKCOption_ThirtyTwoBytesZ_None_meth = NULL;
1923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ThirtyTwoBytesZ_init (JNIEnv *env, jclass clz) {
1924         LDKCOption_ThirtyTwoBytesZ_Some_class =
1925                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$Some"));
1926         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_class != NULL);
1927         LDKCOption_ThirtyTwoBytesZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_Some_class, "<init>", "([B)V");
1928         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_meth != NULL);
1929         LDKCOption_ThirtyTwoBytesZ_None_class =
1930                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$None"));
1931         CHECK(LDKCOption_ThirtyTwoBytesZ_None_class != NULL);
1932         LDKCOption_ThirtyTwoBytesZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_None_class, "<init>", "()V");
1933         CHECK(LDKCOption_ThirtyTwoBytesZ_None_meth != NULL);
1934 }
1935 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ThirtyTwoBytesZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1936         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1937         switch(obj->tag) {
1938                 case LDKCOption_ThirtyTwoBytesZ_Some: {
1939                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
1940                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
1941                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_Some_class, LDKCOption_ThirtyTwoBytesZ_Some_meth, some_arr);
1942                 }
1943                 case LDKCOption_ThirtyTwoBytesZ_None: {
1944                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_None_class, LDKCOption_ThirtyTwoBytesZ_None_meth);
1945                 }
1946                 default: abort();
1947         }
1948 }
1949 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
1950 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
1951 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
1952 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
1953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
1954         LDKCOption_CVec_u8ZZ_Some_class =
1955                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
1956         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
1957         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
1958         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
1959         LDKCOption_CVec_u8ZZ_None_class =
1960                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
1961         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
1962         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
1963         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
1964 }
1965 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1966         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1967         switch(obj->tag) {
1968                 case LDKCOption_CVec_u8ZZ_Some: {
1969                         LDKCVec_u8Z some_var = obj->some;
1970                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
1971                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
1972                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
1973                 }
1974                 case LDKCOption_CVec_u8ZZ_None: {
1975                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
1976                 }
1977                 default: abort();
1978         }
1979 }
1980 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1981         LDKRecipientOnionFields ret = *owner->contents.result;
1982         ret.is_owned = false;
1983         return ret;
1984 }
1985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1986         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1987         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1988         int64_t ret_ref = 0;
1989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1991         return ret_ref;
1992 }
1993
1994 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1995 CHECK(!owner->result_ok);
1996         return DecodeError_clone(&*owner->contents.err);
1997 }
1998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1999         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
2000         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2001         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
2002         int64_t ret_ref = tag_ptr(ret_copy, true);
2003         return ret_ref;
2004 }
2005
2006 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2007         return owner->a;
2008 }
2009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2010         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2011         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
2012         return ret_conv;
2013 }
2014
2015 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2016         return CVec_u8Z_clone(&owner->b);
2017 }
2018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2019         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2020         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
2021         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2022         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2023         CVec_u8Z_free(ret_var);
2024         return ret_arr;
2025 }
2026
2027 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
2028         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
2029         for (size_t i = 0; i < ret.datalen; i++) {
2030                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
2031         }
2032         return ret;
2033 }
2034 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2035         LDKRecipientOnionFields ret = *owner->contents.result;
2036         ret.is_owned = false;
2037         return ret;
2038 }
2039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2040         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2041         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
2042         int64_t ret_ref = 0;
2043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2045         return ret_ref;
2046 }
2047
2048 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2049 CHECK(!owner->result_ok);
2050         return *owner->contents.err;
2051 }
2052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2053         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2054         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
2055 }
2056
2057 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
2058         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
2059         for (size_t i = 0; i < ret.datalen; i++) {
2060                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2061         }
2062         return ret;
2063 }
2064 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class = NULL;
2065 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = NULL;
2066 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_None_class = NULL;
2067 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = NULL;
2068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ThirtyTwoBytesZZ_init (JNIEnv *env, jclass clz) {
2069         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class =
2070                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$Some"));
2071         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class != NULL);
2072         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, "<init>", "([[B)V");
2073         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth != NULL);
2074         LDKCOption_CVec_ThirtyTwoBytesZZ_None_class =
2075                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$None"));
2076         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_class != NULL);
2077         LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, "<init>", "()V");
2078         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth != NULL);
2079 }
2080 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ThirtyTwoBytesZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2081         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
2082         switch(obj->tag) {
2083                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: {
2084                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
2085                         jobjectArray some_arr = NULL;
2086                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
2087                         ;
2088                         for (size_t i = 0; i < some_var.datalen; i++) {
2089                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
2090                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
2091                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
2092                         }
2093                         
2094                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth, some_arr);
2095                 }
2096                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: {
2097                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth);
2098                 }
2099                 default: abort();
2100         }
2101 }
2102 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2103 CHECK(owner->result_ok);
2104         return ThirtyTwoBytes_clone(&*owner->contents.result);
2105 }
2106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2107         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2108         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2109         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data);
2110         return ret_arr;
2111 }
2112
2113 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2114 CHECK(!owner->result_ok);
2115         return *owner->contents.err;
2116 }
2117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2118         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2119         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
2120 }
2121
2122 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2123         LDKBlindedPayInfo ret = *owner->contents.result;
2124         ret.is_owned = false;
2125         return ret;
2126 }
2127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2128         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2129         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
2130         int64_t ret_ref = 0;
2131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2133         return ret_ref;
2134 }
2135
2136 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2137 CHECK(!owner->result_ok);
2138         return DecodeError_clone(&*owner->contents.err);
2139 }
2140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2141         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2142         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2143         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
2144         int64_t ret_ref = tag_ptr(ret_copy, true);
2145         return ret_ref;
2146 }
2147
2148 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2149         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
2150         ret.is_owned = false;
2151         return ret;
2152 }
2153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2154         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2155         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2156         int64_t ret_ref = 0;
2157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2159         return ret_ref;
2160 }
2161
2162 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2163 CHECK(!owner->result_ok);
2164         return DecodeError_clone(&*owner->contents.err);
2165 }
2166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2167         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2168         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2169         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2170         int64_t ret_ref = tag_ptr(ret_copy, true);
2171         return ret_ref;
2172 }
2173
2174 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2175         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
2176         ret.is_owned = false;
2177         return ret;
2178 }
2179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2180         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2181         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2182         int64_t ret_ref = 0;
2183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2185         return ret_ref;
2186 }
2187
2188 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2189 CHECK(!owner->result_ok);
2190         return DecodeError_clone(&*owner->contents.err);
2191 }
2192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2193         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2194         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2195         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2196         int64_t ret_ref = tag_ptr(ret_copy, true);
2197         return ret_ref;
2198 }
2199
2200 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2201 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2202 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2203 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2204 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2205 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2207         LDKSpendableOutputDescriptor_StaticOutput_class =
2208                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2209         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2210         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2211         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2212         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2213                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2214         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2215         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2216         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2217         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2218                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2219         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2220         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2221         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2222 }
2223 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2224         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2225         switch(obj->tag) {
2226                 case LDKSpendableOutputDescriptor_StaticOutput: {
2227                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2228                         int64_t outpoint_ref = 0;
2229                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2230                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2231                         LDKTxOut* output_ref = &obj->static_output.output;
2232                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
2233                 }
2234                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2235                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2236                         int64_t delayed_payment_output_ref = 0;
2237                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2238                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2239                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2240                 }
2241                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2242                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2243                         int64_t static_payment_output_ref = 0;
2244                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2245                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2246                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2247                 }
2248                 default: abort();
2249         }
2250 }
2251 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2252 CHECK(owner->result_ok);
2253         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2254 }
2255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2256         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2257         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2258         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2259         int64_t ret_ref = tag_ptr(ret_copy, true);
2260         return ret_ref;
2261 }
2262
2263 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2264 CHECK(!owner->result_ok);
2265         return DecodeError_clone(&*owner->contents.err);
2266 }
2267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2268         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2269         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2270         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2271         int64_t ret_ref = tag_ptr(ret_copy, true);
2272         return ret_ref;
2273 }
2274
2275 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2276         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2277         for (size_t i = 0; i < ret.datalen; i++) {
2278                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2279         }
2280         return ret;
2281 }
2282 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2283         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2284         for (size_t i = 0; i < ret.datalen; i++) {
2285                 ret.data[i] = TxOut_clone(&orig->data[i]);
2286         }
2287         return ret;
2288 }
2289 static jclass LDKCOption_u32Z_Some_class = NULL;
2290 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2291 static jclass LDKCOption_u32Z_None_class = NULL;
2292 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2294         LDKCOption_u32Z_Some_class =
2295                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2296         CHECK(LDKCOption_u32Z_Some_class != NULL);
2297         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2298         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2299         LDKCOption_u32Z_None_class =
2300                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2301         CHECK(LDKCOption_u32Z_None_class != NULL);
2302         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2303         CHECK(LDKCOption_u32Z_None_meth != NULL);
2304 }
2305 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2306         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2307         switch(obj->tag) {
2308                 case LDKCOption_u32Z_Some: {
2309                         int32_t some_conv = obj->some;
2310                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2311                 }
2312                 case LDKCOption_u32Z_None: {
2313                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2314                 }
2315                 default: abort();
2316         }
2317 }
2318 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8ZusizeZ_get_a(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
2319         return CVec_u8Z_clone(&owner->a);
2320 }
2321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2322         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
2323         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8ZusizeZ_get_a(owner_conv);
2324         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2325         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2326         CVec_u8Z_free(ret_var);
2327         return ret_arr;
2328 }
2329
2330 static inline uintptr_t C2Tuple_CVec_u8ZusizeZ_get_b(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR owner){
2331         return owner->b;
2332 }
2333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2334         LDKC2Tuple_CVec_u8ZusizeZ* owner_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(owner);
2335         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_get_b(owner_conv);
2336         return ret_conv;
2337 }
2338
2339 static inline struct LDKC2Tuple_CVec_u8ZusizeZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
2340 CHECK(owner->result_ok);
2341         return C2Tuple_CVec_u8ZusizeZ_clone(&*owner->contents.result);
2342 }
2343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2344         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
2345         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
2346         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(owner_conv);
2347         return tag_ptr(ret_conv, true);
2348 }
2349
2350 static inline void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner){
2351 CHECK(!owner->result_ok);
2352         return *owner->contents.err;
2353 }
2354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2355         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(owner);
2356         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv);
2357 }
2358
2359 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2360         LDKChannelDerivationParameters ret = *owner->contents.result;
2361         ret.is_owned = false;
2362         return ret;
2363 }
2364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2365         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2366         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
2367         int64_t ret_ref = 0;
2368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2370         return ret_ref;
2371 }
2372
2373 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2374 CHECK(!owner->result_ok);
2375         return DecodeError_clone(&*owner->contents.err);
2376 }
2377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2378         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2379         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2380         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
2381         int64_t ret_ref = tag_ptr(ret_copy, true);
2382         return ret_ref;
2383 }
2384
2385 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2386         LDKHTLCDescriptor ret = *owner->contents.result;
2387         ret.is_owned = false;
2388         return ret;
2389 }
2390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2391         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2392         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
2393         int64_t ret_ref = 0;
2394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2396         return ret_ref;
2397 }
2398
2399 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2400 CHECK(!owner->result_ok);
2401         return DecodeError_clone(&*owner->contents.err);
2402 }
2403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2404         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2405         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2406         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
2407         int64_t ret_ref = tag_ptr(ret_copy, true);
2408         return ret_ref;
2409 }
2410
2411 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2412 CHECK(owner->result_ok);
2413         return *owner->contents.result;
2414 }
2415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2416         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2417         CResult_NoneNoneZ_get_ok(owner_conv);
2418 }
2419
2420 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2421 CHECK(!owner->result_ok);
2422         return *owner->contents.err;
2423 }
2424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2425         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2426         CResult_NoneNoneZ_get_err(owner_conv);
2427 }
2428
2429 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2430         return owner->a;
2431 }
2432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2433         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2434         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2435         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2436         return ret_arr;
2437 }
2438
2439 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2440         return owner->b;
2441 }
2442 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2443         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2444         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2445         jobjectArray ret_arr = NULL;
2446         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2447         ;
2448         for (size_t i = 0; i < ret_var.datalen; i++) {
2449                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2450                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2451                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2452         }
2453         
2454         return ret_arr;
2455 }
2456
2457 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2458 CHECK(owner->result_ok);
2459         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2460 }
2461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2462         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2463         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2464         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2465         return tag_ptr(ret_conv, true);
2466 }
2467
2468 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2469 CHECK(!owner->result_ok);
2470         return *owner->contents.err;
2471 }
2472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2473         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2474         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2475 }
2476
2477 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2478 CHECK(owner->result_ok);
2479         return *owner->contents.result;
2480 }
2481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2482         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2483         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2484         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2485         return ret_arr;
2486 }
2487
2488 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2489 CHECK(!owner->result_ok);
2490         return *owner->contents.err;
2491 }
2492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2493         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2494         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2495 }
2496
2497 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2498 CHECK(owner->result_ok);
2499         return *owner->contents.result;
2500 }
2501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2502         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2503         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2504         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2505         return ret_arr;
2506 }
2507
2508 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2509 CHECK(!owner->result_ok);
2510         return *owner->contents.err;
2511 }
2512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2513         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2514         CResult_PublicKeyNoneZ_get_err(owner_conv);
2515 }
2516
2517 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2518 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2519 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2520 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2522         LDKCOption_BigEndianScalarZ_Some_class =
2523                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2524         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2525         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2526         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2527         LDKCOption_BigEndianScalarZ_None_class =
2528                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2529         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2530         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2531         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2532 }
2533 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2534         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2535         switch(obj->tag) {
2536                 case LDKCOption_BigEndianScalarZ_Some: {
2537                         LDKBigEndianScalar* some_ref = &obj->some;
2538                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2539                 }
2540                 case LDKCOption_BigEndianScalarZ_None: {
2541                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2542                 }
2543                 default: abort();
2544         }
2545 }
2546 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2547 CHECK(owner->result_ok);
2548         return *owner->contents.result;
2549 }
2550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2551         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2552         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2553         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2554         return ret_arr;
2555 }
2556
2557 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2558 CHECK(!owner->result_ok);
2559         return *owner->contents.err;
2560 }
2561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2562         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2563         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2564 }
2565
2566 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2567 CHECK(owner->result_ok);
2568         return *owner->contents.result;
2569 }
2570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2571         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2572         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2573         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2574         return ret_arr;
2575 }
2576
2577 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2578 CHECK(!owner->result_ok);
2579         return *owner->contents.err;
2580 }
2581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2582         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2583         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2584 }
2585
2586 typedef struct LDKChannelSigner_JCalls {
2587         atomic_size_t refcnt;
2588         JavaVM *vm;
2589         jweak o;
2590         jmethodID get_per_commitment_point_meth;
2591         jmethodID release_commitment_secret_meth;
2592         jmethodID validate_holder_commitment_meth;
2593         jmethodID channel_keys_id_meth;
2594         jmethodID provide_channel_parameters_meth;
2595 } LDKChannelSigner_JCalls;
2596 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2597         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2598         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2599                 JNIEnv *env;
2600                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2601                 if (get_jenv_res == JNI_EDETACHED) {
2602                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2603                 } else {
2604                         DO_ASSERT(get_jenv_res == JNI_OK);
2605                 }
2606                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2607                 if (get_jenv_res == JNI_EDETACHED) {
2608                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2609                 }
2610                 FREE(j_calls);
2611         }
2612 }
2613 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2614         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2615         JNIEnv *env;
2616         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2617         if (get_jenv_res == JNI_EDETACHED) {
2618                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2619         } else {
2620                 DO_ASSERT(get_jenv_res == JNI_OK);
2621         }
2622         int64_t idx_conv = idx;
2623         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2624         CHECK(obj != NULL);
2625         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2626         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2627                 (*env)->ExceptionDescribe(env);
2628                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2629         }
2630         LDKPublicKey ret_ref;
2631         CHECK((*env)->GetArrayLength(env, ret) == 33);
2632         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2633         if (get_jenv_res == JNI_EDETACHED) {
2634                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2635         }
2636         return ret_ref;
2637 }
2638 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2639         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2640         JNIEnv *env;
2641         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2642         if (get_jenv_res == JNI_EDETACHED) {
2643                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2644         } else {
2645                 DO_ASSERT(get_jenv_res == JNI_OK);
2646         }
2647         int64_t idx_conv = idx;
2648         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2649         CHECK(obj != NULL);
2650         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2651         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2652                 (*env)->ExceptionDescribe(env);
2653                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2654         }
2655         LDKThirtyTwoBytes ret_ref;
2656         CHECK((*env)->GetArrayLength(env, ret) == 32);
2657         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2658         if (get_jenv_res == JNI_EDETACHED) {
2659                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2660         }
2661         return ret_ref;
2662 }
2663 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
2664         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2665         JNIEnv *env;
2666         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2667         if (get_jenv_res == JNI_EDETACHED) {
2668                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2669         } else {
2670                 DO_ASSERT(get_jenv_res == JNI_OK);
2671         }
2672         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2673         int64_t holder_tx_ref = 0;
2674         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2675         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2676         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2677         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
2678         jobjectArray preimages_arr = NULL;
2679         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2680         ;
2681         for (size_t i = 0; i < preimages_var.datalen; i++) {
2682                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2683                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2684                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2685         }
2686         
2687         FREE(preimages_var.data);
2688         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2689         CHECK(obj != NULL);
2690         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
2691         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2692                 (*env)->ExceptionDescribe(env);
2693                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
2694         }
2695         void* ret_ptr = untag_ptr(ret);
2696         CHECK_ACCESS(ret_ptr);
2697         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2698         FREE(untag_ptr(ret));
2699         if (get_jenv_res == JNI_EDETACHED) {
2700                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2701         }
2702         return ret_conv;
2703 }
2704 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
2705         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2706         JNIEnv *env;
2707         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2708         if (get_jenv_res == JNI_EDETACHED) {
2709                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2710         } else {
2711                 DO_ASSERT(get_jenv_res == JNI_OK);
2712         }
2713         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2714         CHECK(obj != NULL);
2715         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2716         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2717                 (*env)->ExceptionDescribe(env);
2718                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
2719         }
2720         LDKThirtyTwoBytes ret_ref;
2721         CHECK((*env)->GetArrayLength(env, ret) == 32);
2722         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2723         if (get_jenv_res == JNI_EDETACHED) {
2724                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2725         }
2726         return ret_ref;
2727 }
2728 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2729         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2730         JNIEnv *env;
2731         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2732         if (get_jenv_res == JNI_EDETACHED) {
2733                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2734         } else {
2735                 DO_ASSERT(get_jenv_res == JNI_OK);
2736         }
2737         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2738         int64_t channel_parameters_ref = 0;
2739         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2740         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2741         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2742         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2743         CHECK(obj != NULL);
2744         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
2745         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2746                 (*env)->ExceptionDescribe(env);
2747                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
2748         }
2749         if (get_jenv_res == JNI_EDETACHED) {
2750                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2751         }
2752 }
2753 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2754         jclass c = (*env)->GetObjectClass(env, o);
2755         CHECK(c != NULL);
2756         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2757         atomic_init(&calls->refcnt, 1);
2758         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2759         calls->o = (*env)->NewWeakGlobalRef(env, o);
2760         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2761         CHECK(calls->get_per_commitment_point_meth != NULL);
2762         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2763         CHECK(calls->release_commitment_secret_meth != NULL);
2764         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
2765         CHECK(calls->validate_holder_commitment_meth != NULL);
2766         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2767         CHECK(calls->channel_keys_id_meth != NULL);
2768         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
2769         CHECK(calls->provide_channel_parameters_meth != NULL);
2770
2771         LDKChannelPublicKeys pubkeys_conv;
2772         pubkeys_conv.inner = untag_ptr(pubkeys);
2773         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2774         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2775
2776         LDKChannelSigner ret = {
2777                 .this_arg = (void*) calls,
2778                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2779                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2780                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2781                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2782                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2783                 .free = LDKChannelSigner_JCalls_free,
2784                 .pubkeys = pubkeys_conv,
2785                 .set_pubkeys = NULL,
2786         };
2787         return ret;
2788 }
2789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2790         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2791         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
2792         return tag_ptr(res_ptr, true);
2793 }
2794 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) {
2795         void* this_arg_ptr = untag_ptr(this_arg);
2796         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2797         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2798         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2799         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2800         return ret_arr;
2801 }
2802
2803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2804         void* this_arg_ptr = untag_ptr(this_arg);
2805         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2806         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2807         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2808         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2809         return ret_arr;
2810 }
2811
2812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray preimages) {
2813         void* this_arg_ptr = untag_ptr(this_arg);
2814         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2815         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2816         LDKHolderCommitmentTransaction holder_tx_conv;
2817         holder_tx_conv.inner = untag_ptr(holder_tx);
2818         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2819         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2820         holder_tx_conv.is_owned = false;
2821         LDKCVec_ThirtyTwoBytesZ preimages_constr;
2822         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
2823         if (preimages_constr.datalen > 0)
2824                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2825         else
2826                 preimages_constr.data = NULL;
2827         for (size_t i = 0; i < preimages_constr.datalen; i++) {
2828                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
2829                 LDKThirtyTwoBytes preimages_conv_8_ref;
2830                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
2831                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
2832                 preimages_constr.data[i] = preimages_conv_8_ref;
2833         }
2834         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2835         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
2836         return tag_ptr(ret_conv, true);
2837 }
2838
2839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2840         void* this_arg_ptr = untag_ptr(this_arg);
2841         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2842         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2843         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2844         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2845         return ret_arr;
2846 }
2847
2848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2849         void* this_arg_ptr = untag_ptr(this_arg);
2850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2851         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2852         LDKChannelTransactionParameters channel_parameters_conv;
2853         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2854         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2855         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2856         channel_parameters_conv.is_owned = false;
2857         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2858 }
2859
2860 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2861         if (this_arg->set_pubkeys != NULL)
2862                 this_arg->set_pubkeys(this_arg);
2863         return this_arg->pubkeys;
2864 }
2865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2866         void* this_arg_ptr = untag_ptr(this_arg);
2867         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2868         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2869         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2870         int64_t ret_ref = 0;
2871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2873         return ret_ref;
2874 }
2875
2876 typedef struct LDKEcdsaChannelSigner_JCalls {
2877         atomic_size_t refcnt;
2878         JavaVM *vm;
2879         jweak o;
2880         LDKChannelSigner_JCalls* ChannelSigner;
2881         jmethodID sign_counterparty_commitment_meth;
2882         jmethodID validate_counterparty_revocation_meth;
2883         jmethodID sign_holder_commitment_meth;
2884         jmethodID sign_justice_revoked_output_meth;
2885         jmethodID sign_justice_revoked_htlc_meth;
2886         jmethodID sign_holder_htlc_transaction_meth;
2887         jmethodID sign_counterparty_htlc_transaction_meth;
2888         jmethodID sign_closing_transaction_meth;
2889         jmethodID sign_holder_anchor_input_meth;
2890         jmethodID sign_channel_announcement_with_funding_key_meth;
2891 } LDKEcdsaChannelSigner_JCalls;
2892 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2893         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2894         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2895                 JNIEnv *env;
2896                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2897                 if (get_jenv_res == JNI_EDETACHED) {
2898                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2899                 } else {
2900                         DO_ASSERT(get_jenv_res == JNI_OK);
2901                 }
2902                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2903                 if (get_jenv_res == JNI_EDETACHED) {
2904                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2905                 }
2906                 FREE(j_calls);
2907         }
2908 }
2909 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ preimages) {
2910         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2911         JNIEnv *env;
2912         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2913         if (get_jenv_res == JNI_EDETACHED) {
2914                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2915         } else {
2916                 DO_ASSERT(get_jenv_res == JNI_OK);
2917         }
2918         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2919         int64_t commitment_tx_ref = 0;
2920         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2921         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2922         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2923         LDKCVec_ThirtyTwoBytesZ preimages_var = preimages;
2924         jobjectArray preimages_arr = NULL;
2925         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2926         ;
2927         for (size_t i = 0; i < preimages_var.datalen; i++) {
2928                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2929                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2930                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2931         }
2932         
2933         FREE(preimages_var.data);
2934         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2935         CHECK(obj != NULL);
2936         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
2937         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2938                 (*env)->ExceptionDescribe(env);
2939                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2940         }
2941         void* ret_ptr = untag_ptr(ret);
2942         CHECK_ACCESS(ret_ptr);
2943         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2944         FREE(untag_ptr(ret));
2945         if (get_jenv_res == JNI_EDETACHED) {
2946                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2947         }
2948         return ret_conv;
2949 }
2950 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2951         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2952         JNIEnv *env;
2953         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2954         if (get_jenv_res == JNI_EDETACHED) {
2955                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2956         } else {
2957                 DO_ASSERT(get_jenv_res == JNI_OK);
2958         }
2959         int64_t idx_conv = idx;
2960         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2961         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2962         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2963         CHECK(obj != NULL);
2964         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
2965         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2966                 (*env)->ExceptionDescribe(env);
2967                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception.");
2968         }
2969         void* ret_ptr = untag_ptr(ret);
2970         CHECK_ACCESS(ret_ptr);
2971         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2972         FREE(untag_ptr(ret));
2973         if (get_jenv_res == JNI_EDETACHED) {
2974                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2975         }
2976         return ret_conv;
2977 }
2978 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2979         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2980         JNIEnv *env;
2981         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2982         if (get_jenv_res == JNI_EDETACHED) {
2983                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2984         } else {
2985                 DO_ASSERT(get_jenv_res == JNI_OK);
2986         }
2987         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2988         int64_t commitment_tx_ref = 0;
2989         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2990         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2991         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2992         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2993         CHECK(obj != NULL);
2994         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
2995         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2996                 (*env)->ExceptionDescribe(env);
2997                 (*env)->FatalError(env, "A call to sign_holder_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2998         }
2999         void* ret_ptr = untag_ptr(ret);
3000         CHECK_ACCESS(ret_ptr);
3001         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3002         FREE(untag_ptr(ret));
3003         if (get_jenv_res == JNI_EDETACHED) {
3004                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3005         }
3006         return ret_conv;
3007 }
3008 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]) {
3009         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3010         JNIEnv *env;
3011         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3012         if (get_jenv_res == JNI_EDETACHED) {
3013                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3014         } else {
3015                 DO_ASSERT(get_jenv_res == JNI_OK);
3016         }
3017         LDKTransaction justice_tx_var = justice_tx;
3018         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3019         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3020         Transaction_free(justice_tx_var);
3021         int64_t input_conv = input;
3022         int64_t amount_conv = amount;
3023         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3024         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3025         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3026         CHECK(obj != NULL);
3027         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);
3028         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3029                 (*env)->ExceptionDescribe(env);
3030                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
3031         }
3032         void* ret_ptr = untag_ptr(ret);
3033         CHECK_ACCESS(ret_ptr);
3034         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3035         FREE(untag_ptr(ret));
3036         if (get_jenv_res == JNI_EDETACHED) {
3037                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3038         }
3039         return ret_conv;
3040 }
3041 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) {
3042         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3043         JNIEnv *env;
3044         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3045         if (get_jenv_res == JNI_EDETACHED) {
3046                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3047         } else {
3048                 DO_ASSERT(get_jenv_res == JNI_OK);
3049         }
3050         LDKTransaction justice_tx_var = justice_tx;
3051         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3052         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3053         Transaction_free(justice_tx_var);
3054         int64_t input_conv = input;
3055         int64_t amount_conv = amount;
3056         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3057         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3058         LDKHTLCOutputInCommitment htlc_var = *htlc;
3059         int64_t htlc_ref = 0;
3060         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3061         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3062         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3063         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3064         CHECK(obj != NULL);
3065         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);
3066         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3067                 (*env)->ExceptionDescribe(env);
3068                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
3069         }
3070         void* ret_ptr = untag_ptr(ret);
3071         CHECK_ACCESS(ret_ptr);
3072         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3073         FREE(untag_ptr(ret));
3074         if (get_jenv_res == JNI_EDETACHED) {
3075                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3076         }
3077         return ret_conv;
3078 }
3079 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3080         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3081         JNIEnv *env;
3082         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3083         if (get_jenv_res == JNI_EDETACHED) {
3084                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3085         } else {
3086                 DO_ASSERT(get_jenv_res == JNI_OK);
3087         }
3088         LDKTransaction htlc_tx_var = htlc_tx;
3089         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3090         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3091         Transaction_free(htlc_tx_var);
3092         int64_t input_conv = input;
3093         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3094         int64_t htlc_descriptor_ref = 0;
3095         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3096         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3097         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3098         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3099         CHECK(obj != NULL);
3100         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3101         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3102                 (*env)->ExceptionDescribe(env);
3103                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3104         }
3105         void* ret_ptr = untag_ptr(ret);
3106         CHECK_ACCESS(ret_ptr);
3107         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3108         FREE(untag_ptr(ret));
3109         if (get_jenv_res == JNI_EDETACHED) {
3110                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3111         }
3112         return ret_conv;
3113 }
3114 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) {
3115         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3116         JNIEnv *env;
3117         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3118         if (get_jenv_res == JNI_EDETACHED) {
3119                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3120         } else {
3121                 DO_ASSERT(get_jenv_res == JNI_OK);
3122         }
3123         LDKTransaction htlc_tx_var = htlc_tx;
3124         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3125         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3126         Transaction_free(htlc_tx_var);
3127         int64_t input_conv = input;
3128         int64_t amount_conv = amount;
3129         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3130         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3131         LDKHTLCOutputInCommitment htlc_var = *htlc;
3132         int64_t htlc_ref = 0;
3133         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3134         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3135         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3136         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3137         CHECK(obj != NULL);
3138         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);
3139         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3140                 (*env)->ExceptionDescribe(env);
3141                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3142         }
3143         void* ret_ptr = untag_ptr(ret);
3144         CHECK_ACCESS(ret_ptr);
3145         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3146         FREE(untag_ptr(ret));
3147         if (get_jenv_res == JNI_EDETACHED) {
3148                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3149         }
3150         return ret_conv;
3151 }
3152 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3153         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3154         JNIEnv *env;
3155         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3156         if (get_jenv_res == JNI_EDETACHED) {
3157                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3158         } else {
3159                 DO_ASSERT(get_jenv_res == JNI_OK);
3160         }
3161         LDKClosingTransaction closing_tx_var = *closing_tx;
3162         int64_t closing_tx_ref = 0;
3163         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3164         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3165         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3166         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3167         CHECK(obj != NULL);
3168         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3169         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3170                 (*env)->ExceptionDescribe(env);
3171                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3172         }
3173         void* ret_ptr = untag_ptr(ret);
3174         CHECK_ACCESS(ret_ptr);
3175         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3176         FREE(untag_ptr(ret));
3177         if (get_jenv_res == JNI_EDETACHED) {
3178                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3179         }
3180         return ret_conv;
3181 }
3182 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3183         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3184         JNIEnv *env;
3185         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3186         if (get_jenv_res == JNI_EDETACHED) {
3187                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3188         } else {
3189                 DO_ASSERT(get_jenv_res == JNI_OK);
3190         }
3191         LDKTransaction anchor_tx_var = anchor_tx;
3192         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3193         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3194         Transaction_free(anchor_tx_var);
3195         int64_t input_conv = input;
3196         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3197         CHECK(obj != NULL);
3198         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3199         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3200                 (*env)->ExceptionDescribe(env);
3201                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3202         }
3203         void* ret_ptr = untag_ptr(ret);
3204         CHECK_ACCESS(ret_ptr);
3205         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3206         FREE(untag_ptr(ret));
3207         if (get_jenv_res == JNI_EDETACHED) {
3208                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3209         }
3210         return ret_conv;
3211 }
3212 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3213         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3214         JNIEnv *env;
3215         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3216         if (get_jenv_res == JNI_EDETACHED) {
3217                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3218         } else {
3219                 DO_ASSERT(get_jenv_res == JNI_OK);
3220         }
3221         LDKUnsignedChannelAnnouncement msg_var = *msg;
3222         int64_t msg_ref = 0;
3223         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3224         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3225         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3226         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3227         CHECK(obj != NULL);
3228         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3229         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3230                 (*env)->ExceptionDescribe(env);
3231                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3232         }
3233         void* ret_ptr = untag_ptr(ret);
3234         CHECK_ACCESS(ret_ptr);
3235         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3236         FREE(untag_ptr(ret));
3237         if (get_jenv_res == JNI_EDETACHED) {
3238                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3239         }
3240         return ret_conv;
3241 }
3242 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3243         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3244         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3245         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3246 }
3247 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3248         jclass c = (*env)->GetObjectClass(env, o);
3249         CHECK(c != NULL);
3250         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3251         atomic_init(&calls->refcnt, 1);
3252         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3253         calls->o = (*env)->NewWeakGlobalRef(env, o);
3254         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
3255         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3256         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3257         CHECK(calls->validate_counterparty_revocation_meth != NULL);
3258         calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
3259         CHECK(calls->sign_holder_commitment_meth != NULL);
3260         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3261         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3262         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3263         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3264         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3265         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3266         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3267         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3268         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3269         CHECK(calls->sign_closing_transaction_meth != NULL);
3270         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3271         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3272         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3273         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3274
3275         LDKChannelPublicKeys pubkeys_conv;
3276         pubkeys_conv.inner = untag_ptr(pubkeys);
3277         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3278         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3279
3280         LDKEcdsaChannelSigner ret = {
3281                 .this_arg = (void*) calls,
3282                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3283                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
3284                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
3285                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3286                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3287                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3288                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3289                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3290                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3291                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3292                 .free = LDKEcdsaChannelSigner_JCalls_free,
3293                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3294         };
3295         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3296         return ret;
3297 }
3298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3299         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3300         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3301         return tag_ptr(res_ptr, true);
3302 }
3303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3304         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3305         return tag_ptr(&inp->ChannelSigner, false);
3306 }
3307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray preimages) {
3308         void* this_arg_ptr = untag_ptr(this_arg);
3309         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3310         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3311         LDKCommitmentTransaction commitment_tx_conv;
3312         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3313         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3314         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3315         commitment_tx_conv.is_owned = false;
3316         LDKCVec_ThirtyTwoBytesZ preimages_constr;
3317         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
3318         if (preimages_constr.datalen > 0)
3319                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3320         else
3321                 preimages_constr.data = NULL;
3322         for (size_t i = 0; i < preimages_constr.datalen; i++) {
3323                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
3324                 LDKThirtyTwoBytes preimages_conv_8_ref;
3325                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
3326                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
3327                 preimages_constr.data[i] = preimages_conv_8_ref;
3328         }
3329         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3330         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3331         return tag_ptr(ret_conv, true);
3332 }
3333
3334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
3335         void* this_arg_ptr = untag_ptr(this_arg);
3336         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3337         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3338         uint8_t secret_arr[32];
3339         CHECK((*env)->GetArrayLength(env, secret) == 32);
3340         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3341         uint8_t (*secret_ref)[32] = &secret_arr;
3342         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3343         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3344         return tag_ptr(ret_conv, true);
3345 }
3346
3347 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) {
3348         void* this_arg_ptr = untag_ptr(this_arg);
3349         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3350         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3351         LDKHolderCommitmentTransaction commitment_tx_conv;
3352         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3353         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3354         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3355         commitment_tx_conv.is_owned = false;
3356         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3357         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3358         return tag_ptr(ret_conv, true);
3359 }
3360
3361 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) {
3362         void* this_arg_ptr = untag_ptr(this_arg);
3363         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3364         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3365         LDKTransaction justice_tx_ref;
3366         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3367         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3368         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3369         justice_tx_ref.data_is_owned = true;
3370         uint8_t per_commitment_key_arr[32];
3371         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3372         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3373         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3374         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3375         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3376         return tag_ptr(ret_conv, true);
3377 }
3378
3379 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) {
3380         void* this_arg_ptr = untag_ptr(this_arg);
3381         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3382         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3383         LDKTransaction justice_tx_ref;
3384         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3385         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3386         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3387         justice_tx_ref.data_is_owned = true;
3388         uint8_t per_commitment_key_arr[32];
3389         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3390         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3391         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3392         LDKHTLCOutputInCommitment htlc_conv;
3393         htlc_conv.inner = untag_ptr(htlc);
3394         htlc_conv.is_owned = ptr_is_owned(htlc);
3395         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3396         htlc_conv.is_owned = false;
3397         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3398         *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);
3399         return tag_ptr(ret_conv, true);
3400 }
3401
3402 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) {
3403         void* this_arg_ptr = untag_ptr(this_arg);
3404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3405         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3406         LDKTransaction htlc_tx_ref;
3407         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3408         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3409         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3410         htlc_tx_ref.data_is_owned = true;
3411         LDKHTLCDescriptor htlc_descriptor_conv;
3412         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3413         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3414         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3415         htlc_descriptor_conv.is_owned = false;
3416         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3417         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3418         return tag_ptr(ret_conv, true);
3419 }
3420
3421 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) {
3422         void* this_arg_ptr = untag_ptr(this_arg);
3423         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3424         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3425         LDKTransaction htlc_tx_ref;
3426         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3427         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3428         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3429         htlc_tx_ref.data_is_owned = true;
3430         LDKPublicKey per_commitment_point_ref;
3431         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3432         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3433         LDKHTLCOutputInCommitment htlc_conv;
3434         htlc_conv.inner = untag_ptr(htlc);
3435         htlc_conv.is_owned = ptr_is_owned(htlc);
3436         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3437         htlc_conv.is_owned = false;
3438         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3439         *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);
3440         return tag_ptr(ret_conv, true);
3441 }
3442
3443 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) {
3444         void* this_arg_ptr = untag_ptr(this_arg);
3445         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3446         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3447         LDKClosingTransaction closing_tx_conv;
3448         closing_tx_conv.inner = untag_ptr(closing_tx);
3449         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3450         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3451         closing_tx_conv.is_owned = false;
3452         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3453         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3454         return tag_ptr(ret_conv, true);
3455 }
3456
3457 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) {
3458         void* this_arg_ptr = untag_ptr(this_arg);
3459         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3460         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3461         LDKTransaction anchor_tx_ref;
3462         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3463         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3464         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3465         anchor_tx_ref.data_is_owned = true;
3466         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3467         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3468         return tag_ptr(ret_conv, true);
3469 }
3470
3471 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) {
3472         void* this_arg_ptr = untag_ptr(this_arg);
3473         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3474         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3475         LDKUnsignedChannelAnnouncement msg_conv;
3476         msg_conv.inner = untag_ptr(msg);
3477         msg_conv.is_owned = ptr_is_owned(msg);
3478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3479         msg_conv.is_owned = false;
3480         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3481         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3482         return tag_ptr(ret_conv, true);
3483 }
3484
3485 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3486         atomic_size_t refcnt;
3487         JavaVM *vm;
3488         jweak o;
3489         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3490         LDKChannelSigner_JCalls* ChannelSigner;
3491         jmethodID write_meth;
3492 } LDKWriteableEcdsaChannelSigner_JCalls;
3493 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3494         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3495         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3496                 JNIEnv *env;
3497                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3498                 if (get_jenv_res == JNI_EDETACHED) {
3499                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3500                 } else {
3501                         DO_ASSERT(get_jenv_res == JNI_OK);
3502                 }
3503                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3504                 if (get_jenv_res == JNI_EDETACHED) {
3505                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3506                 }
3507                 FREE(j_calls);
3508         }
3509 }
3510 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3511         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3512         JNIEnv *env;
3513         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3514         if (get_jenv_res == JNI_EDETACHED) {
3515                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3516         } else {
3517                 DO_ASSERT(get_jenv_res == JNI_OK);
3518         }
3519         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3520         CHECK(obj != NULL);
3521         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3522         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3523                 (*env)->ExceptionDescribe(env);
3524                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3525         }
3526         LDKCVec_u8Z ret_ref;
3527         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3528         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3529         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3530         if (get_jenv_res == JNI_EDETACHED) {
3531                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3532         }
3533         return ret_ref;
3534 }
3535 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3536         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3537         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3538         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3539         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3540 }
3541 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3542         jclass c = (*env)->GetObjectClass(env, o);
3543         CHECK(c != NULL);
3544         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3545         atomic_init(&calls->refcnt, 1);
3546         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3547         calls->o = (*env)->NewWeakGlobalRef(env, o);
3548         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3549         CHECK(calls->write_meth != NULL);
3550
3551         LDKChannelPublicKeys pubkeys_conv;
3552         pubkeys_conv.inner = untag_ptr(pubkeys);
3553         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3554         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3555
3556         LDKWriteableEcdsaChannelSigner ret = {
3557                 .this_arg = (void*) calls,
3558                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3559                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3560                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3561                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3562         };
3563         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3564         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3565         return ret;
3566 }
3567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3568         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3569         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3570         return tag_ptr(res_ptr, true);
3571 }
3572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3573         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3574         return tag_ptr(&inp->EcdsaChannelSigner, false);
3575 }
3576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3577         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3578         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3579 }
3580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3581         void* this_arg_ptr = untag_ptr(this_arg);
3582         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3583         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3584         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3585         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3586         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3587         CVec_u8Z_free(ret_var);
3588         return ret_arr;
3589 }
3590
3591 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3592 CHECK(owner->result_ok);
3593         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3594 }
3595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3596         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3597         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3598         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3599         return tag_ptr(ret_ret, true);
3600 }
3601
3602 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3603 CHECK(!owner->result_ok);
3604         return DecodeError_clone(&*owner->contents.err);
3605 }
3606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3607         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3608         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3609         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3610         int64_t ret_ref = tag_ptr(ret_copy, true);
3611         return ret_ref;
3612 }
3613
3614 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3615 CHECK(owner->result_ok);
3616         return CVec_u8Z_clone(&*owner->contents.result);
3617 }
3618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3619         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3620         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
3621         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3622         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3623         CVec_u8Z_free(ret_var);
3624         return ret_arr;
3625 }
3626
3627 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3628 CHECK(!owner->result_ok);
3629         return *owner->contents.err;
3630 }
3631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3632         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3633         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
3634 }
3635
3636 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3637         LDKShutdownScript ret = *owner->contents.result;
3638         ret.is_owned = false;
3639         return ret;
3640 }
3641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3642         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3643         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3644         int64_t ret_ref = 0;
3645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3647         return ret_ref;
3648 }
3649
3650 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3651 CHECK(!owner->result_ok);
3652         return *owner->contents.err;
3653 }
3654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3655         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3656         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3657 }
3658
3659 static jclass LDKCOption_u16Z_Some_class = NULL;
3660 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3661 static jclass LDKCOption_u16Z_None_class = NULL;
3662 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3664         LDKCOption_u16Z_Some_class =
3665                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
3666         CHECK(LDKCOption_u16Z_Some_class != NULL);
3667         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3668         CHECK(LDKCOption_u16Z_Some_meth != NULL);
3669         LDKCOption_u16Z_None_class =
3670                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
3671         CHECK(LDKCOption_u16Z_None_class != NULL);
3672         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3673         CHECK(LDKCOption_u16Z_None_meth != NULL);
3674 }
3675 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3676         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
3677         switch(obj->tag) {
3678                 case LDKCOption_u16Z_Some: {
3679                         int16_t some_conv = obj->some;
3680                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
3681                 }
3682                 case LDKCOption_u16Z_None: {
3683                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3684                 }
3685                 default: abort();
3686         }
3687 }
3688 static jclass LDKCOption_boolZ_Some_class = NULL;
3689 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
3690 static jclass LDKCOption_boolZ_None_class = NULL;
3691 static jmethodID LDKCOption_boolZ_None_meth = NULL;
3692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
3693         LDKCOption_boolZ_Some_class =
3694                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
3695         CHECK(LDKCOption_boolZ_Some_class != NULL);
3696         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
3697         CHECK(LDKCOption_boolZ_Some_meth != NULL);
3698         LDKCOption_boolZ_None_class =
3699                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
3700         CHECK(LDKCOption_boolZ_None_class != NULL);
3701         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
3702         CHECK(LDKCOption_boolZ_None_meth != NULL);
3703 }
3704 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3705         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
3706         switch(obj->tag) {
3707                 case LDKCOption_boolZ_Some: {
3708                         jboolean some_conv = obj->some;
3709                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
3710                 }
3711                 case LDKCOption_boolZ_None: {
3712                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
3713                 }
3714                 default: abort();
3715         }
3716 }
3717 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3718         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3719         for (size_t i = 0; i < ret.datalen; i++) {
3720                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3721         }
3722         return ret;
3723 }
3724 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3725 CHECK(owner->result_ok);
3726         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
3727 }
3728 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3729         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3730         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
3731         jobjectArray ret_arr = NULL;
3732         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3733         ;
3734         for (size_t i = 0; i < ret_var.datalen; i++) {
3735                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
3736                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
3737                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
3738                 CVec_u8Z_free(ret_conv_8_var);
3739                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3740         }
3741         
3742         FREE(ret_var.data);
3743         return ret_arr;
3744 }
3745
3746 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3747 CHECK(!owner->result_ok);
3748         return *owner->contents.err;
3749 }
3750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3751         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3752         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
3753 }
3754
3755 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3756         LDKInMemorySigner ret = *owner->contents.result;
3757         ret.is_owned = false;
3758         return ret;
3759 }
3760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3761         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3762         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3763         int64_t ret_ref = 0;
3764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3766         return ret_ref;
3767 }
3768
3769 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3770 CHECK(!owner->result_ok);
3771         return DecodeError_clone(&*owner->contents.err);
3772 }
3773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3774         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3775         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3776         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3777         int64_t ret_ref = tag_ptr(ret_copy, true);
3778         return ret_ref;
3779 }
3780
3781 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3782 CHECK(owner->result_ok);
3783         return *owner->contents.result;
3784 }
3785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3786         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3787         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3788         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3789         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3790         return ret_arr;
3791 }
3792
3793 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3794 CHECK(!owner->result_ok);
3795         return *owner->contents.err;
3796 }
3797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3798         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3799         CResult_TransactionNoneZ_get_err(owner_conv);
3800 }
3801
3802 typedef struct LDKScoreLookUp_JCalls {
3803         atomic_size_t refcnt;
3804         JavaVM *vm;
3805         jweak o;
3806         jmethodID channel_penalty_msat_meth;
3807 } LDKScoreLookUp_JCalls;
3808 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
3809         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3810         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3811                 JNIEnv *env;
3812                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3813                 if (get_jenv_res == JNI_EDETACHED) {
3814                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3815                 } else {
3816                         DO_ASSERT(get_jenv_res == JNI_OK);
3817                 }
3818                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3819                 if (get_jenv_res == JNI_EDETACHED) {
3820                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3821                 }
3822                 FREE(j_calls);
3823         }
3824 }
3825 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
3826         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3827         JNIEnv *env;
3828         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3829         if (get_jenv_res == JNI_EDETACHED) {
3830                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3831         } else {
3832                 DO_ASSERT(get_jenv_res == JNI_OK);
3833         }
3834         int64_t short_channel_id_conv = short_channel_id;
3835         LDKNodeId source_var = *source;
3836         int64_t source_ref = 0;
3837         source_var = NodeId_clone(&source_var);
3838         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
3839         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
3840         LDKNodeId target_var = *target;
3841         int64_t target_ref = 0;
3842         target_var = NodeId_clone(&target_var);
3843         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
3844         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
3845         LDKChannelUsage usage_var = usage;
3846         int64_t usage_ref = 0;
3847         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
3848         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
3849         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
3850         int64_t score_params_ref = 0;
3851         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
3852         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
3853         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
3854         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3855         CHECK(obj != NULL);
3856         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref);
3857         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3858                 (*env)->ExceptionDescribe(env);
3859                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
3860         }
3861         if (get_jenv_res == JNI_EDETACHED) {
3862                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3863         }
3864         return ret;
3865 }
3866 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
3867         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
3868         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3869 }
3870 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
3871         jclass c = (*env)->GetObjectClass(env, o);
3872         CHECK(c != NULL);
3873         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
3874         atomic_init(&calls->refcnt, 1);
3875         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3876         calls->o = (*env)->NewWeakGlobalRef(env, o);
3877         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
3878         CHECK(calls->channel_penalty_msat_meth != NULL);
3879
3880         LDKScoreLookUp ret = {
3881                 .this_arg = (void*) calls,
3882                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
3883                 .free = LDKScoreLookUp_JCalls_free,
3884         };
3885         return ret;
3886 }
3887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
3888         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
3889         *res_ptr = LDKScoreLookUp_init(env, clz, o);
3890         return tag_ptr(res_ptr, true);
3891 }
3892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t source, int64_t target, int64_t usage, int64_t score_params) {
3893         void* this_arg_ptr = untag_ptr(this_arg);
3894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3895         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
3896         LDKNodeId source_conv;
3897         source_conv.inner = untag_ptr(source);
3898         source_conv.is_owned = ptr_is_owned(source);
3899         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
3900         source_conv.is_owned = false;
3901         LDKNodeId target_conv;
3902         target_conv.inner = untag_ptr(target);
3903         target_conv.is_owned = ptr_is_owned(target);
3904         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
3905         target_conv.is_owned = false;
3906         LDKChannelUsage usage_conv;
3907         usage_conv.inner = untag_ptr(usage);
3908         usage_conv.is_owned = ptr_is_owned(usage);
3909         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
3910         usage_conv = ChannelUsage_clone(&usage_conv);
3911         LDKProbabilisticScoringFeeParameters score_params_conv;
3912         score_params_conv.inner = untag_ptr(score_params);
3913         score_params_conv.is_owned = ptr_is_owned(score_params);
3914         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
3915         score_params_conv.is_owned = false;
3916         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv, &score_params_conv);
3917         return ret_conv;
3918 }
3919
3920 typedef struct LDKScoreUpdate_JCalls {
3921         atomic_size_t refcnt;
3922         JavaVM *vm;
3923         jweak o;
3924         jmethodID payment_path_failed_meth;
3925         jmethodID payment_path_successful_meth;
3926         jmethodID probe_failed_meth;
3927         jmethodID probe_successful_meth;
3928 } LDKScoreUpdate_JCalls;
3929 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
3930         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3931         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3932                 JNIEnv *env;
3933                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3934                 if (get_jenv_res == JNI_EDETACHED) {
3935                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3936                 } else {
3937                         DO_ASSERT(get_jenv_res == JNI_OK);
3938                 }
3939                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3940                 if (get_jenv_res == JNI_EDETACHED) {
3941                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3942                 }
3943                 FREE(j_calls);
3944         }
3945 }
3946 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3947         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3948         JNIEnv *env;
3949         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3950         if (get_jenv_res == JNI_EDETACHED) {
3951                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3952         } else {
3953                 DO_ASSERT(get_jenv_res == JNI_OK);
3954         }
3955         LDKPath path_var = *path;
3956         int64_t path_ref = 0;
3957         path_var = Path_clone(&path_var);
3958         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3959         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3960         int64_t short_channel_id_conv = short_channel_id;
3961         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3962         CHECK(obj != NULL);
3963         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv);
3964         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3965                 (*env)->ExceptionDescribe(env);
3966                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScoreUpdate from rust threw an exception.");
3967         }
3968         if (get_jenv_res == JNI_EDETACHED) {
3969                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3970         }
3971 }
3972 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
3973         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3974         JNIEnv *env;
3975         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3976         if (get_jenv_res == JNI_EDETACHED) {
3977                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3978         } else {
3979                 DO_ASSERT(get_jenv_res == JNI_OK);
3980         }
3981         LDKPath path_var = *path;
3982         int64_t path_ref = 0;
3983         path_var = Path_clone(&path_var);
3984         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3985         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3986         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3987         CHECK(obj != NULL);
3988         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref);
3989         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3990                 (*env)->ExceptionDescribe(env);
3991                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate from rust threw an exception.");
3992         }
3993         if (get_jenv_res == JNI_EDETACHED) {
3994                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3995         }
3996 }
3997 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3998         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3999         JNIEnv *env;
4000         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4001         if (get_jenv_res == JNI_EDETACHED) {
4002                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4003         } else {
4004                 DO_ASSERT(get_jenv_res == JNI_OK);
4005         }
4006         LDKPath path_var = *path;
4007         int64_t path_ref = 0;
4008         path_var = Path_clone(&path_var);
4009         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4010         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4011         int64_t short_channel_id_conv = short_channel_id;
4012         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4013         CHECK(obj != NULL);
4014         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv);
4015         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4016                 (*env)->ExceptionDescribe(env);
4017                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
4018         }
4019         if (get_jenv_res == JNI_EDETACHED) {
4020                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4021         }
4022 }
4023 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path) {
4024         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4025         JNIEnv *env;
4026         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4027         if (get_jenv_res == JNI_EDETACHED) {
4028                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4029         } else {
4030                 DO_ASSERT(get_jenv_res == JNI_OK);
4031         }
4032         LDKPath path_var = *path;
4033         int64_t path_ref = 0;
4034         path_var = Path_clone(&path_var);
4035         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4036         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4037         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4038         CHECK(obj != NULL);
4039         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref);
4040         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4041                 (*env)->ExceptionDescribe(env);
4042                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
4043         }
4044         if (get_jenv_res == JNI_EDETACHED) {
4045                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4046         }
4047 }
4048 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
4049         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
4050         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4051 }
4052 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
4053         jclass c = (*env)->GetObjectClass(env, o);
4054         CHECK(c != NULL);
4055         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
4056         atomic_init(&calls->refcnt, 1);
4057         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4058         calls->o = (*env)->NewWeakGlobalRef(env, o);
4059         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJ)V");
4060         CHECK(calls->payment_path_failed_meth != NULL);
4061         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(J)V");
4062         CHECK(calls->payment_path_successful_meth != NULL);
4063         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJ)V");
4064         CHECK(calls->probe_failed_meth != NULL);
4065         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(J)V");
4066         CHECK(calls->probe_successful_meth != NULL);
4067
4068         LDKScoreUpdate ret = {
4069                 .this_arg = (void*) calls,
4070                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
4071                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
4072                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
4073                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
4074                 .free = LDKScoreUpdate_JCalls_free,
4075         };
4076         return ret;
4077 }
4078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
4079         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4080         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4081         return tag_ptr(res_ptr, true);
4082 }
4083 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) {
4084         void* this_arg_ptr = untag_ptr(this_arg);
4085         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4086         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4087         LDKPath path_conv;
4088         path_conv.inner = untag_ptr(path);
4089         path_conv.is_owned = ptr_is_owned(path);
4090         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4091         path_conv.is_owned = false;
4092         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
4093 }
4094
4095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
4096         void* this_arg_ptr = untag_ptr(this_arg);
4097         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4098         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4099         LDKPath path_conv;
4100         path_conv.inner = untag_ptr(path);
4101         path_conv.is_owned = ptr_is_owned(path);
4102         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4103         path_conv.is_owned = false;
4104         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
4105 }
4106
4107 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) {
4108         void* this_arg_ptr = untag_ptr(this_arg);
4109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4110         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4111         LDKPath path_conv;
4112         path_conv.inner = untag_ptr(path);
4113         path_conv.is_owned = ptr_is_owned(path);
4114         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4115         path_conv.is_owned = false;
4116         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
4117 }
4118
4119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
4120         void* this_arg_ptr = untag_ptr(this_arg);
4121         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4122         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4123         LDKPath path_conv;
4124         path_conv.inner = untag_ptr(path);
4125         path_conv.is_owned = ptr_is_owned(path);
4126         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4127         path_conv.is_owned = false;
4128         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
4129 }
4130
4131 typedef struct LDKLockableScore_JCalls {
4132         atomic_size_t refcnt;
4133         JavaVM *vm;
4134         jweak o;
4135         jmethodID read_lock_meth;
4136         jmethodID write_lock_meth;
4137 } LDKLockableScore_JCalls;
4138 static void LDKLockableScore_JCalls_free(void* this_arg) {
4139         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4140         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4141                 JNIEnv *env;
4142                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4143                 if (get_jenv_res == JNI_EDETACHED) {
4144                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4145                 } else {
4146                         DO_ASSERT(get_jenv_res == JNI_OK);
4147                 }
4148                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4149                 if (get_jenv_res == JNI_EDETACHED) {
4150                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4151                 }
4152                 FREE(j_calls);
4153         }
4154 }
4155 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4156         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4157         JNIEnv *env;
4158         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4159         if (get_jenv_res == JNI_EDETACHED) {
4160                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4161         } else {
4162                 DO_ASSERT(get_jenv_res == JNI_OK);
4163         }
4164         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4165         CHECK(obj != NULL);
4166         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4167         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4168                 (*env)->ExceptionDescribe(env);
4169                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4170         }
4171         void* ret_ptr = untag_ptr(ret);
4172         CHECK_ACCESS(ret_ptr);
4173         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4174         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4175                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4176                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4177         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4178         
4179         if (get_jenv_res == JNI_EDETACHED) {
4180                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4181         }
4182         return ret_conv;
4183 }
4184 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4185         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4186         JNIEnv *env;
4187         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4188         if (get_jenv_res == JNI_EDETACHED) {
4189                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4190         } else {
4191                 DO_ASSERT(get_jenv_res == JNI_OK);
4192         }
4193         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4194         CHECK(obj != NULL);
4195         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4196         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4197                 (*env)->ExceptionDescribe(env);
4198                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4199         }
4200         void* ret_ptr = untag_ptr(ret);
4201         CHECK_ACCESS(ret_ptr);
4202         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4203         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4204                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4205                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4206         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4207         
4208         if (get_jenv_res == JNI_EDETACHED) {
4209                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4210         }
4211         return ret_conv;
4212 }
4213 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4214         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4215         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4216 }
4217 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4218         jclass c = (*env)->GetObjectClass(env, o);
4219         CHECK(c != NULL);
4220         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4221         atomic_init(&calls->refcnt, 1);
4222         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4223         calls->o = (*env)->NewWeakGlobalRef(env, o);
4224         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4225         CHECK(calls->read_lock_meth != NULL);
4226         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4227         CHECK(calls->write_lock_meth != NULL);
4228
4229         LDKLockableScore ret = {
4230                 .this_arg = (void*) calls,
4231                 .read_lock = read_lock_LDKLockableScore_jcall,
4232                 .write_lock = write_lock_LDKLockableScore_jcall,
4233                 .free = LDKLockableScore_JCalls_free,
4234         };
4235         return ret;
4236 }
4237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4238         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4239         *res_ptr = LDKLockableScore_init(env, clz, o);
4240         return tag_ptr(res_ptr, true);
4241 }
4242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4243         void* this_arg_ptr = untag_ptr(this_arg);
4244         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4245         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4246         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4247         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4248         return tag_ptr(ret_ret, true);
4249 }
4250
4251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4252         void* this_arg_ptr = untag_ptr(this_arg);
4253         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4254         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4255         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4256         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4257         return tag_ptr(ret_ret, true);
4258 }
4259
4260 typedef struct LDKWriteableScore_JCalls {
4261         atomic_size_t refcnt;
4262         JavaVM *vm;
4263         jweak o;
4264         LDKLockableScore_JCalls* LockableScore;
4265         jmethodID write_meth;
4266 } LDKWriteableScore_JCalls;
4267 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4268         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4269         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4270                 JNIEnv *env;
4271                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4272                 if (get_jenv_res == JNI_EDETACHED) {
4273                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4274                 } else {
4275                         DO_ASSERT(get_jenv_res == JNI_OK);
4276                 }
4277                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4278                 if (get_jenv_res == JNI_EDETACHED) {
4279                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4280                 }
4281                 FREE(j_calls);
4282         }
4283 }
4284 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4285         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4286         JNIEnv *env;
4287         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4288         if (get_jenv_res == JNI_EDETACHED) {
4289                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4290         } else {
4291                 DO_ASSERT(get_jenv_res == JNI_OK);
4292         }
4293         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4294         CHECK(obj != NULL);
4295         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4296         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4297                 (*env)->ExceptionDescribe(env);
4298                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4299         }
4300         LDKCVec_u8Z ret_ref;
4301         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4302         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4303         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4304         if (get_jenv_res == JNI_EDETACHED) {
4305                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4306         }
4307         return ret_ref;
4308 }
4309 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4310         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4311         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4312         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4313 }
4314 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4315         jclass c = (*env)->GetObjectClass(env, o);
4316         CHECK(c != NULL);
4317         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4318         atomic_init(&calls->refcnt, 1);
4319         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4320         calls->o = (*env)->NewWeakGlobalRef(env, o);
4321         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4322         CHECK(calls->write_meth != NULL);
4323
4324         LDKWriteableScore ret = {
4325                 .this_arg = (void*) calls,
4326                 .write = write_LDKWriteableScore_jcall,
4327                 .free = LDKWriteableScore_JCalls_free,
4328                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4329         };
4330         calls->LockableScore = ret.LockableScore.this_arg;
4331         return ret;
4332 }
4333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4334         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4335         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4336         return tag_ptr(res_ptr, true);
4337 }
4338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4339         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4340         return tag_ptr(&inp->LockableScore, false);
4341 }
4342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4343         void* this_arg_ptr = untag_ptr(this_arg);
4344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4345         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4346         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4347         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4348         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4349         CVec_u8Z_free(ret_var);
4350         return ret_arr;
4351 }
4352
4353 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4354 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4355 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4356 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4358         LDKCOption_WriteableScoreZ_Some_class =
4359                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4360         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4361         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4362         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4363         LDKCOption_WriteableScoreZ_None_class =
4364                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4365         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4366         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4367         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4368 }
4369 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4370         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4371         switch(obj->tag) {
4372                 case LDKCOption_WriteableScoreZ_Some: {
4373                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4374                         *some_ret = obj->some;
4375                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4376                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4377                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4378                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4379                         }
4380                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4381                 }
4382                 case LDKCOption_WriteableScoreZ_None: {
4383                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4384                 }
4385                 default: abort();
4386         }
4387 }
4388 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4389 CHECK(owner->result_ok);
4390         return *owner->contents.result;
4391 }
4392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4393         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4394         CResult_NoneIOErrorZ_get_ok(owner_conv);
4395 }
4396
4397 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4398 CHECK(!owner->result_ok);
4399         return *owner->contents.err;
4400 }
4401 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4402         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4403         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4404         return ret_conv;
4405 }
4406
4407 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4408         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4409         for (size_t i = 0; i < ret.datalen; i++) {
4410                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4411         }
4412         return ret;
4413 }
4414 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4415         LDKRoute ret = *owner->contents.result;
4416         ret.is_owned = false;
4417         return ret;
4418 }
4419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4420         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4421         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4422         int64_t ret_ref = 0;
4423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4425         return ret_ref;
4426 }
4427
4428 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4429         LDKLightningError ret = *owner->contents.err;
4430         ret.is_owned = false;
4431         return ret;
4432 }
4433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4434         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4435         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4436         int64_t ret_ref = 0;
4437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4439         return ret_ref;
4440 }
4441
4442 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4443         LDKInFlightHtlcs ret = *owner->contents.result;
4444         ret.is_owned = false;
4445         return ret;
4446 }
4447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4448         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4449         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4450         int64_t ret_ref = 0;
4451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4453         return ret_ref;
4454 }
4455
4456 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4457 CHECK(!owner->result_ok);
4458         return DecodeError_clone(&*owner->contents.err);
4459 }
4460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4461         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4462         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4463         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4464         int64_t ret_ref = tag_ptr(ret_copy, true);
4465         return ret_ref;
4466 }
4467
4468 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4469         LDKRouteHop ret = *owner->contents.result;
4470         ret.is_owned = false;
4471         return ret;
4472 }
4473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4474         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4475         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4476         int64_t ret_ref = 0;
4477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4479         return ret_ref;
4480 }
4481
4482 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4483 CHECK(!owner->result_ok);
4484         return DecodeError_clone(&*owner->contents.err);
4485 }
4486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4487         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4488         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4489         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
4490         int64_t ret_ref = tag_ptr(ret_copy, true);
4491         return ret_ref;
4492 }
4493
4494 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
4495         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
4496         for (size_t i = 0; i < ret.datalen; i++) {
4497                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
4498         }
4499         return ret;
4500 }
4501 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4502         LDKBlindedTail ret = *owner->contents.result;
4503         ret.is_owned = false;
4504         return ret;
4505 }
4506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4507         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4508         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
4509         int64_t ret_ref = 0;
4510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4512         return ret_ref;
4513 }
4514
4515 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4516 CHECK(!owner->result_ok);
4517         return DecodeError_clone(&*owner->contents.err);
4518 }
4519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4520         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4521         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4522         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
4523         int64_t ret_ref = tag_ptr(ret_copy, true);
4524         return ret_ref;
4525 }
4526
4527 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
4528         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
4529         for (size_t i = 0; i < ret.datalen; i++) {
4530                 ret.data[i] = RouteHop_clone(&orig->data[i]);
4531         }
4532         return ret;
4533 }
4534 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
4535         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
4536         for (size_t i = 0; i < ret.datalen; i++) {
4537                 ret.data[i] = Path_clone(&orig->data[i]);
4538         }
4539         return ret;
4540 }
4541 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4542         LDKRoute ret = *owner->contents.result;
4543         ret.is_owned = false;
4544         return ret;
4545 }
4546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4547         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4548         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
4549         int64_t ret_ref = 0;
4550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4552         return ret_ref;
4553 }
4554
4555 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4556 CHECK(!owner->result_ok);
4557         return DecodeError_clone(&*owner->contents.err);
4558 }
4559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4560         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4561         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4562         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
4563         int64_t ret_ref = tag_ptr(ret_copy, true);
4564         return ret_ref;
4565 }
4566
4567 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4568         LDKRouteParameters ret = *owner->contents.result;
4569         ret.is_owned = false;
4570         return ret;
4571 }
4572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4573         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4574         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
4575         int64_t ret_ref = 0;
4576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4578         return ret_ref;
4579 }
4580
4581 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4582 CHECK(!owner->result_ok);
4583         return DecodeError_clone(&*owner->contents.err);
4584 }
4585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4586         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4587         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4588         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
4589         int64_t ret_ref = tag_ptr(ret_copy, true);
4590         return ret_ref;
4591 }
4592
4593 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4594         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4595         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4596         return ret;
4597 }
4598 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4599         LDKPaymentParameters ret = *owner->contents.result;
4600         ret.is_owned = false;
4601         return ret;
4602 }
4603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4604         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4605         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
4606         int64_t ret_ref = 0;
4607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4609         return ret_ref;
4610 }
4611
4612 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4613 CHECK(!owner->result_ok);
4614         return DecodeError_clone(&*owner->contents.err);
4615 }
4616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4617         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4619         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
4620         int64_t ret_ref = tag_ptr(ret_copy, true);
4621         return ret_ref;
4622 }
4623
4624 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4625         LDKBlindedPayInfo ret = owner->a;
4626         ret.is_owned = false;
4627         return ret;
4628 }
4629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4630         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4631         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4632         int64_t ret_ref = 0;
4633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4635         return ret_ref;
4636 }
4637
4638 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4639         LDKBlindedPath ret = owner->b;
4640         ret.is_owned = false;
4641         return ret;
4642 }
4643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4644         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4645         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4646         int64_t ret_ref = 0;
4647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4649         return ret_ref;
4650 }
4651
4652 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4653         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4654         for (size_t i = 0; i < ret.datalen; i++) {
4655                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4656         }
4657         return ret;
4658 }
4659 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4660         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4661         for (size_t i = 0; i < ret.datalen; i++) {
4662                 ret.data[i] = RouteHint_clone(&orig->data[i]);
4663         }
4664         return ret;
4665 }
4666 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
4667         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
4668         for (size_t i = 0; i < ret.datalen; i++) {
4669                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
4670         }
4671         return ret;
4672 }
4673 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4674         LDKRouteHint ret = *owner->contents.result;
4675         ret.is_owned = false;
4676         return ret;
4677 }
4678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4679         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4680         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
4681         int64_t ret_ref = 0;
4682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4684         return ret_ref;
4685 }
4686
4687 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4688 CHECK(!owner->result_ok);
4689         return DecodeError_clone(&*owner->contents.err);
4690 }
4691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4692         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4693         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4694         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
4695         int64_t ret_ref = tag_ptr(ret_copy, true);
4696         return ret_ref;
4697 }
4698
4699 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4700         LDKRouteHintHop ret = *owner->contents.result;
4701         ret.is_owned = false;
4702         return ret;
4703 }
4704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4705         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4706         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
4707         int64_t ret_ref = 0;
4708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4710         return ret_ref;
4711 }
4712
4713 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4714 CHECK(!owner->result_ok);
4715         return DecodeError_clone(&*owner->contents.err);
4716 }
4717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4718         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4719         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4720         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
4721         int64_t ret_ref = tag_ptr(ret_copy, true);
4722         return ret_ref;
4723 }
4724
4725 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4726         LDKFixedPenaltyScorer ret = *owner->contents.result;
4727         ret.is_owned = false;
4728         return ret;
4729 }
4730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4731         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4732         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4733         int64_t ret_ref = 0;
4734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4736         return ret_ref;
4737 }
4738
4739 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4740 CHECK(!owner->result_ok);
4741         return DecodeError_clone(&*owner->contents.err);
4742 }
4743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4744         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4745         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4746         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4747         int64_t ret_ref = tag_ptr(ret_copy, true);
4748         return ret_ref;
4749 }
4750
4751 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4752         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4753         for (size_t i = 0; i < ret.datalen; i++) {
4754                 ret.data[i] = NodeId_clone(&orig->data[i]);
4755         }
4756         return ret;
4757 }
4758 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4759         return owner->a;
4760 }
4761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4762         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4763         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4764         return ret_conv;
4765 }
4766
4767 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4768         return owner->b;
4769 }
4770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4771         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4772         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4773         return ret_conv;
4774 }
4775
4776 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4777 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4778 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4779 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4781         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4782                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4783         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4784         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4785         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4786         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4787                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4788         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4789         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4790         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4791 }
4792 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4793         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4794         switch(obj->tag) {
4795                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4796                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4797                         *some_conv = obj->some;
4798                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4799                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4800                 }
4801                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4802                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4803                 }
4804                 default: abort();
4805         }
4806 }
4807 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4808         return owner->a;
4809 }
4810 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4811         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4812         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4813         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
4814         return ret_arr;
4815 }
4816
4817 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4818         return owner->b;
4819 }
4820 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4821         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4822         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4823         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
4824         return ret_arr;
4825 }
4826
4827 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4828         return owner->a;
4829 }
4830 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4831         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4832         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4833         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
4834         return ret_arr;
4835 }
4836
4837 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4838         return owner->b;
4839 }
4840 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4841         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4842         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4843         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
4844         return ret_arr;
4845 }
4846
4847 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
4848 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
4849 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
4850 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
4851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
4852         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
4853                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
4854         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
4855         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
4856         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
4857         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
4858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
4859         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
4860         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
4861         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
4862 }
4863 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4864         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
4865         switch(obj->tag) {
4866                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
4867                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
4868                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
4869                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
4870                 }
4871                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
4872                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
4873                 }
4874                 default: abort();
4875         }
4876 }
4877 static jclass LDKCOption_f64Z_Some_class = NULL;
4878 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
4879 static jclass LDKCOption_f64Z_None_class = NULL;
4880 static jmethodID LDKCOption_f64Z_None_meth = NULL;
4881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
4882         LDKCOption_f64Z_Some_class =
4883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
4884         CHECK(LDKCOption_f64Z_Some_class != NULL);
4885         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
4886         CHECK(LDKCOption_f64Z_Some_meth != NULL);
4887         LDKCOption_f64Z_None_class =
4888                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
4889         CHECK(LDKCOption_f64Z_None_class != NULL);
4890         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
4891         CHECK(LDKCOption_f64Z_None_meth != NULL);
4892 }
4893 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4894         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
4895         switch(obj->tag) {
4896                 case LDKCOption_f64Z_Some: {
4897                         double some_conv = obj->some;
4898                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
4899                 }
4900                 case LDKCOption_f64Z_None: {
4901                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
4902                 }
4903                 default: abort();
4904         }
4905 }
4906 typedef struct LDKLogger_JCalls {
4907         atomic_size_t refcnt;
4908         JavaVM *vm;
4909         jweak o;
4910         jmethodID log_meth;
4911 } LDKLogger_JCalls;
4912 static void LDKLogger_JCalls_free(void* this_arg) {
4913         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4914         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4915                 JNIEnv *env;
4916                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4917                 if (get_jenv_res == JNI_EDETACHED) {
4918                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4919                 } else {
4920                         DO_ASSERT(get_jenv_res == JNI_OK);
4921                 }
4922                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4923                 if (get_jenv_res == JNI_EDETACHED) {
4924                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4925                 }
4926                 FREE(j_calls);
4927         }
4928 }
4929 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4930         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4931         JNIEnv *env;
4932         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4933         if (get_jenv_res == JNI_EDETACHED) {
4934                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4935         } else {
4936                 DO_ASSERT(get_jenv_res == JNI_OK);
4937         }
4938         LDKRecord record_var = *record;
4939         int64_t record_ref = 0;
4940         record_var = Record_clone(&record_var);
4941         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4942         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
4943         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4944         CHECK(obj != NULL);
4945         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
4946         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4947                 (*env)->ExceptionDescribe(env);
4948                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4949         }
4950         if (get_jenv_res == JNI_EDETACHED) {
4951                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4952         }
4953 }
4954 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4955         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4956         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4957 }
4958 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4959         jclass c = (*env)->GetObjectClass(env, o);
4960         CHECK(c != NULL);
4961         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4962         atomic_init(&calls->refcnt, 1);
4963         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4964         calls->o = (*env)->NewWeakGlobalRef(env, o);
4965         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
4966         CHECK(calls->log_meth != NULL);
4967
4968         LDKLogger ret = {
4969                 .this_arg = (void*) calls,
4970                 .log = log_LDKLogger_jcall,
4971                 .free = LDKLogger_JCalls_free,
4972         };
4973         return ret;
4974 }
4975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4976         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4977         *res_ptr = LDKLogger_init(env, clz, o);
4978         return tag_ptr(res_ptr, true);
4979 }
4980 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4981         LDKProbabilisticScorer ret = *owner->contents.result;
4982         ret.is_owned = false;
4983         return ret;
4984 }
4985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4986         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4987         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
4988         int64_t ret_ref = 0;
4989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4991         return ret_ref;
4992 }
4993
4994 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4995 CHECK(!owner->result_ok);
4996         return DecodeError_clone(&*owner->contents.err);
4997 }
4998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4999         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5000         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5001         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
5002         int64_t ret_ref = tag_ptr(ret_copy, true);
5003         return ret_ref;
5004 }
5005
5006 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5007         return owner->a;
5008 }
5009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5010         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5011         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
5012         return ret_conv;
5013 }
5014
5015 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5016         return owner->b;
5017 }
5018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5019         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5020         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
5021         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5022         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5023         return ret_arr;
5024 }
5025
5026 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
5027         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
5028         for (size_t i = 0; i < ret.datalen; i++) {
5029                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
5030         }
5031         return ret;
5032 }
5033 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5034         return ThirtyTwoBytes_clone(&owner->a);
5035 }
5036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5037         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5038         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5039         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
5040         return ret_arr;
5041 }
5042
5043 static inline struct LDKCOption_ThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5044         return COption_ThirtyTwoBytesZ_clone(&owner->b);
5045 }
5046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5047         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5048         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
5049         *ret_copy = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_get_b(owner_conv);
5050         int64_t ret_ref = tag_ptr(ret_copy, true);
5051         return ret_ref;
5052 }
5053
5054 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ *orig) {
5055         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
5056         for (size_t i = 0; i < ret.datalen; i++) {
5057                 ret.data[i] = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
5058         }
5059         return ret;
5060 }
5061 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5062 CHECK(owner->result_ok);
5063         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
5064 }
5065 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5066         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5067         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
5068         return ret_conv;
5069 }
5070
5071 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5072 CHECK(!owner->result_ok);
5073         return *owner->contents.err;
5074 }
5075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5076         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5077         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
5078 }
5079
5080 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5081 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5082 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5083 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5084 static jclass LDKMonitorEvent_Completed_class = NULL;
5085 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5087         LDKMonitorEvent_HTLCEvent_class =
5088                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5089         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5090         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5091         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5092         LDKMonitorEvent_HolderForceClosed_class =
5093                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5094         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5095         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5096         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5097         LDKMonitorEvent_Completed_class =
5098                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5099         CHECK(LDKMonitorEvent_Completed_class != NULL);
5100         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
5101         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5102 }
5103 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5104         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5105         switch(obj->tag) {
5106                 case LDKMonitorEvent_HTLCEvent: {
5107                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5108                         int64_t htlc_event_ref = 0;
5109                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5110                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5111                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5112                 }
5113                 case LDKMonitorEvent_HolderForceClosed: {
5114                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5115                         int64_t holder_force_closed_ref = 0;
5116                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5117                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5118                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5119                 }
5120                 case LDKMonitorEvent_Completed: {
5121                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5122                         int64_t funding_txo_ref = 0;
5123                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5124                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5125                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5126                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
5127                 }
5128                 default: abort();
5129         }
5130 }
5131 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5132         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5133         for (size_t i = 0; i < ret.datalen; i++) {
5134                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5135         }
5136         return ret;
5137 }
5138 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5139         LDKOutPoint ret = owner->a;
5140         ret.is_owned = false;
5141         return ret;
5142 }
5143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5144         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5145         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5146         int64_t ret_ref = 0;
5147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5149         return ret_ref;
5150 }
5151
5152 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5153         return CVec_MonitorEventZ_clone(&owner->b);
5154 }
5155 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5156         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5157         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5158         int64_tArray ret_arr = NULL;
5159         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5160         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5161         for (size_t o = 0; o < ret_var.datalen; o++) {
5162                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5163                 *ret_conv_14_copy = ret_var.data[o];
5164                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5165                 ret_arr_ptr[o] = ret_conv_14_ref;
5166         }
5167         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5168         FREE(ret_var.data);
5169         return ret_arr;
5170 }
5171
5172 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5173         return owner->c;
5174 }
5175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5176         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5177         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5178         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
5179         return ret_arr;
5180 }
5181
5182 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
5183         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5184         for (size_t i = 0; i < ret.datalen; i++) {
5185                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5186         }
5187         return ret;
5188 }
5189 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5190         LDKInitFeatures ret = *owner->contents.result;
5191         ret.is_owned = false;
5192         return ret;
5193 }
5194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5195         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5196         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5197         int64_t ret_ref = 0;
5198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5200         return ret_ref;
5201 }
5202
5203 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5204 CHECK(!owner->result_ok);
5205         return DecodeError_clone(&*owner->contents.err);
5206 }
5207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5208         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5209         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5210         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
5211         int64_t ret_ref = tag_ptr(ret_copy, true);
5212         return ret_ref;
5213 }
5214
5215 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5216         LDKChannelFeatures ret = *owner->contents.result;
5217         ret.is_owned = false;
5218         return ret;
5219 }
5220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5221         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5222         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
5223         int64_t ret_ref = 0;
5224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5226         return ret_ref;
5227 }
5228
5229 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5230 CHECK(!owner->result_ok);
5231         return DecodeError_clone(&*owner->contents.err);
5232 }
5233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5234         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5235         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5236         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
5237         int64_t ret_ref = tag_ptr(ret_copy, true);
5238         return ret_ref;
5239 }
5240
5241 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5242         LDKNodeFeatures ret = *owner->contents.result;
5243         ret.is_owned = false;
5244         return ret;
5245 }
5246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5247         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5248         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
5249         int64_t ret_ref = 0;
5250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5252         return ret_ref;
5253 }
5254
5255 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5256 CHECK(!owner->result_ok);
5257         return DecodeError_clone(&*owner->contents.err);
5258 }
5259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5260         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5261         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5262         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
5263         int64_t ret_ref = tag_ptr(ret_copy, true);
5264         return ret_ref;
5265 }
5266
5267 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5268         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
5269         ret.is_owned = false;
5270         return ret;
5271 }
5272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5273         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5274         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5275         int64_t ret_ref = 0;
5276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5278         return ret_ref;
5279 }
5280
5281 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5282 CHECK(!owner->result_ok);
5283         return DecodeError_clone(&*owner->contents.err);
5284 }
5285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5286         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5287         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5288         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5289         int64_t ret_ref = tag_ptr(ret_copy, true);
5290         return ret_ref;
5291 }
5292
5293 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5294         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
5295         ret.is_owned = false;
5296         return ret;
5297 }
5298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5299         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5300         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5301         int64_t ret_ref = 0;
5302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5304         return ret_ref;
5305 }
5306
5307 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5308 CHECK(!owner->result_ok);
5309         return DecodeError_clone(&*owner->contents.err);
5310 }
5311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5312         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5313         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5314         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5315         int64_t ret_ref = tag_ptr(ret_copy, true);
5316         return ret_ref;
5317 }
5318
5319 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5320         LDKBlindedHopFeatures ret = *owner->contents.result;
5321         ret.is_owned = false;
5322         return ret;
5323 }
5324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5325         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5326         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
5327         int64_t ret_ref = 0;
5328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5330         return ret_ref;
5331 }
5332
5333 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5334 CHECK(!owner->result_ok);
5335         return DecodeError_clone(&*owner->contents.err);
5336 }
5337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5338         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5339         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5340         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
5341         int64_t ret_ref = tag_ptr(ret_copy, true);
5342         return ret_ref;
5343 }
5344
5345 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5346         LDKChannelTypeFeatures ret = *owner->contents.result;
5347         ret.is_owned = false;
5348         return ret;
5349 }
5350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5351         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5352         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
5353         int64_t ret_ref = 0;
5354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5356         return ret_ref;
5357 }
5358
5359 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5360 CHECK(!owner->result_ok);
5361         return DecodeError_clone(&*owner->contents.err);
5362 }
5363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5364         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5365         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5366         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
5367         int64_t ret_ref = tag_ptr(ret_copy, true);
5368         return ret_ref;
5369 }
5370
5371 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5372         LDKOffer ret = *owner->contents.result;
5373         ret.is_owned = false;
5374         return ret;
5375 }
5376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5377         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5378         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5379         int64_t ret_ref = 0;
5380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5382         return ret_ref;
5383 }
5384
5385 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5386         LDKBolt12ParseError ret = *owner->contents.err;
5387         ret.is_owned = false;
5388         return ret;
5389 }
5390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5391         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5392         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5393         int64_t ret_ref = 0;
5394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5396         return ret_ref;
5397 }
5398
5399 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5400 CHECK(owner->result_ok);
5401         return *owner->contents.result;
5402 }
5403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5404         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5405         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5406         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
5407         return ret_arr;
5408 }
5409
5410 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5411 CHECK(!owner->result_ok);
5412         return *owner->contents.err;
5413 }
5414 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5415         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5416         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
5417         return ret_conv;
5418 }
5419
5420 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5421         LDKNodeId ret = *owner->contents.result;
5422         ret.is_owned = false;
5423         return ret;
5424 }
5425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5426         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5427         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5428         int64_t ret_ref = 0;
5429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5431         return ret_ref;
5432 }
5433
5434 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5435 CHECK(!owner->result_ok);
5436         return DecodeError_clone(&*owner->contents.err);
5437 }
5438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5439         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5440         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5441         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5442         int64_t ret_ref = tag_ptr(ret_copy, true);
5443         return ret_ref;
5444 }
5445
5446 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
5447 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
5448 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
5449 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
5450 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
5451 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
5452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
5453         LDKNetworkUpdate_ChannelUpdateMessage_class =
5454                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
5455         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
5456         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
5457         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
5458         LDKNetworkUpdate_ChannelFailure_class =
5459                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
5460         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
5461         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
5462         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
5463         LDKNetworkUpdate_NodeFailure_class =
5464                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
5465         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
5466         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
5467         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
5468 }
5469 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5470         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
5471         switch(obj->tag) {
5472                 case LDKNetworkUpdate_ChannelUpdateMessage: {
5473                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
5474                         int64_t msg_ref = 0;
5475                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5476                         msg_ref = tag_ptr(msg_var.inner, false);
5477                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
5478                 }
5479                 case LDKNetworkUpdate_ChannelFailure: {
5480                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
5481                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
5482                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
5483                 }
5484                 case LDKNetworkUpdate_NodeFailure: {
5485                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5486                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
5487                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
5488                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
5489                 }
5490                 default: abort();
5491         }
5492 }
5493 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
5494 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
5495 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
5496 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
5497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
5498         LDKCOption_NetworkUpdateZ_Some_class =
5499                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
5500         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
5501         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
5502         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
5503         LDKCOption_NetworkUpdateZ_None_class =
5504                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
5505         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
5506         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
5507         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
5508 }
5509 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5510         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
5511         switch(obj->tag) {
5512                 case LDKCOption_NetworkUpdateZ_Some: {
5513                         int64_t some_ref = tag_ptr(&obj->some, false);
5514                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
5515                 }
5516                 case LDKCOption_NetworkUpdateZ_None: {
5517                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
5518                 }
5519                 default: abort();
5520         }
5521 }
5522 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5523 CHECK(owner->result_ok);
5524         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5525 }
5526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5527         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5528         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5529         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5530         int64_t ret_ref = tag_ptr(ret_copy, true);
5531         return ret_ref;
5532 }
5533
5534 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5535 CHECK(!owner->result_ok);
5536         return DecodeError_clone(&*owner->contents.err);
5537 }
5538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5539         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5540         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5541         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5542         int64_t ret_ref = tag_ptr(ret_copy, true);
5543         return ret_ref;
5544 }
5545
5546 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5547 CHECK(owner->result_ok);
5548         return TxOut_clone(&*owner->contents.result);
5549 }
5550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5551         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5552         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5553         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5554         return tag_ptr(ret_ref, true);
5555 }
5556
5557 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5558 CHECK(!owner->result_ok);
5559         return UtxoLookupError_clone(&*owner->contents.err);
5560 }
5561 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5562         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5563         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5564         return ret_conv;
5565 }
5566
5567 static jclass LDKUtxoResult_Sync_class = NULL;
5568 static jmethodID LDKUtxoResult_Sync_meth = NULL;
5569 static jclass LDKUtxoResult_Async_class = NULL;
5570 static jmethodID LDKUtxoResult_Async_meth = NULL;
5571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
5572         LDKUtxoResult_Sync_class =
5573                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
5574         CHECK(LDKUtxoResult_Sync_class != NULL);
5575         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
5576         CHECK(LDKUtxoResult_Sync_meth != NULL);
5577         LDKUtxoResult_Async_class =
5578                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
5579         CHECK(LDKUtxoResult_Async_class != NULL);
5580         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
5581         CHECK(LDKUtxoResult_Async_meth != NULL);
5582 }
5583 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5584         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5585         switch(obj->tag) {
5586                 case LDKUtxoResult_Sync: {
5587                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5588                         *sync_conv = obj->sync;
5589                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5590                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
5591                 }
5592                 case LDKUtxoResult_Async: {
5593                         LDKUtxoFuture async_var = obj->async;
5594                         int64_t async_ref = 0;
5595                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5596                         async_ref = tag_ptr(async_var.inner, false);
5597                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
5598                 }
5599                 default: abort();
5600         }
5601 }
5602 typedef struct LDKUtxoLookup_JCalls {
5603         atomic_size_t refcnt;
5604         JavaVM *vm;
5605         jweak o;
5606         jmethodID get_utxo_meth;
5607 } LDKUtxoLookup_JCalls;
5608 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5609         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5610         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5611                 JNIEnv *env;
5612                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5613                 if (get_jenv_res == JNI_EDETACHED) {
5614                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5615                 } else {
5616                         DO_ASSERT(get_jenv_res == JNI_OK);
5617                 }
5618                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5619                 if (get_jenv_res == JNI_EDETACHED) {
5620                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5621                 }
5622                 FREE(j_calls);
5623         }
5624 }
5625 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
5626         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5627         JNIEnv *env;
5628         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5629         if (get_jenv_res == JNI_EDETACHED) {
5630                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5631         } else {
5632                 DO_ASSERT(get_jenv_res == JNI_OK);
5633         }
5634         int8_tArray chain_hash_arr = (*env)->NewByteArray(env, 32);
5635         (*env)->SetByteArrayRegion(env, chain_hash_arr, 0, 32, *chain_hash);
5636         int64_t short_channel_id_conv = short_channel_id;
5637         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5638         CHECK(obj != NULL);
5639         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, chain_hash_arr, short_channel_id_conv);
5640         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5641                 (*env)->ExceptionDescribe(env);
5642                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
5643         }
5644         void* ret_ptr = untag_ptr(ret);
5645         CHECK_ACCESS(ret_ptr);
5646         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5647         FREE(untag_ptr(ret));
5648         if (get_jenv_res == JNI_EDETACHED) {
5649                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5650         }
5651         return ret_conv;
5652 }
5653 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5654         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5655         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5656 }
5657 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
5658         jclass c = (*env)->GetObjectClass(env, o);
5659         CHECK(c != NULL);
5660         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5661         atomic_init(&calls->refcnt, 1);
5662         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5663         calls->o = (*env)->NewWeakGlobalRef(env, o);
5664         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5665         CHECK(calls->get_utxo_meth != NULL);
5666
5667         LDKUtxoLookup ret = {
5668                 .this_arg = (void*) calls,
5669                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5670                 .free = LDKUtxoLookup_JCalls_free,
5671         };
5672         return ret;
5673 }
5674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
5675         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5676         *res_ptr = LDKUtxoLookup_init(env, clz, o);
5677         return tag_ptr(res_ptr, true);
5678 }
5679 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) {
5680         void* this_arg_ptr = untag_ptr(this_arg);
5681         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5682         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5683         uint8_t chain_hash_arr[32];
5684         CHECK((*env)->GetArrayLength(env, chain_hash) == 32);
5685         (*env)->GetByteArrayRegion(env, chain_hash, 0, 32, chain_hash_arr);
5686         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
5687         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5688         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
5689         int64_t ret_ref = tag_ptr(ret_copy, true);
5690         return ret_ref;
5691 }
5692
5693 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
5694 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
5695 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
5696 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
5697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
5698         LDKCOption_UtxoLookupZ_Some_class =
5699                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
5700         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
5701         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
5702         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
5703         LDKCOption_UtxoLookupZ_None_class =
5704                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
5705         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
5706         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
5707         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
5708 }
5709 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5710         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5711         switch(obj->tag) {
5712                 case LDKCOption_UtxoLookupZ_Some: {
5713                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5714                         *some_ret = obj->some;
5715                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5716                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5717                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5718                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5719                         }
5720                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
5721                 }
5722                 case LDKCOption_UtxoLookupZ_None: {
5723                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
5724                 }
5725                 default: abort();
5726         }
5727 }
5728 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5729 CHECK(owner->result_ok);
5730         return *owner->contents.result;
5731 }
5732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5733         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5734         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5735 }
5736
5737 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5738         LDKLightningError ret = *owner->contents.err;
5739         ret.is_owned = false;
5740         return ret;
5741 }
5742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5743         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5744         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5745         int64_t ret_ref = 0;
5746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5748         return ret_ref;
5749 }
5750
5751 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5752 CHECK(owner->result_ok);
5753         return *owner->contents.result;
5754 }
5755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5756         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5757         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5758         return ret_conv;
5759 }
5760
5761 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5762         LDKLightningError ret = *owner->contents.err;
5763         ret.is_owned = false;
5764         return ret;
5765 }
5766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5767         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5768         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5769         int64_t ret_ref = 0;
5770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5772         return ret_ref;
5773 }
5774
5775 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5776         LDKChannelAnnouncement ret = owner->a;
5777         ret.is_owned = false;
5778         return ret;
5779 }
5780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5781         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5782         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5783         int64_t ret_ref = 0;
5784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5786         return ret_ref;
5787 }
5788
5789 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5790         LDKChannelUpdate ret = owner->b;
5791         ret.is_owned = false;
5792         return ret;
5793 }
5794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5795         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5796         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5797         int64_t ret_ref = 0;
5798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5800         return ret_ref;
5801 }
5802
5803 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5804         LDKChannelUpdate ret = owner->c;
5805         ret.is_owned = false;
5806         return ret;
5807 }
5808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5809         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5810         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5811         int64_t ret_ref = 0;
5812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5814         return ret_ref;
5815 }
5816
5817 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5818 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5819 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5820 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5822         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5823                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5824         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5825         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
5826         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
5827         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
5828                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
5829         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
5830         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
5831         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
5832 }
5833 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5834         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5835         switch(obj->tag) {
5836                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
5837                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5838                         *some_conv = obj->some;
5839                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5840                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
5841                 }
5842                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
5843                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
5844                 }
5845                 default: abort();
5846         }
5847 }
5848 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
5849 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
5850 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
5851 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
5852 static jclass LDKErrorAction_IgnoreError_class = NULL;
5853 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
5854 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
5855 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
5856 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
5857 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
5858 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
5859 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
5860 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
5861 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
5862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
5863         LDKErrorAction_DisconnectPeer_class =
5864                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
5865         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
5866         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
5867         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
5868         LDKErrorAction_DisconnectPeerWithWarning_class =
5869                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
5870         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
5871         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
5872         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
5873         LDKErrorAction_IgnoreError_class =
5874                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
5875         CHECK(LDKErrorAction_IgnoreError_class != NULL);
5876         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
5877         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
5878         LDKErrorAction_IgnoreAndLog_class =
5879                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
5880         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
5881         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
5882         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
5883         LDKErrorAction_IgnoreDuplicateGossip_class =
5884                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
5885         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
5886         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
5887         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
5888         LDKErrorAction_SendErrorMessage_class =
5889                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
5890         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
5891         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
5892         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
5893         LDKErrorAction_SendWarningMessage_class =
5894                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
5895         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
5896         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
5897         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
5898 }
5899 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5900         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
5901         switch(obj->tag) {
5902                 case LDKErrorAction_DisconnectPeer: {
5903                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
5904                         int64_t msg_ref = 0;
5905                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5906                         msg_ref = tag_ptr(msg_var.inner, false);
5907                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
5908                 }
5909                 case LDKErrorAction_DisconnectPeerWithWarning: {
5910                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
5911                         int64_t msg_ref = 0;
5912                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5913                         msg_ref = tag_ptr(msg_var.inner, false);
5914                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
5915                 }
5916                 case LDKErrorAction_IgnoreError: {
5917                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
5918                 }
5919                 case LDKErrorAction_IgnoreAndLog: {
5920                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
5921                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
5922                 }
5923                 case LDKErrorAction_IgnoreDuplicateGossip: {
5924                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
5925                 }
5926                 case LDKErrorAction_SendErrorMessage: {
5927                         LDKErrorMessage msg_var = obj->send_error_message.msg;
5928                         int64_t msg_ref = 0;
5929                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5930                         msg_ref = tag_ptr(msg_var.inner, false);
5931                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
5932                 }
5933                 case LDKErrorAction_SendWarningMessage: {
5934                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
5935                         int64_t msg_ref = 0;
5936                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5937                         msg_ref = tag_ptr(msg_var.inner, false);
5938                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
5939                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
5940                 }
5941                 default: abort();
5942         }
5943 }
5944 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
5945 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
5946 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
5947 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
5948 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
5949 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
5950 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
5951 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
5952 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
5953 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
5954 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
5955 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
5956 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
5957 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
5958 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
5959 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
5960 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
5961 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
5962 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
5963 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
5964 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
5965 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
5966 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
5967 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
5968 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
5969 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
5970 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
5971 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
5972 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
5973 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
5974 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
5975 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
5976 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
5977 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
5978 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
5979 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
5980 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
5981 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
5982 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
5983 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
5984 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
5985 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
5986 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
5987 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
5988 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
5989 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
5990 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
5991 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
5992 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
5993 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
5994 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
5995 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
5996 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
5997 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
5998 static jclass LDKMessageSendEvent_HandleError_class = NULL;
5999 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
6000 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
6001 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
6002 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
6003 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
6004 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
6005 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
6006 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
6007 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
6008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
6009         LDKMessageSendEvent_SendAcceptChannel_class =
6010                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
6011         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
6012         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
6013         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
6014         LDKMessageSendEvent_SendAcceptChannelV2_class =
6015                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
6016         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
6017         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
6018         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
6019         LDKMessageSendEvent_SendOpenChannel_class =
6020                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
6021         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
6022         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
6023         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
6024         LDKMessageSendEvent_SendOpenChannelV2_class =
6025                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
6026         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
6027         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
6028         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
6029         LDKMessageSendEvent_SendFundingCreated_class =
6030                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
6031         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
6032         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
6033         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
6034         LDKMessageSendEvent_SendFundingSigned_class =
6035                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
6036         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
6037         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
6038         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
6039         LDKMessageSendEvent_SendTxAddInput_class =
6040                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
6041         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
6042         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
6043         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
6044         LDKMessageSendEvent_SendTxAddOutput_class =
6045                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
6046         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
6047         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
6048         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
6049         LDKMessageSendEvent_SendTxRemoveInput_class =
6050                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
6051         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
6052         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
6053         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
6054         LDKMessageSendEvent_SendTxRemoveOutput_class =
6055                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
6056         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
6057         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
6058         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
6059         LDKMessageSendEvent_SendTxComplete_class =
6060                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
6061         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
6062         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
6063         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
6064         LDKMessageSendEvent_SendTxSignatures_class =
6065                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
6066         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
6067         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
6068         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
6069         LDKMessageSendEvent_SendTxInitRbf_class =
6070                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
6071         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
6072         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
6073         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
6074         LDKMessageSendEvent_SendTxAckRbf_class =
6075                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
6076         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
6077         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
6078         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
6079         LDKMessageSendEvent_SendTxAbort_class =
6080                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
6081         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
6082         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
6083         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
6084         LDKMessageSendEvent_SendChannelReady_class =
6085                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
6086         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
6087         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
6088         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
6089         LDKMessageSendEvent_SendAnnouncementSignatures_class =
6090                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
6091         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
6092         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
6093         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
6094         LDKMessageSendEvent_UpdateHTLCs_class =
6095                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
6096         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
6097         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
6098         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
6099         LDKMessageSendEvent_SendRevokeAndACK_class =
6100                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
6101         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
6102         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
6103         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
6104         LDKMessageSendEvent_SendClosingSigned_class =
6105                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
6106         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
6107         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
6108         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
6109         LDKMessageSendEvent_SendShutdown_class =
6110                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
6111         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
6112         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
6113         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
6114         LDKMessageSendEvent_SendChannelReestablish_class =
6115                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
6116         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
6117         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
6118         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
6119         LDKMessageSendEvent_SendChannelAnnouncement_class =
6120                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
6121         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
6122         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
6123         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
6124         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
6125                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
6126         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
6127         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
6128         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
6129         LDKMessageSendEvent_BroadcastChannelUpdate_class =
6130                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
6131         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
6132         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
6133         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
6134         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
6135                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
6136         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
6137         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
6138         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
6139         LDKMessageSendEvent_SendChannelUpdate_class =
6140                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
6141         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
6142         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
6143         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
6144         LDKMessageSendEvent_HandleError_class =
6145                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
6146         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
6147         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
6148         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
6149         LDKMessageSendEvent_SendChannelRangeQuery_class =
6150                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
6151         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
6152         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
6153         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
6154         LDKMessageSendEvent_SendShortIdsQuery_class =
6155                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
6156         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
6157         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
6158         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
6159         LDKMessageSendEvent_SendReplyChannelRange_class =
6160                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
6161         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
6162         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
6163         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
6164         LDKMessageSendEvent_SendGossipTimestampFilter_class =
6165                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
6166         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
6167         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
6168         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
6169 }
6170 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6171         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
6172         switch(obj->tag) {
6173                 case LDKMessageSendEvent_SendAcceptChannel: {
6174                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6175                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
6176                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
6177                         int64_t msg_ref = 0;
6178                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6179                         msg_ref = tag_ptr(msg_var.inner, false);
6180                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
6181                 }
6182                 case LDKMessageSendEvent_SendAcceptChannelV2: {
6183                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6184                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
6185                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
6186                         int64_t msg_ref = 0;
6187                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6188                         msg_ref = tag_ptr(msg_var.inner, false);
6189                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
6190                 }
6191                 case LDKMessageSendEvent_SendOpenChannel: {
6192                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6193                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
6194                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
6195                         int64_t msg_ref = 0;
6196                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6197                         msg_ref = tag_ptr(msg_var.inner, false);
6198                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
6199                 }
6200                 case LDKMessageSendEvent_SendOpenChannelV2: {
6201                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6202                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
6203                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
6204                         int64_t msg_ref = 0;
6205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6206                         msg_ref = tag_ptr(msg_var.inner, false);
6207                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
6208                 }
6209                 case LDKMessageSendEvent_SendFundingCreated: {
6210                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6211                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
6212                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
6213                         int64_t msg_ref = 0;
6214                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6215                         msg_ref = tag_ptr(msg_var.inner, false);
6216                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
6217                 }
6218                 case LDKMessageSendEvent_SendFundingSigned: {
6219                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6220                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
6221                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
6222                         int64_t msg_ref = 0;
6223                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6224                         msg_ref = tag_ptr(msg_var.inner, false);
6225                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
6226                 }
6227                 case LDKMessageSendEvent_SendTxAddInput: {
6228                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6229                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
6230                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
6231                         int64_t msg_ref = 0;
6232                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6233                         msg_ref = tag_ptr(msg_var.inner, false);
6234                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
6235                 }
6236                 case LDKMessageSendEvent_SendTxAddOutput: {
6237                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6238                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
6239                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
6240                         int64_t msg_ref = 0;
6241                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6242                         msg_ref = tag_ptr(msg_var.inner, false);
6243                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
6244                 }
6245                 case LDKMessageSendEvent_SendTxRemoveInput: {
6246                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6247                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
6248                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
6249                         int64_t msg_ref = 0;
6250                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6251                         msg_ref = tag_ptr(msg_var.inner, false);
6252                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
6253                 }
6254                 case LDKMessageSendEvent_SendTxRemoveOutput: {
6255                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6256                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
6257                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
6258                         int64_t msg_ref = 0;
6259                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6260                         msg_ref = tag_ptr(msg_var.inner, false);
6261                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
6262                 }
6263                 case LDKMessageSendEvent_SendTxComplete: {
6264                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6265                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
6266                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
6267                         int64_t msg_ref = 0;
6268                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6269                         msg_ref = tag_ptr(msg_var.inner, false);
6270                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
6271                 }
6272                 case LDKMessageSendEvent_SendTxSignatures: {
6273                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6274                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
6275                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
6276                         int64_t msg_ref = 0;
6277                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6278                         msg_ref = tag_ptr(msg_var.inner, false);
6279                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
6280                 }
6281                 case LDKMessageSendEvent_SendTxInitRbf: {
6282                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6283                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
6284                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
6285                         int64_t msg_ref = 0;
6286                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6287                         msg_ref = tag_ptr(msg_var.inner, false);
6288                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
6289                 }
6290                 case LDKMessageSendEvent_SendTxAckRbf: {
6291                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6292                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
6293                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
6294                         int64_t msg_ref = 0;
6295                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6296                         msg_ref = tag_ptr(msg_var.inner, false);
6297                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
6298                 }
6299                 case LDKMessageSendEvent_SendTxAbort: {
6300                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6301                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
6302                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
6303                         int64_t msg_ref = 0;
6304                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6305                         msg_ref = tag_ptr(msg_var.inner, false);
6306                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
6307                 }
6308                 case LDKMessageSendEvent_SendChannelReady: {
6309                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6310                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
6311                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
6312                         int64_t msg_ref = 0;
6313                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6314                         msg_ref = tag_ptr(msg_var.inner, false);
6315                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
6316                 }
6317                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
6318                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6319                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
6320                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
6321                         int64_t msg_ref = 0;
6322                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6323                         msg_ref = tag_ptr(msg_var.inner, false);
6324                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
6325                 }
6326                 case LDKMessageSendEvent_UpdateHTLCs: {
6327                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6328                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
6329                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
6330                         int64_t updates_ref = 0;
6331                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
6332                         updates_ref = tag_ptr(updates_var.inner, false);
6333                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
6334                 }
6335                 case LDKMessageSendEvent_SendRevokeAndACK: {
6336                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6337                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
6338                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
6339                         int64_t msg_ref = 0;
6340                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6341                         msg_ref = tag_ptr(msg_var.inner, false);
6342                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
6343                 }
6344                 case LDKMessageSendEvent_SendClosingSigned: {
6345                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6346                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
6347                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
6348                         int64_t msg_ref = 0;
6349                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6350                         msg_ref = tag_ptr(msg_var.inner, false);
6351                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
6352                 }
6353                 case LDKMessageSendEvent_SendShutdown: {
6354                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6355                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
6356                         LDKShutdown msg_var = obj->send_shutdown.msg;
6357                         int64_t msg_ref = 0;
6358                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6359                         msg_ref = tag_ptr(msg_var.inner, false);
6360                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
6361                 }
6362                 case LDKMessageSendEvent_SendChannelReestablish: {
6363                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6364                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
6365                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
6366                         int64_t msg_ref = 0;
6367                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6368                         msg_ref = tag_ptr(msg_var.inner, false);
6369                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
6370                 }
6371                 case LDKMessageSendEvent_SendChannelAnnouncement: {
6372                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6373                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
6374                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
6375                         int64_t msg_ref = 0;
6376                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6377                         msg_ref = tag_ptr(msg_var.inner, false);
6378                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
6379                         int64_t update_msg_ref = 0;
6380                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6381                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6382                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
6383                 }
6384                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
6385                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
6386                         int64_t msg_ref = 0;
6387                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6388                         msg_ref = tag_ptr(msg_var.inner, false);
6389                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
6390                         int64_t update_msg_ref = 0;
6391                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6392                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6393                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
6394                 }
6395                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
6396                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
6397                         int64_t msg_ref = 0;
6398                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6399                         msg_ref = tag_ptr(msg_var.inner, false);
6400                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
6401                 }
6402                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
6403                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
6404                         int64_t msg_ref = 0;
6405                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6406                         msg_ref = tag_ptr(msg_var.inner, false);
6407                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
6408                 }
6409                 case LDKMessageSendEvent_SendChannelUpdate: {
6410                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6411                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
6412                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
6413                         int64_t msg_ref = 0;
6414                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6415                         msg_ref = tag_ptr(msg_var.inner, false);
6416                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
6417                 }
6418                 case LDKMessageSendEvent_HandleError: {
6419                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6420                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
6421                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
6422                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
6423                 }
6424                 case LDKMessageSendEvent_SendChannelRangeQuery: {
6425                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6426                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
6427                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
6428                         int64_t msg_ref = 0;
6429                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6430                         msg_ref = tag_ptr(msg_var.inner, false);
6431                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
6432                 }
6433                 case LDKMessageSendEvent_SendShortIdsQuery: {
6434                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6435                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
6436                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
6437                         int64_t msg_ref = 0;
6438                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6439                         msg_ref = tag_ptr(msg_var.inner, false);
6440                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
6441                 }
6442                 case LDKMessageSendEvent_SendReplyChannelRange: {
6443                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6444                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
6445                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
6446                         int64_t msg_ref = 0;
6447                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6448                         msg_ref = tag_ptr(msg_var.inner, false);
6449                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
6450                 }
6451                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
6452                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6453                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
6454                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
6455                         int64_t msg_ref = 0;
6456                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6457                         msg_ref = tag_ptr(msg_var.inner, false);
6458                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
6459                 }
6460                 default: abort();
6461         }
6462 }
6463 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
6464         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
6465         for (size_t i = 0; i < ret.datalen; i++) {
6466                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
6467         }
6468         return ret;
6469 }
6470 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6471         LDKChannelUpdateInfo ret = *owner->contents.result;
6472         ret.is_owned = false;
6473         return ret;
6474 }
6475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6476         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6477         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6478         int64_t ret_ref = 0;
6479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6481         return ret_ref;
6482 }
6483
6484 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6485 CHECK(!owner->result_ok);
6486         return DecodeError_clone(&*owner->contents.err);
6487 }
6488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6489         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6490         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6491         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6492         int64_t ret_ref = tag_ptr(ret_copy, true);
6493         return ret_ref;
6494 }
6495
6496 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6497         LDKChannelInfo ret = *owner->contents.result;
6498         ret.is_owned = false;
6499         return ret;
6500 }
6501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6502         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6503         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6504         int64_t ret_ref = 0;
6505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6507         return ret_ref;
6508 }
6509
6510 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6511 CHECK(!owner->result_ok);
6512         return DecodeError_clone(&*owner->contents.err);
6513 }
6514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6515         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6516         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6517         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6518         int64_t ret_ref = tag_ptr(ret_copy, true);
6519         return ret_ref;
6520 }
6521
6522 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6523         LDKRoutingFees ret = *owner->contents.result;
6524         ret.is_owned = false;
6525         return ret;
6526 }
6527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6528         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6529         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6530         int64_t ret_ref = 0;
6531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6533         return ret_ref;
6534 }
6535
6536 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6537 CHECK(!owner->result_ok);
6538         return DecodeError_clone(&*owner->contents.err);
6539 }
6540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6541         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6542         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6543         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6544         int64_t ret_ref = tag_ptr(ret_copy, true);
6545         return ret_ref;
6546 }
6547
6548 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
6549 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
6550 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
6551 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
6552 static jclass LDKSocketAddress_OnionV2_class = NULL;
6553 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
6554 static jclass LDKSocketAddress_OnionV3_class = NULL;
6555 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
6556 static jclass LDKSocketAddress_Hostname_class = NULL;
6557 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
6558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
6559         LDKSocketAddress_TcpIpV4_class =
6560                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
6561         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
6562         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
6563         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
6564         LDKSocketAddress_TcpIpV6_class =
6565                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
6566         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
6567         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
6568         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
6569         LDKSocketAddress_OnionV2_class =
6570                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
6571         CHECK(LDKSocketAddress_OnionV2_class != NULL);
6572         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
6573         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
6574         LDKSocketAddress_OnionV3_class =
6575                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
6576         CHECK(LDKSocketAddress_OnionV3_class != NULL);
6577         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
6578         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
6579         LDKSocketAddress_Hostname_class =
6580                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
6581         CHECK(LDKSocketAddress_Hostname_class != NULL);
6582         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
6583         CHECK(LDKSocketAddress_Hostname_meth != NULL);
6584 }
6585 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6586         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
6587         switch(obj->tag) {
6588                 case LDKSocketAddress_TcpIpV4: {
6589                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
6590                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
6591                         int16_t port_conv = obj->tcp_ip_v4.port;
6592                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
6593                 }
6594                 case LDKSocketAddress_TcpIpV6: {
6595                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
6596                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
6597                         int16_t port_conv = obj->tcp_ip_v6.port;
6598                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
6599                 }
6600                 case LDKSocketAddress_OnionV2: {
6601                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
6602                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
6603                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
6604                 }
6605                 case LDKSocketAddress_OnionV3: {
6606                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
6607                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
6608                         int16_t checksum_conv = obj->onion_v3.checksum;
6609                         int8_t version_conv = obj->onion_v3.version;
6610                         int16_t port_conv = obj->onion_v3.port;
6611                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
6612                 }
6613                 case LDKSocketAddress_Hostname: {
6614                         LDKHostname hostname_var = obj->hostname.hostname;
6615                         int64_t hostname_ref = 0;
6616                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
6617                         hostname_ref = tag_ptr(hostname_var.inner, false);
6618                         int16_t port_conv = obj->hostname.port;
6619                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
6620                 }
6621                 default: abort();
6622         }
6623 }
6624 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
6625         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
6626         for (size_t i = 0; i < ret.datalen; i++) {
6627                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
6628         }
6629         return ret;
6630 }
6631 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6632         LDKNodeAnnouncementInfo ret = *owner->contents.result;
6633         ret.is_owned = false;
6634         return ret;
6635 }
6636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6637         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6638         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6639         int64_t ret_ref = 0;
6640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6642         return ret_ref;
6643 }
6644
6645 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6646 CHECK(!owner->result_ok);
6647         return DecodeError_clone(&*owner->contents.err);
6648 }
6649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6650         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6651         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6652         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6653         int64_t ret_ref = tag_ptr(ret_copy, true);
6654         return ret_ref;
6655 }
6656
6657 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6658         LDKNodeAlias ret = *owner->contents.result;
6659         ret.is_owned = false;
6660         return ret;
6661 }
6662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6663         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6664         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
6665         int64_t ret_ref = 0;
6666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6668         return ret_ref;
6669 }
6670
6671 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6672 CHECK(!owner->result_ok);
6673         return DecodeError_clone(&*owner->contents.err);
6674 }
6675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6676         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6677         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6678         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
6679         int64_t ret_ref = tag_ptr(ret_copy, true);
6680         return ret_ref;
6681 }
6682
6683 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6684         LDKNodeInfo ret = *owner->contents.result;
6685         ret.is_owned = false;
6686         return ret;
6687 }
6688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6689         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6690         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6691         int64_t ret_ref = 0;
6692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6694         return ret_ref;
6695 }
6696
6697 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6698 CHECK(!owner->result_ok);
6699         return DecodeError_clone(&*owner->contents.err);
6700 }
6701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6702         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6703         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6704         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6705         int64_t ret_ref = tag_ptr(ret_copy, true);
6706         return ret_ref;
6707 }
6708
6709 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6710         LDKNetworkGraph ret = *owner->contents.result;
6711         ret.is_owned = false;
6712         return ret;
6713 }
6714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6715         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6716         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6717         int64_t ret_ref = 0;
6718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6720         return ret_ref;
6721 }
6722
6723 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6724 CHECK(!owner->result_ok);
6725         return DecodeError_clone(&*owner->contents.err);
6726 }
6727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6728         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6729         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6730         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6731         int64_t ret_ref = tag_ptr(ret_copy, true);
6732         return ret_ref;
6733 }
6734
6735 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
6736 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
6737 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
6738 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
6739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
6740         LDKCOption_CVec_SocketAddressZZ_Some_class =
6741                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
6742         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
6743         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
6744         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
6745         LDKCOption_CVec_SocketAddressZZ_None_class =
6746                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
6747         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
6748         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
6749         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
6750 }
6751 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6752         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
6753         switch(obj->tag) {
6754                 case LDKCOption_CVec_SocketAddressZZ_Some: {
6755                         LDKCVec_SocketAddressZ some_var = obj->some;
6756                         int64_tArray some_arr = NULL;
6757                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
6758                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6759                         for (size_t p = 0; p < some_var.datalen; p++) {
6760                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
6761                                 some_arr_ptr[p] = some_conv_15_ref;
6762                         }
6763                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6764                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
6765                 }
6766                 case LDKCOption_CVec_SocketAddressZZ_None: {
6767                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
6768                 }
6769                 default: abort();
6770         }
6771 }
6772 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
6773         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
6774         for (size_t i = 0; i < ret.datalen; i++) {
6775                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
6776         }
6777         return ret;
6778 }
6779 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
6780         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
6781         for (size_t i = 0; i < ret.datalen; i++) {
6782                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
6783         }
6784         return ret;
6785 }
6786 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
6787         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
6788         for (size_t i = 0; i < ret.datalen; i++) {
6789                 ret.data[i] = Utxo_clone(&orig->data[i]);
6790         }
6791         return ret;
6792 }
6793 static jclass LDKCOption_TxOutZ_Some_class = NULL;
6794 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
6795 static jclass LDKCOption_TxOutZ_None_class = NULL;
6796 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
6797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
6798         LDKCOption_TxOutZ_Some_class =
6799                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
6800         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
6801         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
6802         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
6803         LDKCOption_TxOutZ_None_class =
6804                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
6805         CHECK(LDKCOption_TxOutZ_None_class != NULL);
6806         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
6807         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
6808 }
6809 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6810         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
6811         switch(obj->tag) {
6812                 case LDKCOption_TxOutZ_Some: {
6813                         LDKTxOut* some_ref = &obj->some;
6814                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
6815                 }
6816                 case LDKCOption_TxOutZ_None: {
6817                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
6818                 }
6819                 default: abort();
6820         }
6821 }
6822 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
6823         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
6824         for (size_t i = 0; i < ret.datalen; i++) {
6825                 ret.data[i] = Input_clone(&orig->data[i]);
6826         }
6827         return ret;
6828 }
6829 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6830         LDKCoinSelection ret = *owner->contents.result;
6831         ret.is_owned = false;
6832         return ret;
6833 }
6834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6835         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6836         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
6837         int64_t ret_ref = 0;
6838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6840         return ret_ref;
6841 }
6842
6843 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6844 CHECK(!owner->result_ok);
6845         return *owner->contents.err;
6846 }
6847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6848         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6849         CResult_CoinSelectionNoneZ_get_err(owner_conv);
6850 }
6851
6852 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6853 CHECK(owner->result_ok);
6854         return CVec_UtxoZ_clone(&*owner->contents.result);
6855 }
6856 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6857         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6858         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
6859         int64_tArray ret_arr = NULL;
6860         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6861         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6862         for (size_t g = 0; g < ret_var.datalen; g++) {
6863                 LDKUtxo ret_conv_6_var = ret_var.data[g];
6864                 int64_t ret_conv_6_ref = 0;
6865                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
6866                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
6867                 ret_arr_ptr[g] = ret_conv_6_ref;
6868         }
6869         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6870         FREE(ret_var.data);
6871         return ret_arr;
6872 }
6873
6874 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6875 CHECK(!owner->result_ok);
6876         return *owner->contents.err;
6877 }
6878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6879         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6880         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
6881 }
6882
6883 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
6884         return owner->a;
6885 }
6886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6887         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
6888         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
6889         return ret_conv;
6890 }
6891
6892 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
6893         return owner->b;
6894 }
6895 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6896         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
6897         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
6898         return ret_conv;
6899 }
6900
6901 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
6902 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
6903 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
6904 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
6905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
6906         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
6907                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
6908         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
6909         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
6910         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
6911         LDKCOption_C2Tuple_u64u16ZZ_None_class =
6912                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
6913         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
6914         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
6915         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
6916 }
6917 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6918         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
6919         switch(obj->tag) {
6920                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
6921                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
6922                         *some_conv = obj->some;
6923                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
6924                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
6925                 }
6926                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
6927                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
6928                 }
6929                 default: abort();
6930         }
6931 }
6932 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
6933 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
6934 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
6935 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
6936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
6937         LDKCOption_ChannelShutdownStateZ_Some_class =
6938                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
6939         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
6940         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
6941         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
6942         LDKCOption_ChannelShutdownStateZ_None_class =
6943                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
6944         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
6945         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
6946         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
6947 }
6948 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6949         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
6950         switch(obj->tag) {
6951                 case LDKCOption_ChannelShutdownStateZ_Some: {
6952                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
6953                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
6954                 }
6955                 case LDKCOption_ChannelShutdownStateZ_None: {
6956                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
6957                 }
6958                 default: abort();
6959         }
6960 }
6961 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6962 CHECK(owner->result_ok);
6963         return ThirtyTwoBytes_clone(&*owner->contents.result);
6964 }
6965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6966         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6967         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6968         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
6969         return ret_arr;
6970 }
6971
6972 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6973 CHECK(!owner->result_ok);
6974         return APIError_clone(&*owner->contents.err);
6975 }
6976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6977         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6978         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6979         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
6980         int64_t ret_ref = tag_ptr(ret_copy, true);
6981         return ret_ref;
6982 }
6983
6984 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
6985 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
6986 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
6987 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
6988 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
6989 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
6990 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
6991 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
6992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
6993         LDKRecentPaymentDetails_AwaitingInvoice_class =
6994                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
6995         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
6996         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
6997         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
6998         LDKRecentPaymentDetails_Pending_class =
6999                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
7000         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
7001         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
7002         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
7003         LDKRecentPaymentDetails_Fulfilled_class =
7004                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
7005         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
7006         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
7007         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
7008         LDKRecentPaymentDetails_Abandoned_class =
7009                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
7010         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
7011         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
7012         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
7013 }
7014 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7015         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
7016         switch(obj->tag) {
7017                 case LDKRecentPaymentDetails_AwaitingInvoice: {
7018                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7019                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
7020                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
7021                 }
7022                 case LDKRecentPaymentDetails_Pending: {
7023                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7024                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
7025                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7026                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
7027                         int64_t total_msat_conv = obj->pending.total_msat;
7028                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
7029                 }
7030                 case LDKRecentPaymentDetails_Fulfilled: {
7031                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7032                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
7033                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
7034                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
7035                 }
7036                 case LDKRecentPaymentDetails_Abandoned: {
7037                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7038                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
7039                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7040                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
7041                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
7042                 }
7043                 default: abort();
7044         }
7045 }
7046 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
7047         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
7048         for (size_t i = 0; i < ret.datalen; i++) {
7049                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
7050         }
7051         return ret;
7052 }
7053 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
7054 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
7055 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
7056 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
7057 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
7058 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
7059 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
7060 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
7061 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
7062 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
7063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
7064         LDKPaymentSendFailure_ParameterError_class =
7065                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
7066         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
7067         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
7068         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
7069         LDKPaymentSendFailure_PathParameterError_class =
7070                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
7071         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
7072         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
7073         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
7074         LDKPaymentSendFailure_AllFailedResendSafe_class =
7075                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
7076         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
7077         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
7078         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
7079         LDKPaymentSendFailure_DuplicatePayment_class =
7080                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
7081         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
7082         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
7083         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
7084         LDKPaymentSendFailure_PartialFailure_class =
7085                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
7086         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
7087         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
7088         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
7089 }
7090 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7091         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
7092         switch(obj->tag) {
7093                 case LDKPaymentSendFailure_ParameterError: {
7094                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
7095                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
7096                 }
7097                 case LDKPaymentSendFailure_PathParameterError: {
7098                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
7099                         int64_tArray path_parameter_error_arr = NULL;
7100                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
7101                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
7102                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
7103                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7104                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
7105                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
7106                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
7107                         }
7108                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
7109                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
7110                 }
7111                 case LDKPaymentSendFailure_AllFailedResendSafe: {
7112                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
7113                         int64_tArray all_failed_resend_safe_arr = NULL;
7114                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
7115                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
7116                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
7117                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
7118                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
7119                         }
7120                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
7121                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
7122                 }
7123                 case LDKPaymentSendFailure_DuplicatePayment: {
7124                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
7125                 }
7126                 case LDKPaymentSendFailure_PartialFailure: {
7127                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
7128                         int64_tArray results_arr = NULL;
7129                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
7130                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
7131                         for (size_t w = 0; w < results_var.datalen; w++) {
7132                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7133                                 *results_conv_22_conv = results_var.data[w];
7134                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
7135                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
7136                         }
7137                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
7138                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
7139                         int64_t failed_paths_retry_ref = 0;
7140                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
7141                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
7142                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7143                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
7144                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
7145                 }
7146                 default: abort();
7147         }
7148 }
7149 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7150 CHECK(owner->result_ok);
7151         return *owner->contents.result;
7152 }
7153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7154         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7155         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
7156 }
7157
7158 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7159 CHECK(!owner->result_ok);
7160         return PaymentSendFailure_clone(&*owner->contents.err);
7161 }
7162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7163         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7164         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7165         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
7166         int64_t ret_ref = tag_ptr(ret_copy, true);
7167         return ret_ref;
7168 }
7169
7170 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7171 CHECK(owner->result_ok);
7172         return *owner->contents.result;
7173 }
7174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7175         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7176         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
7177 }
7178
7179 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7180 CHECK(!owner->result_ok);
7181         return RetryableSendFailure_clone(&*owner->contents.err);
7182 }
7183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7184         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7185         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
7186         return ret_conv;
7187 }
7188
7189 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7190 CHECK(owner->result_ok);
7191         return ThirtyTwoBytes_clone(&*owner->contents.result);
7192 }
7193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7194         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7195         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7196         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
7197         return ret_arr;
7198 }
7199
7200 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7201 CHECK(!owner->result_ok);
7202         return PaymentSendFailure_clone(&*owner->contents.err);
7203 }
7204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7205         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7206         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7207         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
7208         int64_t ret_ref = tag_ptr(ret_copy, true);
7209         return ret_ref;
7210 }
7211
7212 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7213 CHECK(owner->result_ok);
7214         return ThirtyTwoBytes_clone(&*owner->contents.result);
7215 }
7216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7217         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7218         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7219         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
7220         return ret_arr;
7221 }
7222
7223 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7224 CHECK(!owner->result_ok);
7225         return RetryableSendFailure_clone(&*owner->contents.err);
7226 }
7227 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7228         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7229         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
7230         return ret_conv;
7231 }
7232
7233 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7234         return ThirtyTwoBytes_clone(&owner->a);
7235 }
7236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7237         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7238         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7239         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
7240         return ret_arr;
7241 }
7242
7243 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7244         return ThirtyTwoBytes_clone(&owner->b);
7245 }
7246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7247         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7248         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7249         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
7250         return ret_arr;
7251 }
7252
7253 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7254 CHECK(owner->result_ok);
7255         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7256 }
7257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7258         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7259         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7260         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
7261         return tag_ptr(ret_conv, true);
7262 }
7263
7264 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7265 CHECK(!owner->result_ok);
7266         return PaymentSendFailure_clone(&*owner->contents.err);
7267 }
7268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7269         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7270         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7271         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
7272         int64_t ret_ref = tag_ptr(ret_copy, true);
7273         return ret_ref;
7274 }
7275
7276 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
7277         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
7278         for (size_t i = 0; i < ret.datalen; i++) {
7279                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
7280         }
7281         return ret;
7282 }
7283 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
7284 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
7285 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
7286 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
7287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
7288         LDKProbeSendFailure_RouteNotFound_class =
7289                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
7290         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
7291         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
7292         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
7293         LDKProbeSendFailure_SendingFailed_class =
7294                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
7295         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
7296         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
7297         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
7298 }
7299 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7300         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
7301         switch(obj->tag) {
7302                 case LDKProbeSendFailure_RouteNotFound: {
7303                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
7304                 }
7305                 case LDKProbeSendFailure_SendingFailed: {
7306                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
7307                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
7308                 }
7309                 default: abort();
7310         }
7311 }
7312 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7313 CHECK(owner->result_ok);
7314         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
7315 }
7316 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7317         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7318         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
7319         int64_tArray ret_arr = NULL;
7320         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7321         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7322         for (size_t o = 0; o < ret_var.datalen; o++) {
7323                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7324                 *ret_conv_40_conv = ret_var.data[o];
7325                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7326         }
7327         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7328         FREE(ret_var.data);
7329         return ret_arr;
7330 }
7331
7332 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7333 CHECK(!owner->result_ok);
7334         return ProbeSendFailure_clone(&*owner->contents.err);
7335 }
7336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7337         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7338         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
7339         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
7340         int64_t ret_ref = tag_ptr(ret_copy, true);
7341         return ret_ref;
7342 }
7343
7344 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7345         return ThirtyTwoBytes_clone(&owner->a);
7346 }
7347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7348         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7349         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7350         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data);
7351         return ret_arr;
7352 }
7353
7354 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7355         return owner->b;
7356 }
7357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7358         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7359         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7360         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form);
7361         return ret_arr;
7362 }
7363
7364 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
7365         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
7366         for (size_t i = 0; i < ret.datalen; i++) {
7367                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
7368         }
7369         return ret;
7370 }
7371 static jclass LDKCOption_StrZ_Some_class = NULL;
7372 static jmethodID LDKCOption_StrZ_Some_meth = NULL;
7373 static jclass LDKCOption_StrZ_None_class = NULL;
7374 static jmethodID LDKCOption_StrZ_None_meth = NULL;
7375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init (JNIEnv *env, jclass clz) {
7376         LDKCOption_StrZ_Some_class =
7377                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$Some"));
7378         CHECK(LDKCOption_StrZ_Some_class != NULL);
7379         LDKCOption_StrZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_Some_class, "<init>", "(Ljava/lang/String;)V");
7380         CHECK(LDKCOption_StrZ_Some_meth != NULL);
7381         LDKCOption_StrZ_None_class =
7382                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$None"));
7383         CHECK(LDKCOption_StrZ_None_class != NULL);
7384         LDKCOption_StrZ_None_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_None_class, "<init>", "()V");
7385         CHECK(LDKCOption_StrZ_None_meth != NULL);
7386 }
7387 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7388         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
7389         switch(obj->tag) {
7390                 case LDKCOption_StrZ_Some: {
7391                         LDKStr some_str = obj->some;
7392                         jstring some_conv = str_ref_to_java(env, some_str.chars, some_str.len);
7393                         return (*env)->NewObject(env, LDKCOption_StrZ_Some_class, LDKCOption_StrZ_Some_meth, some_conv);
7394                 }
7395                 case LDKCOption_StrZ_None: {
7396                         return (*env)->NewObject(env, LDKCOption_StrZ_None_class, LDKCOption_StrZ_None_meth);
7397                 }
7398                 default: abort();
7399         }
7400 }
7401 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
7402 CHECK(owner->result_ok);
7403         return *owner->contents.result;
7404 }
7405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7406         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
7407         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
7408 }
7409
7410 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
7411 CHECK(!owner->result_ok);
7412         return Bolt12SemanticError_clone(&*owner->contents.err);
7413 }
7414 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7415         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
7416         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
7417         return ret_conv;
7418 }
7419
7420 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7421 CHECK(owner->result_ok);
7422         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7423 }
7424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7425         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7426         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7427         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
7428         return tag_ptr(ret_conv, true);
7429 }
7430
7431 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7432 CHECK(!owner->result_ok);
7433         return *owner->contents.err;
7434 }
7435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7436         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7437         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
7438 }
7439
7440 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
7441 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
7442 static jclass LDKOffersMessage_Invoice_class = NULL;
7443 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
7444 static jclass LDKOffersMessage_InvoiceError_class = NULL;
7445 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
7446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
7447         LDKOffersMessage_InvoiceRequest_class =
7448                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
7449         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
7450         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
7451         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
7452         LDKOffersMessage_Invoice_class =
7453                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
7454         CHECK(LDKOffersMessage_Invoice_class != NULL);
7455         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
7456         CHECK(LDKOffersMessage_Invoice_meth != NULL);
7457         LDKOffersMessage_InvoiceError_class =
7458                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
7459         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
7460         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
7461         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
7462 }
7463 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7464         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
7465         switch(obj->tag) {
7466                 case LDKOffersMessage_InvoiceRequest: {
7467                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
7468                         int64_t invoice_request_ref = 0;
7469                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
7470                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
7471                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
7472                 }
7473                 case LDKOffersMessage_Invoice: {
7474                         LDKBolt12Invoice invoice_var = obj->invoice;
7475                         int64_t invoice_ref = 0;
7476                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
7477                         invoice_ref = tag_ptr(invoice_var.inner, false);
7478                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
7479                 }
7480                 case LDKOffersMessage_InvoiceError: {
7481                         LDKInvoiceError invoice_error_var = obj->invoice_error;
7482                         int64_t invoice_error_ref = 0;
7483                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
7484                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
7485                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
7486                 }
7487                 default: abort();
7488         }
7489 }
7490 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
7491 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
7492 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
7493 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
7494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
7495         LDKCOption_OffersMessageZ_Some_class =
7496                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
7497         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
7498         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
7499         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
7500         LDKCOption_OffersMessageZ_None_class =
7501                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
7502         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
7503         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
7504         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
7505 }
7506 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7507         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
7508         switch(obj->tag) {
7509                 case LDKCOption_OffersMessageZ_Some: {
7510                         int64_t some_ref = tag_ptr(&obj->some, false);
7511                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
7512                 }
7513                 case LDKCOption_OffersMessageZ_None: {
7514                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
7515                 }
7516                 default: abort();
7517         }
7518 }
7519 static jclass LDKDestination_Node_class = NULL;
7520 static jmethodID LDKDestination_Node_meth = NULL;
7521 static jclass LDKDestination_BlindedPath_class = NULL;
7522 static jmethodID LDKDestination_BlindedPath_meth = NULL;
7523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
7524         LDKDestination_Node_class =
7525                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
7526         CHECK(LDKDestination_Node_class != NULL);
7527         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
7528         CHECK(LDKDestination_Node_meth != NULL);
7529         LDKDestination_BlindedPath_class =
7530                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
7531         CHECK(LDKDestination_BlindedPath_class != NULL);
7532         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
7533         CHECK(LDKDestination_BlindedPath_meth != NULL);
7534 }
7535 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7536         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
7537         switch(obj->tag) {
7538                 case LDKDestination_Node: {
7539                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
7540                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
7541                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
7542                 }
7543                 case LDKDestination_BlindedPath: {
7544                         LDKBlindedPath blinded_path_var = obj->blinded_path;
7545                         int64_t blinded_path_ref = 0;
7546                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
7547                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
7548                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
7549                 }
7550                 default: abort();
7551         }
7552 }
7553 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7554         return OffersMessage_clone(&owner->a);
7555 }
7556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7557         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7558         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
7559         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
7560         int64_t ret_ref = tag_ptr(ret_copy, true);
7561         return ret_ref;
7562 }
7563
7564 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7565         return Destination_clone(&owner->b);
7566 }
7567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7568         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7569         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7570         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
7571         int64_t ret_ref = tag_ptr(ret_copy, true);
7572         return ret_ref;
7573 }
7574
7575 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7576         LDKBlindedPath ret = owner->c;
7577         ret.is_owned = false;
7578         return ret;
7579 }
7580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7581         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7582         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
7583         int64_t ret_ref = 0;
7584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7586         return ret_ref;
7587 }
7588
7589 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
7590         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
7591         for (size_t i = 0; i < ret.datalen; i++) {
7592                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
7593         }
7594         return ret;
7595 }
7596 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7597         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7598         ret.is_owned = false;
7599         return ret;
7600 }
7601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7602         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7603         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7604         int64_t ret_ref = 0;
7605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7607         return ret_ref;
7608 }
7609
7610 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7611 CHECK(!owner->result_ok);
7612         return DecodeError_clone(&*owner->contents.err);
7613 }
7614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7615         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7616         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7617         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7618         int64_t ret_ref = tag_ptr(ret_copy, true);
7619         return ret_ref;
7620 }
7621
7622 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7623         LDKChannelCounterparty ret = *owner->contents.result;
7624         ret.is_owned = false;
7625         return ret;
7626 }
7627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7628         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7629         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7630         int64_t ret_ref = 0;
7631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7633         return ret_ref;
7634 }
7635
7636 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7637 CHECK(!owner->result_ok);
7638         return DecodeError_clone(&*owner->contents.err);
7639 }
7640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7641         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7642         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7643         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7644         int64_t ret_ref = tag_ptr(ret_copy, true);
7645         return ret_ref;
7646 }
7647
7648 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7649         LDKChannelDetails ret = *owner->contents.result;
7650         ret.is_owned = false;
7651         return ret;
7652 }
7653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7654         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7655         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7656         int64_t ret_ref = 0;
7657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7659         return ret_ref;
7660 }
7661
7662 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7663 CHECK(!owner->result_ok);
7664         return DecodeError_clone(&*owner->contents.err);
7665 }
7666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7667         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7668         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7669         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7670         int64_t ret_ref = tag_ptr(ret_copy, true);
7671         return ret_ref;
7672 }
7673
7674 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7675         LDKPhantomRouteHints ret = *owner->contents.result;
7676         ret.is_owned = false;
7677         return ret;
7678 }
7679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7680         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7681         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7682         int64_t ret_ref = 0;
7683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7685         return ret_ref;
7686 }
7687
7688 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7689 CHECK(!owner->result_ok);
7690         return DecodeError_clone(&*owner->contents.err);
7691 }
7692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7693         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7694         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7695         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7696         int64_t ret_ref = tag_ptr(ret_copy, true);
7697         return ret_ref;
7698 }
7699
7700 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7701 CHECK(owner->result_ok);
7702         return ChannelShutdownState_clone(&*owner->contents.result);
7703 }
7704 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7705         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7706         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
7707         return ret_conv;
7708 }
7709
7710 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7711 CHECK(!owner->result_ok);
7712         return DecodeError_clone(&*owner->contents.err);
7713 }
7714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7715         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7717         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
7718         int64_t ret_ref = tag_ptr(ret_copy, true);
7719         return ret_ref;
7720 }
7721
7722 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
7723         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
7724         for (size_t i = 0; i < ret.datalen; i++) {
7725                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
7726         }
7727         return ret;
7728 }
7729 typedef struct LDKWatch_JCalls {
7730         atomic_size_t refcnt;
7731         JavaVM *vm;
7732         jweak o;
7733         jmethodID watch_channel_meth;
7734         jmethodID update_channel_meth;
7735         jmethodID release_pending_monitor_events_meth;
7736 } LDKWatch_JCalls;
7737 static void LDKWatch_JCalls_free(void* this_arg) {
7738         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7739         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7740                 JNIEnv *env;
7741                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7742                 if (get_jenv_res == JNI_EDETACHED) {
7743                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7744                 } else {
7745                         DO_ASSERT(get_jenv_res == JNI_OK);
7746                 }
7747                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7748                 if (get_jenv_res == JNI_EDETACHED) {
7749                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7750                 }
7751                 FREE(j_calls);
7752         }
7753 }
7754 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
7755         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7756         JNIEnv *env;
7757         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7758         if (get_jenv_res == JNI_EDETACHED) {
7759                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7760         } else {
7761                 DO_ASSERT(get_jenv_res == JNI_OK);
7762         }
7763         LDKOutPoint funding_txo_var = funding_txo;
7764         int64_t funding_txo_ref = 0;
7765         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7766         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7767         LDKChannelMonitor monitor_var = monitor;
7768         int64_t monitor_ref = 0;
7769         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
7770         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
7771         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7772         CHECK(obj != NULL);
7773         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
7774         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7775                 (*env)->ExceptionDescribe(env);
7776                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
7777         }
7778         void* ret_ptr = untag_ptr(ret);
7779         CHECK_ACCESS(ret_ptr);
7780         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
7781         FREE(untag_ptr(ret));
7782         if (get_jenv_res == JNI_EDETACHED) {
7783                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7784         }
7785         return ret_conv;
7786 }
7787 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
7788         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7789         JNIEnv *env;
7790         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7791         if (get_jenv_res == JNI_EDETACHED) {
7792                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7793         } else {
7794                 DO_ASSERT(get_jenv_res == JNI_OK);
7795         }
7796         LDKOutPoint funding_txo_var = funding_txo;
7797         int64_t funding_txo_ref = 0;
7798         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7799         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7800         LDKChannelMonitorUpdate update_var = *update;
7801         int64_t update_ref = 0;
7802         update_var = ChannelMonitorUpdate_clone(&update_var);
7803         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7804         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
7805         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7806         CHECK(obj != NULL);
7807         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
7808         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7809                 (*env)->ExceptionDescribe(env);
7810                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
7811         }
7812         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7813         if (get_jenv_res == JNI_EDETACHED) {
7814                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7815         }
7816         return ret_conv;
7817 }
7818 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
7819         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7820         JNIEnv *env;
7821         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7822         if (get_jenv_res == JNI_EDETACHED) {
7823                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7824         } else {
7825                 DO_ASSERT(get_jenv_res == JNI_OK);
7826         }
7827         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7828         CHECK(obj != NULL);
7829         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
7830         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7831                 (*env)->ExceptionDescribe(env);
7832                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
7833         }
7834         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
7835         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7836         if (ret_constr.datalen > 0)
7837                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
7838         else
7839                 ret_constr.data = NULL;
7840         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7841         for (size_t x = 0; x < ret_constr.datalen; x++) {
7842                 int64_t ret_conv_49 = ret_vals[x];
7843                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
7844                 CHECK_ACCESS(ret_conv_49_ptr);
7845                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
7846                 FREE(untag_ptr(ret_conv_49));
7847                 ret_constr.data[x] = ret_conv_49_conv;
7848         }
7849         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7850         if (get_jenv_res == JNI_EDETACHED) {
7851                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7852         }
7853         return ret_constr;
7854 }
7855 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
7856         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
7857         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7858 }
7859 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
7860         jclass c = (*env)->GetObjectClass(env, o);
7861         CHECK(c != NULL);
7862         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
7863         atomic_init(&calls->refcnt, 1);
7864         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7865         calls->o = (*env)->NewWeakGlobalRef(env, o);
7866         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
7867         CHECK(calls->watch_channel_meth != NULL);
7868         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7869         CHECK(calls->update_channel_meth != NULL);
7870         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
7871         CHECK(calls->release_pending_monitor_events_meth != NULL);
7872
7873         LDKWatch ret = {
7874                 .this_arg = (void*) calls,
7875                 .watch_channel = watch_channel_LDKWatch_jcall,
7876                 .update_channel = update_channel_LDKWatch_jcall,
7877                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
7878                 .free = LDKWatch_JCalls_free,
7879         };
7880         return ret;
7881 }
7882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
7883         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
7884         *res_ptr = LDKWatch_init(env, clz, o);
7885         return tag_ptr(res_ptr, true);
7886 }
7887 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) {
7888         void* this_arg_ptr = untag_ptr(this_arg);
7889         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7890         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7891         LDKOutPoint funding_txo_conv;
7892         funding_txo_conv.inner = untag_ptr(funding_txo);
7893         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7894         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7895         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7896         LDKChannelMonitor monitor_conv;
7897         monitor_conv.inner = untag_ptr(monitor);
7898         monitor_conv.is_owned = ptr_is_owned(monitor);
7899         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
7900         monitor_conv = ChannelMonitor_clone(&monitor_conv);
7901         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
7902         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
7903         return tag_ptr(ret_conv, true);
7904 }
7905
7906 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) {
7907         void* this_arg_ptr = untag_ptr(this_arg);
7908         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7909         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7910         LDKOutPoint funding_txo_conv;
7911         funding_txo_conv.inner = untag_ptr(funding_txo);
7912         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7913         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7914         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7915         LDKChannelMonitorUpdate update_conv;
7916         update_conv.inner = untag_ptr(update);
7917         update_conv.is_owned = ptr_is_owned(update);
7918         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7919         update_conv.is_owned = false;
7920         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
7921         return ret_conv;
7922 }
7923
7924 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7925         void* this_arg_ptr = untag_ptr(this_arg);
7926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7927         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7928         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
7929         int64_tArray ret_arr = NULL;
7930         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7931         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7932         for (size_t x = 0; x < ret_var.datalen; x++) {
7933                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
7934                 *ret_conv_49_conv = ret_var.data[x];
7935                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
7936         }
7937         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7938         FREE(ret_var.data);
7939         return ret_arr;
7940 }
7941
7942 typedef struct LDKBroadcasterInterface_JCalls {
7943         atomic_size_t refcnt;
7944         JavaVM *vm;
7945         jweak o;
7946         jmethodID broadcast_transactions_meth;
7947 } LDKBroadcasterInterface_JCalls;
7948 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7949         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7950         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7951                 JNIEnv *env;
7952                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7953                 if (get_jenv_res == JNI_EDETACHED) {
7954                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7955                 } else {
7956                         DO_ASSERT(get_jenv_res == JNI_OK);
7957                 }
7958                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7959                 if (get_jenv_res == JNI_EDETACHED) {
7960                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7961                 }
7962                 FREE(j_calls);
7963         }
7964 }
7965 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
7966         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7967         JNIEnv *env;
7968         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7969         if (get_jenv_res == JNI_EDETACHED) {
7970                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7971         } else {
7972                 DO_ASSERT(get_jenv_res == JNI_OK);
7973         }
7974         LDKCVec_TransactionZ txs_var = txs;
7975         jobjectArray txs_arr = NULL;
7976         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
7977         ;
7978         for (size_t i = 0; i < txs_var.datalen; i++) {
7979                 LDKTransaction txs_conv_8_var = txs_var.data[i];
7980                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
7981                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
7982                 Transaction_free(txs_conv_8_var);
7983                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
7984         }
7985         
7986         FREE(txs_var.data);
7987         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7988         CHECK(obj != NULL);
7989         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
7990         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7991                 (*env)->ExceptionDescribe(env);
7992                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
7993         }
7994         if (get_jenv_res == JNI_EDETACHED) {
7995                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7996         }
7997 }
7998 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7999         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
8000         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8001 }
8002 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
8003         jclass c = (*env)->GetObjectClass(env, o);
8004         CHECK(c != NULL);
8005         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
8006         atomic_init(&calls->refcnt, 1);
8007         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8008         calls->o = (*env)->NewWeakGlobalRef(env, o);
8009         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
8010         CHECK(calls->broadcast_transactions_meth != NULL);
8011
8012         LDKBroadcasterInterface ret = {
8013                 .this_arg = (void*) calls,
8014                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
8015                 .free = LDKBroadcasterInterface_JCalls_free,
8016         };
8017         return ret;
8018 }
8019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
8020         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
8021         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
8022         return tag_ptr(res_ptr, true);
8023 }
8024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
8025         void* this_arg_ptr = untag_ptr(this_arg);
8026         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8027         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
8028         LDKCVec_TransactionZ txs_constr;
8029         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
8030         if (txs_constr.datalen > 0)
8031                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
8032         else
8033                 txs_constr.data = NULL;
8034         for (size_t i = 0; i < txs_constr.datalen; i++) {
8035                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
8036                 LDKTransaction txs_conv_8_ref;
8037                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
8038                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
8039                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
8040                 txs_conv_8_ref.data_is_owned = true;
8041                 txs_constr.data[i] = txs_conv_8_ref;
8042         }
8043         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
8044 }
8045
8046 typedef struct LDKEntropySource_JCalls {
8047         atomic_size_t refcnt;
8048         JavaVM *vm;
8049         jweak o;
8050         jmethodID get_secure_random_bytes_meth;
8051 } LDKEntropySource_JCalls;
8052 static void LDKEntropySource_JCalls_free(void* this_arg) {
8053         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
8054         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8055                 JNIEnv *env;
8056                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8057                 if (get_jenv_res == JNI_EDETACHED) {
8058                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8059                 } else {
8060                         DO_ASSERT(get_jenv_res == JNI_OK);
8061                 }
8062                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8063                 if (get_jenv_res == JNI_EDETACHED) {
8064                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8065                 }
8066                 FREE(j_calls);
8067         }
8068 }
8069 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
8070         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
8071         JNIEnv *env;
8072         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8073         if (get_jenv_res == JNI_EDETACHED) {
8074                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8075         } else {
8076                 DO_ASSERT(get_jenv_res == JNI_OK);
8077         }
8078         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8079         CHECK(obj != NULL);
8080         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
8081         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8082                 (*env)->ExceptionDescribe(env);
8083                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
8084         }
8085         LDKThirtyTwoBytes ret_ref;
8086         CHECK((*env)->GetArrayLength(env, ret) == 32);
8087         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8088         if (get_jenv_res == JNI_EDETACHED) {
8089                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8090         }
8091         return ret_ref;
8092 }
8093 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
8094         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
8095         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8096 }
8097 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
8098         jclass c = (*env)->GetObjectClass(env, o);
8099         CHECK(c != NULL);
8100         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
8101         atomic_init(&calls->refcnt, 1);
8102         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8103         calls->o = (*env)->NewWeakGlobalRef(env, o);
8104         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
8105         CHECK(calls->get_secure_random_bytes_meth != NULL);
8106
8107         LDKEntropySource ret = {
8108                 .this_arg = (void*) calls,
8109                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
8110                 .free = LDKEntropySource_JCalls_free,
8111         };
8112         return ret;
8113 }
8114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
8115         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
8116         *res_ptr = LDKEntropySource_init(env, clz, o);
8117         return tag_ptr(res_ptr, true);
8118 }
8119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
8120         void* this_arg_ptr = untag_ptr(this_arg);
8121         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8122         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
8123         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8124         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
8125         return ret_arr;
8126 }
8127
8128 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
8129 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
8130 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
8131 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
8132 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
8133 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
8134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
8135         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
8136                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
8137         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
8138         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
8139         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
8140         LDKUnsignedGossipMessage_ChannelUpdate_class =
8141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
8142         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
8143         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
8144         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
8145         LDKUnsignedGossipMessage_NodeAnnouncement_class =
8146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
8147         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
8148         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
8149         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
8150 }
8151 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8152         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
8153         switch(obj->tag) {
8154                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
8155                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
8156                         int64_t channel_announcement_ref = 0;
8157                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
8158                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
8159                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
8160                 }
8161                 case LDKUnsignedGossipMessage_ChannelUpdate: {
8162                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
8163                         int64_t channel_update_ref = 0;
8164                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
8165                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
8166                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
8167                 }
8168                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
8169                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
8170                         int64_t node_announcement_ref = 0;
8171                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
8172                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
8173                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
8174                 }
8175                 default: abort();
8176         }
8177 }
8178 typedef struct LDKNodeSigner_JCalls {
8179         atomic_size_t refcnt;
8180         JavaVM *vm;
8181         jweak o;
8182         jmethodID get_inbound_payment_key_material_meth;
8183         jmethodID get_node_id_meth;
8184         jmethodID ecdh_meth;
8185         jmethodID sign_invoice_meth;
8186         jmethodID sign_bolt12_invoice_request_meth;
8187         jmethodID sign_bolt12_invoice_meth;
8188         jmethodID sign_gossip_message_meth;
8189 } LDKNodeSigner_JCalls;
8190 static void LDKNodeSigner_JCalls_free(void* this_arg) {
8191         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8192         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8193                 JNIEnv *env;
8194                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8195                 if (get_jenv_res == JNI_EDETACHED) {
8196                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8197                 } else {
8198                         DO_ASSERT(get_jenv_res == JNI_OK);
8199                 }
8200                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8201                 if (get_jenv_res == JNI_EDETACHED) {
8202                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8203                 }
8204                 FREE(j_calls);
8205         }
8206 }
8207 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
8208         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8209         JNIEnv *env;
8210         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8211         if (get_jenv_res == JNI_EDETACHED) {
8212                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8213         } else {
8214                 DO_ASSERT(get_jenv_res == JNI_OK);
8215         }
8216         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8217         CHECK(obj != NULL);
8218         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
8219         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8220                 (*env)->ExceptionDescribe(env);
8221                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
8222         }
8223         LDKThirtyTwoBytes ret_ref;
8224         CHECK((*env)->GetArrayLength(env, ret) == 32);
8225         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8226         if (get_jenv_res == JNI_EDETACHED) {
8227                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8228         }
8229         return ret_ref;
8230 }
8231 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
8232         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8233         JNIEnv *env;
8234         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8235         if (get_jenv_res == JNI_EDETACHED) {
8236                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8237         } else {
8238                 DO_ASSERT(get_jenv_res == JNI_OK);
8239         }
8240         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8241         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8242         CHECK(obj != NULL);
8243         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
8244         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8245                 (*env)->ExceptionDescribe(env);
8246                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
8247         }
8248         void* ret_ptr = untag_ptr(ret);
8249         CHECK_ACCESS(ret_ptr);
8250         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
8251         FREE(untag_ptr(ret));
8252         if (get_jenv_res == JNI_EDETACHED) {
8253                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8254         }
8255         return ret_conv;
8256 }
8257 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
8258         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8259         JNIEnv *env;
8260         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8261         if (get_jenv_res == JNI_EDETACHED) {
8262                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8263         } else {
8264                 DO_ASSERT(get_jenv_res == JNI_OK);
8265         }
8266         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8267         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
8268         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
8269         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
8270         *tweak_copy = tweak;
8271         int64_t tweak_ref = tag_ptr(tweak_copy, true);
8272         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8273         CHECK(obj != NULL);
8274         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
8275         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8276                 (*env)->ExceptionDescribe(env);
8277                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
8278         }
8279         void* ret_ptr = untag_ptr(ret);
8280         CHECK_ACCESS(ret_ptr);
8281         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
8282         FREE(untag_ptr(ret));
8283         if (get_jenv_res == JNI_EDETACHED) {
8284                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8285         }
8286         return ret_conv;
8287 }
8288 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
8289         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8290         JNIEnv *env;
8291         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8292         if (get_jenv_res == JNI_EDETACHED) {
8293                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8294         } else {
8295                 DO_ASSERT(get_jenv_res == JNI_OK);
8296         }
8297         LDKu8slice hrp_bytes_var = hrp_bytes;
8298         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
8299         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
8300         LDKCVec_U5Z invoice_data_var = invoice_data;
8301         jobjectArray invoice_data_arr = NULL;
8302         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
8303         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
8304         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
8305                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
8306                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
8307         }
8308         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
8309         FREE(invoice_data_var.data);
8310         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8311         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8312         CHECK(obj != NULL);
8313         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
8314         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8315                 (*env)->ExceptionDescribe(env);
8316                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
8317         }
8318         void* ret_ptr = untag_ptr(ret);
8319         CHECK_ACCESS(ret_ptr);
8320         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
8321         FREE(untag_ptr(ret));
8322         if (get_jenv_res == JNI_EDETACHED) {
8323                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8324         }
8325         return ret_conv;
8326 }
8327 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
8328         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8329         JNIEnv *env;
8330         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8331         if (get_jenv_res == JNI_EDETACHED) {
8332                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8333         } else {
8334                 DO_ASSERT(get_jenv_res == JNI_OK);
8335         }
8336         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
8337         int64_t invoice_request_ref = 0;
8338         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
8339         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8340         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
8341         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8342         CHECK(obj != NULL);
8343         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
8344         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8345                 (*env)->ExceptionDescribe(env);
8346                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
8347         }
8348         void* ret_ptr = untag_ptr(ret);
8349         CHECK_ACCESS(ret_ptr);
8350         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8351         FREE(untag_ptr(ret));
8352         if (get_jenv_res == JNI_EDETACHED) {
8353                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8354         }
8355         return ret_conv;
8356 }
8357 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
8358         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8359         JNIEnv *env;
8360         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8361         if (get_jenv_res == JNI_EDETACHED) {
8362                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8363         } else {
8364                 DO_ASSERT(get_jenv_res == JNI_OK);
8365         }
8366         LDKUnsignedBolt12Invoice invoice_var = *invoice;
8367         int64_t invoice_ref = 0;
8368         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
8369         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8370         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
8371         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8372         CHECK(obj != NULL);
8373         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
8374         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8375                 (*env)->ExceptionDescribe(env);
8376                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
8377         }
8378         void* ret_ptr = untag_ptr(ret);
8379         CHECK_ACCESS(ret_ptr);
8380         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8381         FREE(untag_ptr(ret));
8382         if (get_jenv_res == JNI_EDETACHED) {
8383                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8384         }
8385         return ret_conv;
8386 }
8387 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
8388         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8389         JNIEnv *env;
8390         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8391         if (get_jenv_res == JNI_EDETACHED) {
8392                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8393         } else {
8394                 DO_ASSERT(get_jenv_res == JNI_OK);
8395         }
8396         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
8397         *msg_copy = msg;
8398         int64_t msg_ref = tag_ptr(msg_copy, true);
8399         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8400         CHECK(obj != NULL);
8401         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
8402         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8403                 (*env)->ExceptionDescribe(env);
8404                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
8405         }
8406         void* ret_ptr = untag_ptr(ret);
8407         CHECK_ACCESS(ret_ptr);
8408         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
8409         FREE(untag_ptr(ret));
8410         if (get_jenv_res == JNI_EDETACHED) {
8411                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8412         }
8413         return ret_conv;
8414 }
8415 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
8416         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
8417         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8418 }
8419 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
8420         jclass c = (*env)->GetObjectClass(env, o);
8421         CHECK(c != NULL);
8422         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
8423         atomic_init(&calls->refcnt, 1);
8424         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8425         calls->o = (*env)->NewWeakGlobalRef(env, o);
8426         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
8427         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
8428         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
8429         CHECK(calls->get_node_id_meth != NULL);
8430         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
8431         CHECK(calls->ecdh_meth != NULL);
8432         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
8433         CHECK(calls->sign_invoice_meth != NULL);
8434         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
8435         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
8436         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
8437         CHECK(calls->sign_bolt12_invoice_meth != NULL);
8438         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
8439         CHECK(calls->sign_gossip_message_meth != NULL);
8440
8441         LDKNodeSigner ret = {
8442                 .this_arg = (void*) calls,
8443                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
8444                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
8445                 .ecdh = ecdh_LDKNodeSigner_jcall,
8446                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
8447                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
8448                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
8449                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
8450                 .free = LDKNodeSigner_JCalls_free,
8451         };
8452         return ret;
8453 }
8454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
8455         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
8456         *res_ptr = LDKNodeSigner_init(env, clz, o);
8457         return tag_ptr(res_ptr, true);
8458 }
8459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
8460         void* this_arg_ptr = untag_ptr(this_arg);
8461         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8462         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8463         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8464         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
8465         return ret_arr;
8466 }
8467
8468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
8469         void* this_arg_ptr = untag_ptr(this_arg);
8470         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8471         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8472         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8473         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
8474         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
8475         return tag_ptr(ret_conv, true);
8476 }
8477
8478 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) {
8479         void* this_arg_ptr = untag_ptr(this_arg);
8480         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8481         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8482         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8483         LDKPublicKey other_key_ref;
8484         CHECK((*env)->GetArrayLength(env, other_key) == 33);
8485         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
8486         void* tweak_ptr = untag_ptr(tweak);
8487         CHECK_ACCESS(tweak_ptr);
8488         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
8489         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
8490         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
8491         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
8492         return tag_ptr(ret_conv, true);
8493 }
8494
8495 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) {
8496         void* this_arg_ptr = untag_ptr(this_arg);
8497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8498         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8499         LDKu8slice hrp_bytes_ref;
8500         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
8501         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
8502         LDKCVec_U5Z invoice_data_constr;
8503         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
8504         if (invoice_data_constr.datalen > 0)
8505                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
8506         else
8507                 invoice_data_constr.data = NULL;
8508         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
8509         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
8510                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
8511                 
8512                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
8513         }
8514         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
8515         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8516         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8517         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
8518         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
8519         return tag_ptr(ret_conv, true);
8520 }
8521
8522 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) {
8523         void* this_arg_ptr = untag_ptr(this_arg);
8524         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8525         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8526         LDKUnsignedInvoiceRequest invoice_request_conv;
8527         invoice_request_conv.inner = untag_ptr(invoice_request);
8528         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
8529         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
8530         invoice_request_conv.is_owned = false;
8531         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8532         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
8533         return tag_ptr(ret_conv, true);
8534 }
8535
8536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
8537         void* this_arg_ptr = untag_ptr(this_arg);
8538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8539         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8540         LDKUnsignedBolt12Invoice invoice_conv;
8541         invoice_conv.inner = untag_ptr(invoice);
8542         invoice_conv.is_owned = ptr_is_owned(invoice);
8543         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
8544         invoice_conv.is_owned = false;
8545         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8546         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
8547         return tag_ptr(ret_conv, true);
8548 }
8549
8550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8551         void* this_arg_ptr = untag_ptr(this_arg);
8552         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8553         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8554         void* msg_ptr = untag_ptr(msg);
8555         CHECK_ACCESS(msg_ptr);
8556         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
8557         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
8558         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
8559         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
8560         return tag_ptr(ret_conv, true);
8561 }
8562
8563 typedef struct LDKSignerProvider_JCalls {
8564         atomic_size_t refcnt;
8565         JavaVM *vm;
8566         jweak o;
8567         jmethodID generate_channel_keys_id_meth;
8568         jmethodID derive_channel_signer_meth;
8569         jmethodID read_chan_signer_meth;
8570         jmethodID get_destination_script_meth;
8571         jmethodID get_shutdown_scriptpubkey_meth;
8572 } LDKSignerProvider_JCalls;
8573 static void LDKSignerProvider_JCalls_free(void* this_arg) {
8574         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8575         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8576                 JNIEnv *env;
8577                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8578                 if (get_jenv_res == JNI_EDETACHED) {
8579                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8580                 } else {
8581                         DO_ASSERT(get_jenv_res == JNI_OK);
8582                 }
8583                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8584                 if (get_jenv_res == JNI_EDETACHED) {
8585                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8586                 }
8587                 FREE(j_calls);
8588         }
8589 }
8590 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
8591         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8592         JNIEnv *env;
8593         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8594         if (get_jenv_res == JNI_EDETACHED) {
8595                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8596         } else {
8597                 DO_ASSERT(get_jenv_res == JNI_OK);
8598         }
8599         jboolean inbound_conv = inbound;
8600         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8601         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
8602         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
8603         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8604         CHECK(obj != NULL);
8605         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
8606         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8607                 (*env)->ExceptionDescribe(env);
8608                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
8609         }
8610         LDKThirtyTwoBytes ret_ref;
8611         CHECK((*env)->GetArrayLength(env, ret) == 32);
8612         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8613         if (get_jenv_res == JNI_EDETACHED) {
8614                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8615         }
8616         return ret_ref;
8617 }
8618 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
8619         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8620         JNIEnv *env;
8621         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8622         if (get_jenv_res == JNI_EDETACHED) {
8623                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8624         } else {
8625                 DO_ASSERT(get_jenv_res == JNI_OK);
8626         }
8627         int64_t channel_value_satoshis_conv = channel_value_satoshis;
8628         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
8629         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
8630         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8631         CHECK(obj != NULL);
8632         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
8633         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8634                 (*env)->ExceptionDescribe(env);
8635                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
8636         }
8637         void* ret_ptr = untag_ptr(ret);
8638         CHECK_ACCESS(ret_ptr);
8639         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
8640         FREE(untag_ptr(ret));
8641         if (get_jenv_res == JNI_EDETACHED) {
8642                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8643         }
8644         return ret_conv;
8645 }
8646 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
8647         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8648         JNIEnv *env;
8649         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8650         if (get_jenv_res == JNI_EDETACHED) {
8651                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8652         } else {
8653                 DO_ASSERT(get_jenv_res == JNI_OK);
8654         }
8655         LDKu8slice reader_var = reader;
8656         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
8657         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
8658         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8659         CHECK(obj != NULL);
8660         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
8661         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8662                 (*env)->ExceptionDescribe(env);
8663                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
8664         }
8665         void* ret_ptr = untag_ptr(ret);
8666         CHECK_ACCESS(ret_ptr);
8667         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
8668         FREE(untag_ptr(ret));
8669         if (get_jenv_res == JNI_EDETACHED) {
8670                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8671         }
8672         return ret_conv;
8673 }
8674 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
8675         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8676         JNIEnv *env;
8677         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8678         if (get_jenv_res == JNI_EDETACHED) {
8679                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8680         } else {
8681                 DO_ASSERT(get_jenv_res == JNI_OK);
8682         }
8683         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8684         CHECK(obj != NULL);
8685         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
8686         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8687                 (*env)->ExceptionDescribe(env);
8688                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
8689         }
8690         void* ret_ptr = untag_ptr(ret);
8691         CHECK_ACCESS(ret_ptr);
8692         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
8693         FREE(untag_ptr(ret));
8694         if (get_jenv_res == JNI_EDETACHED) {
8695                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8696         }
8697         return ret_conv;
8698 }
8699 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
8700         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8701         JNIEnv *env;
8702         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8703         if (get_jenv_res == JNI_EDETACHED) {
8704                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8705         } else {
8706                 DO_ASSERT(get_jenv_res == JNI_OK);
8707         }
8708         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8709         CHECK(obj != NULL);
8710         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
8711         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8712                 (*env)->ExceptionDescribe(env);
8713                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
8714         }
8715         void* ret_ptr = untag_ptr(ret);
8716         CHECK_ACCESS(ret_ptr);
8717         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
8718         FREE(untag_ptr(ret));
8719         if (get_jenv_res == JNI_EDETACHED) {
8720                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8721         }
8722         return ret_conv;
8723 }
8724 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
8725         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
8726         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8727 }
8728 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
8729         jclass c = (*env)->GetObjectClass(env, o);
8730         CHECK(c != NULL);
8731         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
8732         atomic_init(&calls->refcnt, 1);
8733         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8734         calls->o = (*env)->NewWeakGlobalRef(env, o);
8735         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
8736         CHECK(calls->generate_channel_keys_id_meth != NULL);
8737         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
8738         CHECK(calls->derive_channel_signer_meth != NULL);
8739         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
8740         CHECK(calls->read_chan_signer_meth != NULL);
8741         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
8742         CHECK(calls->get_destination_script_meth != NULL);
8743         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
8744         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
8745
8746         LDKSignerProvider ret = {
8747                 .this_arg = (void*) calls,
8748                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
8749                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
8750                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
8751                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
8752                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
8753                 .free = LDKSignerProvider_JCalls_free,
8754         };
8755         return ret;
8756 }
8757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
8758         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
8759         *res_ptr = LDKSignerProvider_init(env, clz, o);
8760         return tag_ptr(res_ptr, true);
8761 }
8762 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) {
8763         void* this_arg_ptr = untag_ptr(this_arg);
8764         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8765         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8766         LDKU128 user_channel_id_ref;
8767         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
8768         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
8769         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8770         (*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);
8771         return ret_arr;
8772 }
8773
8774 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) {
8775         void* this_arg_ptr = untag_ptr(this_arg);
8776         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8777         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8778         LDKThirtyTwoBytes channel_keys_id_ref;
8779         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
8780         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
8781         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
8782         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
8783         return tag_ptr(ret_ret, true);
8784 }
8785
8786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
8787         void* this_arg_ptr = untag_ptr(this_arg);
8788         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8789         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8790         LDKu8slice reader_ref;
8791         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
8792         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
8793         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
8794         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
8795         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
8796         return tag_ptr(ret_conv, true);
8797 }
8798
8799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
8800         void* this_arg_ptr = untag_ptr(this_arg);
8801         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8802         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8803         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
8804         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
8805         return tag_ptr(ret_conv, true);
8806 }
8807
8808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
8809         void* this_arg_ptr = untag_ptr(this_arg);
8810         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8811         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8812         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
8813         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
8814         return tag_ptr(ret_conv, true);
8815 }
8816
8817 typedef struct LDKFeeEstimator_JCalls {
8818         atomic_size_t refcnt;
8819         JavaVM *vm;
8820         jweak o;
8821         jmethodID get_est_sat_per_1000_weight_meth;
8822 } LDKFeeEstimator_JCalls;
8823 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
8824         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8825         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8826                 JNIEnv *env;
8827                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8828                 if (get_jenv_res == JNI_EDETACHED) {
8829                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8830                 } else {
8831                         DO_ASSERT(get_jenv_res == JNI_OK);
8832                 }
8833                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8834                 if (get_jenv_res == JNI_EDETACHED) {
8835                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8836                 }
8837                 FREE(j_calls);
8838         }
8839 }
8840 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
8841         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8842         JNIEnv *env;
8843         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8844         if (get_jenv_res == JNI_EDETACHED) {
8845                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8846         } else {
8847                 DO_ASSERT(get_jenv_res == JNI_OK);
8848         }
8849         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
8850         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8851         CHECK(obj != NULL);
8852         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
8853         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8854                 (*env)->ExceptionDescribe(env);
8855                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
8856         }
8857         if (get_jenv_res == JNI_EDETACHED) {
8858                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8859         }
8860         return ret;
8861 }
8862 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
8863         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
8864         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8865 }
8866 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
8867         jclass c = (*env)->GetObjectClass(env, o);
8868         CHECK(c != NULL);
8869         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
8870         atomic_init(&calls->refcnt, 1);
8871         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8872         calls->o = (*env)->NewWeakGlobalRef(env, o);
8873         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
8874         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
8875
8876         LDKFeeEstimator ret = {
8877                 .this_arg = (void*) calls,
8878                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
8879                 .free = LDKFeeEstimator_JCalls_free,
8880         };
8881         return ret;
8882 }
8883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
8884         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
8885         *res_ptr = LDKFeeEstimator_init(env, clz, o);
8886         return tag_ptr(res_ptr, true);
8887 }
8888 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) {
8889         void* this_arg_ptr = untag_ptr(this_arg);
8890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8891         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
8892         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
8893         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
8894         return ret_conv;
8895 }
8896
8897 typedef struct LDKRouter_JCalls {
8898         atomic_size_t refcnt;
8899         JavaVM *vm;
8900         jweak o;
8901         jmethodID find_route_meth;
8902         jmethodID find_route_with_id_meth;
8903 } LDKRouter_JCalls;
8904 static void LDKRouter_JCalls_free(void* this_arg) {
8905         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8906         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8907                 JNIEnv *env;
8908                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8909                 if (get_jenv_res == JNI_EDETACHED) {
8910                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8911                 } else {
8912                         DO_ASSERT(get_jenv_res == JNI_OK);
8913                 }
8914                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8915                 if (get_jenv_res == JNI_EDETACHED) {
8916                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8917                 }
8918                 FREE(j_calls);
8919         }
8920 }
8921 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
8922         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8923         JNIEnv *env;
8924         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8925         if (get_jenv_res == JNI_EDETACHED) {
8926                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8927         } else {
8928                 DO_ASSERT(get_jenv_res == JNI_OK);
8929         }
8930         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8931         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8932         LDKRouteParameters route_params_var = *route_params;
8933         int64_t route_params_ref = 0;
8934         route_params_var = RouteParameters_clone(&route_params_var);
8935         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8936         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8937         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8938         int64_tArray first_hops_arr = NULL;
8939         if (first_hops != NULL) {
8940                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8941                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8942                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8943                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8944                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8945                         int64_t first_hops_conv_16_ref = 0;
8946                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8947                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8948                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8949                 }
8950                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8951         }
8952         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8953         int64_t inflight_htlcs_ref = 0;
8954         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8955         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8956         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8957         CHECK(obj != NULL);
8958         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
8959         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8960                 (*env)->ExceptionDescribe(env);
8961                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
8962         }
8963         void* ret_ptr = untag_ptr(ret);
8964         CHECK_ACCESS(ret_ptr);
8965         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8966         FREE(untag_ptr(ret));
8967         if (get_jenv_res == JNI_EDETACHED) {
8968                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8969         }
8970         return ret_conv;
8971 }
8972 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) {
8973         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8974         JNIEnv *env;
8975         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8976         if (get_jenv_res == JNI_EDETACHED) {
8977                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8978         } else {
8979                 DO_ASSERT(get_jenv_res == JNI_OK);
8980         }
8981         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8982         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8983         LDKRouteParameters route_params_var = *route_params;
8984         int64_t route_params_ref = 0;
8985         route_params_var = RouteParameters_clone(&route_params_var);
8986         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8987         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8988         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8989         int64_tArray first_hops_arr = NULL;
8990         if (first_hops != NULL) {
8991                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8992                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8993                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8994                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8995                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8996                         int64_t first_hops_conv_16_ref = 0;
8997                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8998                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8999                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
9000                 }
9001                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
9002         }
9003         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
9004         int64_t inflight_htlcs_ref = 0;
9005         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
9006         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
9007         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
9008         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
9009         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
9010         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
9011         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9012         CHECK(obj != NULL);
9013         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);
9014         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9015                 (*env)->ExceptionDescribe(env);
9016                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
9017         }
9018         void* ret_ptr = untag_ptr(ret);
9019         CHECK_ACCESS(ret_ptr);
9020         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
9021         FREE(untag_ptr(ret));
9022         if (get_jenv_res == JNI_EDETACHED) {
9023                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9024         }
9025         return ret_conv;
9026 }
9027 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
9028         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
9029         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9030 }
9031 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
9032         jclass c = (*env)->GetObjectClass(env, o);
9033         CHECK(c != NULL);
9034         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
9035         atomic_init(&calls->refcnt, 1);
9036         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9037         calls->o = (*env)->NewWeakGlobalRef(env, o);
9038         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
9039         CHECK(calls->find_route_meth != NULL);
9040         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
9041         CHECK(calls->find_route_with_id_meth != NULL);
9042
9043         LDKRouter ret = {
9044                 .this_arg = (void*) calls,
9045                 .find_route = find_route_LDKRouter_jcall,
9046                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
9047                 .free = LDKRouter_JCalls_free,
9048         };
9049         return ret;
9050 }
9051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
9052         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
9053         *res_ptr = LDKRouter_init(env, clz, o);
9054         return tag_ptr(res_ptr, true);
9055 }
9056 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) {
9057         void* this_arg_ptr = untag_ptr(this_arg);
9058         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9059         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9060         LDKPublicKey payer_ref;
9061         CHECK((*env)->GetArrayLength(env, payer) == 33);
9062         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
9063         LDKRouteParameters route_params_conv;
9064         route_params_conv.inner = untag_ptr(route_params);
9065         route_params_conv.is_owned = ptr_is_owned(route_params);
9066         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9067         route_params_conv.is_owned = false;
9068         LDKCVec_ChannelDetailsZ first_hops_constr;
9069         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9070         if (first_hops != NULL) {
9071                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9072                 if (first_hops_constr.datalen > 0)
9073                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9074                 else
9075                         first_hops_constr.data = NULL;
9076                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9077                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9078                         int64_t first_hops_conv_16 = first_hops_vals[q];
9079                         LDKChannelDetails first_hops_conv_16_conv;
9080                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9081                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9082                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9083                         first_hops_conv_16_conv.is_owned = false;
9084                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9085                 }
9086                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9087                 first_hops_ptr = &first_hops_constr;
9088         }
9089         LDKInFlightHtlcs inflight_htlcs_conv;
9090         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
9091         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
9092         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
9093         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
9094         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9095         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
9096         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9097         return tag_ptr(ret_conv, true);
9098 }
9099
9100 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) {
9101         void* this_arg_ptr = untag_ptr(this_arg);
9102         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9103         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9104         LDKPublicKey payer_ref;
9105         CHECK((*env)->GetArrayLength(env, payer) == 33);
9106         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
9107         LDKRouteParameters route_params_conv;
9108         route_params_conv.inner = untag_ptr(route_params);
9109         route_params_conv.is_owned = ptr_is_owned(route_params);
9110         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9111         route_params_conv.is_owned = false;
9112         LDKCVec_ChannelDetailsZ first_hops_constr;
9113         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9114         if (first_hops != NULL) {
9115                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9116                 if (first_hops_constr.datalen > 0)
9117                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9118                 else
9119                         first_hops_constr.data = NULL;
9120                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9121                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9122                         int64_t first_hops_conv_16 = first_hops_vals[q];
9123                         LDKChannelDetails first_hops_conv_16_conv;
9124                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9125                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9126                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9127                         first_hops_conv_16_conv.is_owned = false;
9128                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9129                 }
9130                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9131                 first_hops_ptr = &first_hops_constr;
9132         }
9133         LDKInFlightHtlcs inflight_htlcs_conv;
9134         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
9135         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
9136         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
9137         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
9138         LDKThirtyTwoBytes _payment_hash_ref;
9139         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
9140         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
9141         LDKThirtyTwoBytes _payment_id_ref;
9142         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
9143         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
9144         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9145         *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);
9146         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9147         return tag_ptr(ret_conv, true);
9148 }
9149
9150 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
9151         return ThirtyTwoBytes_clone(&owner->a);
9152 }
9153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9154         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
9155         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9156         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
9157         return ret_arr;
9158 }
9159
9160 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
9161         LDKChannelManager ret = owner->b;
9162         ret.is_owned = false;
9163         return ret;
9164 }
9165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9166         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
9167         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
9168         int64_t ret_ref = 0;
9169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9171         return ret_ref;
9172 }
9173
9174 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
9175 CHECK(owner->result_ok);
9176         return &*owner->contents.result;
9177 }
9178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9179         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
9180         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
9181         return ret_ret;
9182 }
9183
9184 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
9185 CHECK(!owner->result_ok);
9186         return DecodeError_clone(&*owner->contents.err);
9187 }
9188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9189         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
9190         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9191         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
9192         int64_t ret_ref = tag_ptr(ret_copy, true);
9193         return ret_ref;
9194 }
9195
9196 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
9197 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
9198 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
9199 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
9200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
9201         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
9202                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
9203         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
9204         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
9205         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
9206         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
9207                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
9208         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
9209         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
9210         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
9211 }
9212 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9213         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
9214         switch(obj->tag) {
9215                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
9216                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
9217                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
9218                 }
9219                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
9220                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
9221                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
9222                 }
9223                 default: abort();
9224         }
9225 }
9226 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9227 CHECK(owner->result_ok);
9228         return MaxDustHTLCExposure_clone(&*owner->contents.result);
9229 }
9230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9231         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9232         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
9233         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
9234         int64_t ret_ref = tag_ptr(ret_copy, true);
9235         return ret_ref;
9236 }
9237
9238 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9239 CHECK(!owner->result_ok);
9240         return DecodeError_clone(&*owner->contents.err);
9241 }
9242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9243         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9244         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9245         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
9246         int64_t ret_ref = tag_ptr(ret_copy, true);
9247         return ret_ref;
9248 }
9249
9250 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9251         LDKChannelConfig ret = *owner->contents.result;
9252         ret.is_owned = false;
9253         return ret;
9254 }
9255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9256         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9257         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
9258         int64_t ret_ref = 0;
9259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9261         return ret_ref;
9262 }
9263
9264 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9265 CHECK(!owner->result_ok);
9266         return DecodeError_clone(&*owner->contents.err);
9267 }
9268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9269         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9270         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9271         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
9272         int64_t ret_ref = tag_ptr(ret_copy, true);
9273         return ret_ref;
9274 }
9275
9276 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
9277 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
9278 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
9279 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
9280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
9281         LDKCOption_MaxDustHTLCExposureZ_Some_class =
9282                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
9283         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
9284         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
9285         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
9286         LDKCOption_MaxDustHTLCExposureZ_None_class =
9287                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
9288         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
9289         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
9290         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
9291 }
9292 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9293         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
9294         switch(obj->tag) {
9295                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
9296                         int64_t some_ref = tag_ptr(&obj->some, false);
9297                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
9298                 }
9299                 case LDKCOption_MaxDustHTLCExposureZ_None: {
9300                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
9301                 }
9302                 default: abort();
9303         }
9304 }
9305 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
9306 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
9307 static jclass LDKCOption_APIErrorZ_None_class = NULL;
9308 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
9309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
9310         LDKCOption_APIErrorZ_Some_class =
9311                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
9312         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
9313         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
9314         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
9315         LDKCOption_APIErrorZ_None_class =
9316                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
9317         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
9318         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
9319         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
9320 }
9321 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9322         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
9323         switch(obj->tag) {
9324                 case LDKCOption_APIErrorZ_Some: {
9325                         int64_t some_ref = tag_ptr(&obj->some, false);
9326                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
9327                 }
9328                 case LDKCOption_APIErrorZ_None: {
9329                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
9330                 }
9331                 default: abort();
9332         }
9333 }
9334 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
9335 CHECK(owner->result_ok);
9336         return COption_APIErrorZ_clone(&*owner->contents.result);
9337 }
9338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9339         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
9340         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
9341         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
9342         int64_t ret_ref = tag_ptr(ret_copy, true);
9343         return ret_ref;
9344 }
9345
9346 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
9347 CHECK(!owner->result_ok);
9348         return DecodeError_clone(&*owner->contents.err);
9349 }
9350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9351         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
9352         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9353         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
9354         int64_t ret_ref = tag_ptr(ret_copy, true);
9355         return ret_ref;
9356 }
9357
9358 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9359         LDKChannelMonitorUpdate ret = *owner->contents.result;
9360         ret.is_owned = false;
9361         return ret;
9362 }
9363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9364         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9365         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
9366         int64_t ret_ref = 0;
9367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9369         return ret_ref;
9370 }
9371
9372 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
9373 CHECK(!owner->result_ok);
9374         return DecodeError_clone(&*owner->contents.err);
9375 }
9376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9377         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
9378         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9379         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
9380         int64_t ret_ref = tag_ptr(ret_copy, true);
9381         return ret_ref;
9382 }
9383
9384 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
9385 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
9386 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
9387 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
9388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
9389         LDKCOption_MonitorEventZ_Some_class =
9390                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
9391         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
9392         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
9393         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
9394         LDKCOption_MonitorEventZ_None_class =
9395                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
9396         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
9397         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
9398         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
9399 }
9400 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9401         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
9402         switch(obj->tag) {
9403                 case LDKCOption_MonitorEventZ_Some: {
9404                         int64_t some_ref = tag_ptr(&obj->some, false);
9405                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
9406                 }
9407                 case LDKCOption_MonitorEventZ_None: {
9408                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
9409                 }
9410                 default: abort();
9411         }
9412 }
9413 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9414 CHECK(owner->result_ok);
9415         return COption_MonitorEventZ_clone(&*owner->contents.result);
9416 }
9417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9418         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9419         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9420         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
9421         int64_t ret_ref = tag_ptr(ret_copy, true);
9422         return ret_ref;
9423 }
9424
9425 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
9426 CHECK(!owner->result_ok);
9427         return DecodeError_clone(&*owner->contents.err);
9428 }
9429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9430         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
9431         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9432         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
9433         int64_t ret_ref = tag_ptr(ret_copy, true);
9434         return ret_ref;
9435 }
9436
9437 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9438         LDKHTLCUpdate ret = *owner->contents.result;
9439         ret.is_owned = false;
9440         return ret;
9441 }
9442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9443         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9444         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
9445         int64_t ret_ref = 0;
9446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9448         return ret_ref;
9449 }
9450
9451 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
9452 CHECK(!owner->result_ok);
9453         return DecodeError_clone(&*owner->contents.err);
9454 }
9455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9456         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
9457         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9458         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
9459         int64_t ret_ref = tag_ptr(ret_copy, true);
9460         return ret_ref;
9461 }
9462
9463 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
9464         LDKOutPoint ret = owner->a;
9465         ret.is_owned = false;
9466         return ret;
9467 }
9468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9469         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
9470         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
9471         int64_t ret_ref = 0;
9472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9474         return ret_ref;
9475 }
9476
9477 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
9478         return CVec_u8Z_clone(&owner->b);
9479 }
9480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9481         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
9482         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
9483         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9484         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9485         CVec_u8Z_free(ret_var);
9486         return ret_arr;
9487 }
9488
9489 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
9490         return owner->a;
9491 }
9492 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9493         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
9494         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
9495         return ret_conv;
9496 }
9497
9498 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
9499         return CVec_u8Z_clone(&owner->b);
9500 }
9501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9502         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
9503         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
9504         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9505         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9506         CVec_u8Z_free(ret_var);
9507         return ret_arr;
9508 }
9509
9510 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
9511         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
9512         for (size_t i = 0; i < ret.datalen; i++) {
9513                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
9514         }
9515         return ret;
9516 }
9517 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
9518         return ThirtyTwoBytes_clone(&owner->a);
9519 }
9520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9521         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
9522         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9523         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
9524         return ret_arr;
9525 }
9526
9527 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
9528         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
9529 }
9530 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9531         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
9532         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
9533         int64_tArray ret_arr = NULL;
9534         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9535         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9536         for (size_t x = 0; x < ret_var.datalen; x++) {
9537                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
9538                 *ret_conv_23_conv = ret_var.data[x];
9539                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
9540         }
9541         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9542         FREE(ret_var.data);
9543         return ret_arr;
9544 }
9545
9546 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
9547         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 };
9548         for (size_t i = 0; i < ret.datalen; i++) {
9549                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
9550         }
9551         return ret;
9552 }
9553 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
9554         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
9555         for (size_t i = 0; i < ret.datalen; i++) {
9556                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
9557         }
9558         return ret;
9559 }
9560 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9561         return owner->a;
9562 }
9563 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9564         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9565         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
9566         return ret_conv;
9567 }
9568
9569 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
9570         return TxOut_clone(&owner->b);
9571 }
9572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9573         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
9574         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9575         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
9576         return tag_ptr(ret_ref, true);
9577 }
9578
9579 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
9580         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
9581         for (size_t i = 0; i < ret.datalen; i++) {
9582                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
9583         }
9584         return ret;
9585 }
9586 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9587         return ThirtyTwoBytes_clone(&owner->a);
9588 }
9589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9590         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9591         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9592         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
9593         return ret_arr;
9594 }
9595
9596 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
9597         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
9598 }
9599 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9600         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
9601         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
9602         int64_tArray ret_arr = NULL;
9603         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9604         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9605         for (size_t u = 0; u < ret_var.datalen; u++) {
9606                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
9607                 *ret_conv_20_conv = ret_var.data[u];
9608                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
9609         }
9610         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9611         FREE(ret_var.data);
9612         return ret_arr;
9613 }
9614
9615 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
9616         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 };
9617         for (size_t i = 0; i < ret.datalen; i++) {
9618                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
9619         }
9620         return ret;
9621 }
9622 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
9623 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
9624 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
9625 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
9626 static jclass LDKBalance_ContentiousClaimable_class = NULL;
9627 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
9628 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
9629 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
9630 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
9631 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
9632 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
9633 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
9634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
9635         LDKBalance_ClaimableOnChannelClose_class =
9636                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
9637         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
9638         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
9639         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
9640         LDKBalance_ClaimableAwaitingConfirmations_class =
9641                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
9642         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
9643         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
9644         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
9645         LDKBalance_ContentiousClaimable_class =
9646                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
9647         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
9648         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
9649         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
9650         LDKBalance_MaybeTimeoutClaimableHTLC_class =
9651                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
9652         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
9653         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
9654         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
9655         LDKBalance_MaybePreimageClaimableHTLC_class =
9656                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
9657         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
9658         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
9659         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
9660         LDKBalance_CounterpartyRevokedOutputClaimable_class =
9661                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
9662         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
9663         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
9664         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
9665 }
9666 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9667         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
9668         switch(obj->tag) {
9669                 case LDKBalance_ClaimableOnChannelClose: {
9670                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
9671                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
9672                 }
9673                 case LDKBalance_ClaimableAwaitingConfirmations: {
9674                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
9675                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
9676                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
9677                 }
9678                 case LDKBalance_ContentiousClaimable: {
9679                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
9680                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
9681                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9682                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
9683                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
9684                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
9685                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
9686                 }
9687                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
9688                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
9689                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
9690                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9691                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
9692                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
9693                 }
9694                 case LDKBalance_MaybePreimageClaimableHTLC: {
9695                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
9696                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
9697                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9698                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
9699                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
9700                 }
9701                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
9702                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
9703                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
9704                 }
9705                 default: abort();
9706         }
9707 }
9708 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
9709         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
9710         for (size_t i = 0; i < ret.datalen; i++) {
9711                 ret.data[i] = Balance_clone(&orig->data[i]);
9712         }
9713         return ret;
9714 }
9715 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
9716         return ThirtyTwoBytes_clone(&owner->a);
9717 }
9718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9719         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
9720         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9721         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
9722         return ret_arr;
9723 }
9724
9725 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
9726         LDKChannelMonitor ret = owner->b;
9727         ret.is_owned = false;
9728         return ret;
9729 }
9730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9731         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
9732         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
9733         int64_t ret_ref = 0;
9734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9736         return ret_ref;
9737 }
9738
9739 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9740 CHECK(owner->result_ok);
9741         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
9742 }
9743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9744         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9745         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
9746         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
9747         return tag_ptr(ret_conv, true);
9748 }
9749
9750 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9751 CHECK(!owner->result_ok);
9752         return DecodeError_clone(&*owner->contents.err);
9753 }
9754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9755         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9756         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9757         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
9758         int64_t ret_ref = tag_ptr(ret_copy, true);
9759         return ret_ref;
9760 }
9761
9762 typedef struct LDKType_JCalls {
9763         atomic_size_t refcnt;
9764         JavaVM *vm;
9765         jweak o;
9766         jmethodID type_id_meth;
9767         jmethodID debug_str_meth;
9768         jmethodID write_meth;
9769 } LDKType_JCalls;
9770 static void LDKType_JCalls_free(void* this_arg) {
9771         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9772         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9773                 JNIEnv *env;
9774                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9775                 if (get_jenv_res == JNI_EDETACHED) {
9776                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9777                 } else {
9778                         DO_ASSERT(get_jenv_res == JNI_OK);
9779                 }
9780                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9781                 if (get_jenv_res == JNI_EDETACHED) {
9782                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9783                 }
9784                 FREE(j_calls);
9785         }
9786 }
9787 uint16_t type_id_LDKType_jcall(const void* this_arg) {
9788         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9789         JNIEnv *env;
9790         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9791         if (get_jenv_res == JNI_EDETACHED) {
9792                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9793         } else {
9794                 DO_ASSERT(get_jenv_res == JNI_OK);
9795         }
9796         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9797         CHECK(obj != NULL);
9798         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
9799         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9800                 (*env)->ExceptionDescribe(env);
9801                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
9802         }
9803         if (get_jenv_res == JNI_EDETACHED) {
9804                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9805         }
9806         return ret;
9807 }
9808 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
9809         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9810         JNIEnv *env;
9811         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9812         if (get_jenv_res == JNI_EDETACHED) {
9813                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9814         } else {
9815                 DO_ASSERT(get_jenv_res == JNI_OK);
9816         }
9817         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9818         CHECK(obj != NULL);
9819         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
9820         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9821                 (*env)->ExceptionDescribe(env);
9822                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
9823         }
9824         LDKStr ret_conv = java_to_owned_str(env, ret);
9825         if (get_jenv_res == JNI_EDETACHED) {
9826                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9827         }
9828         return ret_conv;
9829 }
9830 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
9831         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9832         JNIEnv *env;
9833         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9834         if (get_jenv_res == JNI_EDETACHED) {
9835                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9836         } else {
9837                 DO_ASSERT(get_jenv_res == JNI_OK);
9838         }
9839         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9840         CHECK(obj != NULL);
9841         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9843                 (*env)->ExceptionDescribe(env);
9844                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
9845         }
9846         LDKCVec_u8Z ret_ref;
9847         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9848         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9849         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9850         if (get_jenv_res == JNI_EDETACHED) {
9851                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9852         }
9853         return ret_ref;
9854 }
9855 static void LDKType_JCalls_cloned(LDKType* new_obj) {
9856         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
9857         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9858 }
9859 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
9860         jclass c = (*env)->GetObjectClass(env, o);
9861         CHECK(c != NULL);
9862         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
9863         atomic_init(&calls->refcnt, 1);
9864         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9865         calls->o = (*env)->NewWeakGlobalRef(env, o);
9866         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
9867         CHECK(calls->type_id_meth != NULL);
9868         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
9869         CHECK(calls->debug_str_meth != NULL);
9870         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9871         CHECK(calls->write_meth != NULL);
9872
9873         LDKType ret = {
9874                 .this_arg = (void*) calls,
9875                 .type_id = type_id_LDKType_jcall,
9876                 .debug_str = debug_str_LDKType_jcall,
9877                 .write = write_LDKType_jcall,
9878                 .cloned = LDKType_JCalls_cloned,
9879                 .free = LDKType_JCalls_free,
9880         };
9881         return ret;
9882 }
9883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
9884         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
9885         *res_ptr = LDKType_init(env, clz, o);
9886         return tag_ptr(res_ptr, true);
9887 }
9888 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9889         void* this_arg_ptr = untag_ptr(this_arg);
9890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9891         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9892         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
9893         return ret_conv;
9894 }
9895
9896 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
9897         void* this_arg_ptr = untag_ptr(this_arg);
9898         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9899         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9900         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
9901         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9902         Str_free(ret_str);
9903         return ret_conv;
9904 }
9905
9906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9907         void* this_arg_ptr = untag_ptr(this_arg);
9908         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9909         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9910         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9911         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9912         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9913         CVec_u8Z_free(ret_var);
9914         return ret_arr;
9915 }
9916
9917 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9918         return owner->a;
9919 }
9920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9921         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9922         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9923         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
9924         return ret_arr;
9925 }
9926
9927 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9928         return Type_clone(&owner->b);
9929 }
9930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9931         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9932         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
9933         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
9934         return tag_ptr(ret_ret, true);
9935 }
9936
9937 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
9938         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
9939         for (size_t i = 0; i < ret.datalen; i++) {
9940                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
9941         }
9942         return ret;
9943 }
9944 typedef struct LDKOnionMessageContents_JCalls {
9945         atomic_size_t refcnt;
9946         JavaVM *vm;
9947         jweak o;
9948         jmethodID tlv_type_meth;
9949         jmethodID write_meth;
9950 } LDKOnionMessageContents_JCalls;
9951 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
9952         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
9953         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9954                 JNIEnv *env;
9955                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9956                 if (get_jenv_res == JNI_EDETACHED) {
9957                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9958                 } else {
9959                         DO_ASSERT(get_jenv_res == JNI_OK);
9960                 }
9961                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9962                 if (get_jenv_res == JNI_EDETACHED) {
9963                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9964                 }
9965                 FREE(j_calls);
9966         }
9967 }
9968 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
9969         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
9970         JNIEnv *env;
9971         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9972         if (get_jenv_res == JNI_EDETACHED) {
9973                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9974         } else {
9975                 DO_ASSERT(get_jenv_res == JNI_OK);
9976         }
9977         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9978         CHECK(obj != NULL);
9979         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
9980         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9981                 (*env)->ExceptionDescribe(env);
9982                 (*env)->FatalError(env, "A call to tlv_type in LDKOnionMessageContents from rust threw an exception.");
9983         }
9984         if (get_jenv_res == JNI_EDETACHED) {
9985                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9986         }
9987         return ret;
9988 }
9989 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
9990         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
9991         JNIEnv *env;
9992         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9993         if (get_jenv_res == JNI_EDETACHED) {
9994                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9995         } else {
9996                 DO_ASSERT(get_jenv_res == JNI_OK);
9997         }
9998         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9999         CHECK(obj != NULL);
10000         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10001         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10002                 (*env)->ExceptionDescribe(env);
10003                 (*env)->FatalError(env, "A call to write in LDKOnionMessageContents from rust threw an exception.");
10004         }
10005         LDKCVec_u8Z ret_ref;
10006         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10007         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10008         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10009         if (get_jenv_res == JNI_EDETACHED) {
10010                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10011         }
10012         return ret_ref;
10013 }
10014 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
10015         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
10016         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10017 }
10018 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
10019         jclass c = (*env)->GetObjectClass(env, o);
10020         CHECK(c != NULL);
10021         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
10022         atomic_init(&calls->refcnt, 1);
10023         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10024         calls->o = (*env)->NewWeakGlobalRef(env, o);
10025         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
10026         CHECK(calls->tlv_type_meth != NULL);
10027         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10028         CHECK(calls->write_meth != NULL);
10029
10030         LDKOnionMessageContents ret = {
10031                 .this_arg = (void*) calls,
10032                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
10033                 .write = write_LDKOnionMessageContents_jcall,
10034                 .cloned = LDKOnionMessageContents_JCalls_cloned,
10035                 .free = LDKOnionMessageContents_JCalls_free,
10036         };
10037         return ret;
10038 }
10039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
10040         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10041         *res_ptr = LDKOnionMessageContents_init(env, clz, o);
10042         return tag_ptr(res_ptr, true);
10043 }
10044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
10045         void* this_arg_ptr = untag_ptr(this_arg);
10046         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10047         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10048         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
10049         return ret_conv;
10050 }
10051
10052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10053         void* this_arg_ptr = untag_ptr(this_arg);
10054         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10055         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10056         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10059         CVec_u8Z_free(ret_var);
10060         return ret_arr;
10061 }
10062
10063 static jclass LDKCOption_OnionMessageContentsZ_Some_class = NULL;
10064 static jmethodID LDKCOption_OnionMessageContentsZ_Some_meth = NULL;
10065 static jclass LDKCOption_OnionMessageContentsZ_None_class = NULL;
10066 static jmethodID LDKCOption_OnionMessageContentsZ_None_meth = NULL;
10067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
10068         LDKCOption_OnionMessageContentsZ_Some_class =
10069                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$Some"));
10070         CHECK(LDKCOption_OnionMessageContentsZ_Some_class != NULL);
10071         LDKCOption_OnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_Some_class, "<init>", "(J)V");
10072         CHECK(LDKCOption_OnionMessageContentsZ_Some_meth != NULL);
10073         LDKCOption_OnionMessageContentsZ_None_class =
10074                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$None"));
10075         CHECK(LDKCOption_OnionMessageContentsZ_None_class != NULL);
10076         LDKCOption_OnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_None_class, "<init>", "()V");
10077         CHECK(LDKCOption_OnionMessageContentsZ_None_meth != NULL);
10078 }
10079 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10080         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
10081         switch(obj->tag) {
10082                 case LDKCOption_OnionMessageContentsZ_Some: {
10083                         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10084                         *some_ret = OnionMessageContents_clone(&obj->some);
10085                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_Some_class, LDKCOption_OnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
10086                 }
10087                 case LDKCOption_OnionMessageContentsZ_None: {
10088                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_None_class, LDKCOption_OnionMessageContentsZ_None_meth);
10089                 }
10090                 default: abort();
10091         }
10092 }
10093 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
10094 CHECK(owner->result_ok);
10095         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
10096 }
10097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10098         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
10099         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
10100         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
10101         int64_t ret_ref = tag_ptr(ret_copy, true);
10102         return ret_ref;
10103 }
10104
10105 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
10106 CHECK(!owner->result_ok);
10107         return DecodeError_clone(&*owner->contents.err);
10108 }
10109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10110         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
10111         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10112         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
10113         int64_t ret_ref = tag_ptr(ret_copy, true);
10114         return ret_ref;
10115 }
10116
10117 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10118         return OnionMessageContents_clone(&owner->a);
10119 }
10120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10121         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10122         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10123         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
10124         return tag_ptr(ret_ret, true);
10125 }
10126
10127 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10128         return Destination_clone(&owner->b);
10129 }
10130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10131         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10132         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
10133         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
10134         int64_t ret_ref = tag_ptr(ret_copy, true);
10135         return ret_ref;
10136 }
10137
10138 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10139         LDKBlindedPath ret = owner->c;
10140         ret.is_owned = false;
10141         return ret;
10142 }
10143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
10144         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10145         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
10146         int64_t ret_ref = 0;
10147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10149         return ret_ref;
10150 }
10151
10152 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
10153         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
10154         for (size_t i = 0; i < ret.datalen; i++) {
10155                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
10156         }
10157         return ret;
10158 }
10159 static jclass LDKCOption_TypeZ_Some_class = NULL;
10160 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
10161 static jclass LDKCOption_TypeZ_None_class = NULL;
10162 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
10163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
10164         LDKCOption_TypeZ_Some_class =
10165                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
10166         CHECK(LDKCOption_TypeZ_Some_class != NULL);
10167         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
10168         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
10169         LDKCOption_TypeZ_None_class =
10170                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
10171         CHECK(LDKCOption_TypeZ_None_class != NULL);
10172         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
10173         CHECK(LDKCOption_TypeZ_None_meth != NULL);
10174 }
10175 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10176         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
10177         switch(obj->tag) {
10178                 case LDKCOption_TypeZ_Some: {
10179                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
10180                         *some_ret = Type_clone(&obj->some);
10181                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
10182                 }
10183                 case LDKCOption_TypeZ_None: {
10184                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
10185                 }
10186                 default: abort();
10187         }
10188 }
10189 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
10190 CHECK(owner->result_ok);
10191         return COption_TypeZ_clone(&*owner->contents.result);
10192 }
10193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10194         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
10195         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10196         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
10197         int64_t ret_ref = tag_ptr(ret_copy, true);
10198         return ret_ref;
10199 }
10200
10201 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
10202 CHECK(!owner->result_ok);
10203         return DecodeError_clone(&*owner->contents.err);
10204 }
10205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10206         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
10207         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10208         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
10209         int64_t ret_ref = tag_ptr(ret_copy, true);
10210         return ret_ref;
10211 }
10212
10213 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
10214 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
10215 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
10216 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
10217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
10218         LDKCOption_SocketAddressZ_Some_class =
10219                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
10220         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
10221         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
10222         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
10223         LDKCOption_SocketAddressZ_None_class =
10224                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
10225         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
10226         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
10227         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
10228 }
10229 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10230         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
10231         switch(obj->tag) {
10232                 case LDKCOption_SocketAddressZ_Some: {
10233                         int64_t some_ref = tag_ptr(&obj->some, false);
10234                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
10235                 }
10236                 case LDKCOption_SocketAddressZ_None: {
10237                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
10238                 }
10239                 default: abort();
10240         }
10241 }
10242 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
10243         return owner->a;
10244 }
10245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10246         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
10247         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10248         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form);
10249         return ret_arr;
10250 }
10251
10252 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
10253         return COption_SocketAddressZ_clone(&owner->b);
10254 }
10255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10256         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
10257         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
10258         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
10259         int64_t ret_ref = tag_ptr(ret_copy, true);
10260         return ret_ref;
10261 }
10262
10263 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
10264         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
10265         for (size_t i = 0; i < ret.datalen; i++) {
10266                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
10267         }
10268         return ret;
10269 }
10270 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
10271 CHECK(owner->result_ok);
10272         return CVec_u8Z_clone(&*owner->contents.result);
10273 }
10274 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10275         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
10276         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
10277         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10278         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10279         CVec_u8Z_free(ret_var);
10280         return ret_arr;
10281 }
10282
10283 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
10284         LDKPeerHandleError ret = *owner->contents.err;
10285         ret.is_owned = false;
10286         return ret;
10287 }
10288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10289         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
10290         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
10291         int64_t ret_ref = 0;
10292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10294         return ret_ref;
10295 }
10296
10297 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
10298 CHECK(owner->result_ok);
10299         return *owner->contents.result;
10300 }
10301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10302         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
10303         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
10304 }
10305
10306 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
10307         LDKPeerHandleError ret = *owner->contents.err;
10308         ret.is_owned = false;
10309         return ret;
10310 }
10311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10312         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
10313         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
10314         int64_t ret_ref = 0;
10315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10317         return ret_ref;
10318 }
10319
10320 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
10321 CHECK(owner->result_ok);
10322         return *owner->contents.result;
10323 }
10324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10325         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
10326         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
10327         return ret_conv;
10328 }
10329
10330 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
10331         LDKPeerHandleError ret = *owner->contents.err;
10332         ret.is_owned = false;
10333         return ret;
10334 }
10335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10336         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
10337         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
10338         int64_t ret_ref = 0;
10339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10341         return ret_ref;
10342 }
10343
10344 static jclass LDKGraphSyncError_DecodeError_class = NULL;
10345 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
10346 static jclass LDKGraphSyncError_LightningError_class = NULL;
10347 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
10348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
10349         LDKGraphSyncError_DecodeError_class =
10350                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
10351         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
10352         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
10353         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
10354         LDKGraphSyncError_LightningError_class =
10355                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
10356         CHECK(LDKGraphSyncError_LightningError_class != NULL);
10357         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
10358         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
10359 }
10360 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10361         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
10362         switch(obj->tag) {
10363                 case LDKGraphSyncError_DecodeError: {
10364                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
10365                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
10366                 }
10367                 case LDKGraphSyncError_LightningError: {
10368                         LDKLightningError lightning_error_var = obj->lightning_error;
10369                         int64_t lightning_error_ref = 0;
10370                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
10371                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
10372                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
10373                 }
10374                 default: abort();
10375         }
10376 }
10377 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10378 CHECK(owner->result_ok);
10379         return *owner->contents.result;
10380 }
10381 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10382         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10383         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
10384         return ret_conv;
10385 }
10386
10387 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
10388 CHECK(!owner->result_ok);
10389         return GraphSyncError_clone(&*owner->contents.err);
10390 }
10391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10392         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
10393         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
10394         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
10395         int64_t ret_ref = tag_ptr(ret_copy, true);
10396         return ret_ref;
10397 }
10398
10399 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
10400 CHECK(owner->result_ok);
10401         return CVec_u8Z_clone(&*owner->contents.result);
10402 }
10403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10404         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
10405         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
10406         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10407         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10408         CVec_u8Z_free(ret_var);
10409         return ret_arr;
10410 }
10411
10412 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
10413 CHECK(!owner->result_ok);
10414         return *owner->contents.err;
10415 }
10416 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10417         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
10418         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
10419         return ret_conv;
10420 }
10421
10422 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
10423 CHECK(owner->result_ok);
10424         return *owner->contents.result;
10425 }
10426 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10427         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
10428         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
10429         jobjectArray ret_arr = NULL;
10430         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
10431         ;
10432         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10433         for (size_t i = 0; i < ret_var.datalen; i++) {
10434                 LDKStr ret_conv_8_str = ret_var.data[i];
10435                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
10436                 ret_arr_ptr[i] = ret_conv_8_conv;
10437         }
10438         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10439         return ret_arr;
10440 }
10441
10442 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
10443 CHECK(!owner->result_ok);
10444         return *owner->contents.err;
10445 }
10446 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10447         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
10448         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
10449         return ret_conv;
10450 }
10451
10452 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
10453         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
10454         for (size_t i = 0; i < ret.datalen; i++) {
10455                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
10456         }
10457         return ret;
10458 }
10459 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
10460 CHECK(owner->result_ok);
10461         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
10462 }
10463 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10464         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
10465         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
10466         int64_tArray ret_arr = NULL;
10467         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10468         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10469         for (size_t o = 0; o < ret_var.datalen; o++) {
10470                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10471                 *ret_conv_40_conv = ret_var.data[o];
10472                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
10473         }
10474         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10475         FREE(ret_var.data);
10476         return ret_arr;
10477 }
10478
10479 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
10480 CHECK(!owner->result_ok);
10481         return *owner->contents.err;
10482 }
10483 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10484         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
10485         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
10486         return ret_conv;
10487 }
10488
10489 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
10490 CHECK(owner->result_ok);
10491         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
10492 }
10493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10494         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
10495         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10496         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
10497         return tag_ptr(ret_conv, true);
10498 }
10499
10500 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
10501 CHECK(!owner->result_ok);
10502         return *owner->contents.err;
10503 }
10504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10505         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
10506         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
10507         return ret_conv;
10508 }
10509
10510 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
10511 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
10512 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
10513 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
10514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
10515         LDKCOption_SecretKeyZ_Some_class =
10516                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
10517         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
10518         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
10519         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
10520         LDKCOption_SecretKeyZ_None_class =
10521                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
10522         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
10523         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
10524         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
10525 }
10526 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10527         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
10528         switch(obj->tag) {
10529                 case LDKCOption_SecretKeyZ_Some: {
10530                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
10531                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
10532                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
10533                 }
10534                 case LDKCOption_SecretKeyZ_None: {
10535                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
10536                 }
10537                 default: abort();
10538         }
10539 }
10540 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
10541         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
10542         ret.is_owned = false;
10543         return ret;
10544 }
10545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10546         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
10547         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
10548         int64_t ret_ref = 0;
10549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10551         return ret_ref;
10552 }
10553
10554 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
10555 CHECK(!owner->result_ok);
10556         return *owner->contents.err;
10557 }
10558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10559         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
10560         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
10561 }
10562
10563 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
10564         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
10565         for (size_t i = 0; i < ret.datalen; i++) {
10566                 ret.data[i] = Witness_clone(&orig->data[i]);
10567         }
10568         return ret;
10569 }
10570 static jclass LDKCOption_i64Z_Some_class = NULL;
10571 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
10572 static jclass LDKCOption_i64Z_None_class = NULL;
10573 static jmethodID LDKCOption_i64Z_None_meth = NULL;
10574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
10575         LDKCOption_i64Z_Some_class =
10576                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
10577         CHECK(LDKCOption_i64Z_Some_class != NULL);
10578         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
10579         CHECK(LDKCOption_i64Z_Some_meth != NULL);
10580         LDKCOption_i64Z_None_class =
10581                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
10582         CHECK(LDKCOption_i64Z_None_class != NULL);
10583         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
10584         CHECK(LDKCOption_i64Z_None_meth != NULL);
10585 }
10586 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10587         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
10588         switch(obj->tag) {
10589                 case LDKCOption_i64Z_Some: {
10590                         int64_t some_conv = obj->some;
10591                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
10592                 }
10593                 case LDKCOption_i64Z_None: {
10594                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
10595                 }
10596                 default: abort();
10597         }
10598 }
10599 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
10600 CHECK(owner->result_ok);
10601         return SocketAddress_clone(&*owner->contents.result);
10602 }
10603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10604         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
10605         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10606         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
10607         int64_t ret_ref = tag_ptr(ret_copy, true);
10608         return ret_ref;
10609 }
10610
10611 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
10612 CHECK(!owner->result_ok);
10613         return DecodeError_clone(&*owner->contents.err);
10614 }
10615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10616         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
10617         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10618         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
10619         int64_t ret_ref = tag_ptr(ret_copy, true);
10620         return ret_ref;
10621 }
10622
10623 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
10624 CHECK(owner->result_ok);
10625         return SocketAddress_clone(&*owner->contents.result);
10626 }
10627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10628         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
10629         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10630         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
10631         int64_t ret_ref = tag_ptr(ret_copy, true);
10632         return ret_ref;
10633 }
10634
10635 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
10636 CHECK(!owner->result_ok);
10637         return SocketAddressParseError_clone(&*owner->contents.err);
10638 }
10639 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10640         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
10641         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
10642         return ret_conv;
10643 }
10644
10645 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
10646         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
10647         for (size_t i = 0; i < ret.datalen; i++) {
10648                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
10649         }
10650         return ret;
10651 }
10652 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
10653         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
10654         for (size_t i = 0; i < ret.datalen; i++) {
10655                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
10656         }
10657         return ret;
10658 }
10659 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
10660         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
10661         for (size_t i = 0; i < ret.datalen; i++) {
10662                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
10663         }
10664         return ret;
10665 }
10666 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
10667         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
10668         for (size_t i = 0; i < ret.datalen; i++) {
10669                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
10670         }
10671         return ret;
10672 }
10673 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10674         LDKAcceptChannel ret = *owner->contents.result;
10675         ret.is_owned = false;
10676         return ret;
10677 }
10678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10679         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10680         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
10681         int64_t ret_ref = 0;
10682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10684         return ret_ref;
10685 }
10686
10687 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
10688 CHECK(!owner->result_ok);
10689         return DecodeError_clone(&*owner->contents.err);
10690 }
10691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10692         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10693         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10694         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
10695         int64_t ret_ref = tag_ptr(ret_copy, true);
10696         return ret_ref;
10697 }
10698
10699 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10700         LDKAcceptChannelV2 ret = *owner->contents.result;
10701         ret.is_owned = false;
10702         return ret;
10703 }
10704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10705         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10706         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
10707         int64_t ret_ref = 0;
10708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10710         return ret_ref;
10711 }
10712
10713 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10714 CHECK(!owner->result_ok);
10715         return DecodeError_clone(&*owner->contents.err);
10716 }
10717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10718         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10719         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10720         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
10721         int64_t ret_ref = tag_ptr(ret_copy, true);
10722         return ret_ref;
10723 }
10724
10725 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10726         LDKTxAddInput ret = *owner->contents.result;
10727         ret.is_owned = false;
10728         return ret;
10729 }
10730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10731         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10732         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
10733         int64_t ret_ref = 0;
10734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10736         return ret_ref;
10737 }
10738
10739 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10740 CHECK(!owner->result_ok);
10741         return DecodeError_clone(&*owner->contents.err);
10742 }
10743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10744         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10745         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10746         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
10747         int64_t ret_ref = tag_ptr(ret_copy, true);
10748         return ret_ref;
10749 }
10750
10751 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10752         LDKTxAddOutput ret = *owner->contents.result;
10753         ret.is_owned = false;
10754         return ret;
10755 }
10756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10757         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10758         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
10759         int64_t ret_ref = 0;
10760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10762         return ret_ref;
10763 }
10764
10765 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10766 CHECK(!owner->result_ok);
10767         return DecodeError_clone(&*owner->contents.err);
10768 }
10769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10770         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10771         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10772         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
10773         int64_t ret_ref = tag_ptr(ret_copy, true);
10774         return ret_ref;
10775 }
10776
10777 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10778         LDKTxRemoveInput ret = *owner->contents.result;
10779         ret.is_owned = false;
10780         return ret;
10781 }
10782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10783         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10784         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
10785         int64_t ret_ref = 0;
10786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10788         return ret_ref;
10789 }
10790
10791 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10792 CHECK(!owner->result_ok);
10793         return DecodeError_clone(&*owner->contents.err);
10794 }
10795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10796         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10797         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10798         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
10799         int64_t ret_ref = tag_ptr(ret_copy, true);
10800         return ret_ref;
10801 }
10802
10803 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10804         LDKTxRemoveOutput ret = *owner->contents.result;
10805         ret.is_owned = false;
10806         return ret;
10807 }
10808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10809         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10810         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
10811         int64_t ret_ref = 0;
10812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10814         return ret_ref;
10815 }
10816
10817 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10818 CHECK(!owner->result_ok);
10819         return DecodeError_clone(&*owner->contents.err);
10820 }
10821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10822         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10823         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10824         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
10825         int64_t ret_ref = tag_ptr(ret_copy, true);
10826         return ret_ref;
10827 }
10828
10829 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10830         LDKTxComplete ret = *owner->contents.result;
10831         ret.is_owned = false;
10832         return ret;
10833 }
10834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10835         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10836         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
10837         int64_t ret_ref = 0;
10838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10840         return ret_ref;
10841 }
10842
10843 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10844 CHECK(!owner->result_ok);
10845         return DecodeError_clone(&*owner->contents.err);
10846 }
10847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10848         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10849         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10850         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
10851         int64_t ret_ref = tag_ptr(ret_copy, true);
10852         return ret_ref;
10853 }
10854
10855 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10856         LDKTxSignatures ret = *owner->contents.result;
10857         ret.is_owned = false;
10858         return ret;
10859 }
10860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10861         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10862         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
10863         int64_t ret_ref = 0;
10864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10866         return ret_ref;
10867 }
10868
10869 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10870 CHECK(!owner->result_ok);
10871         return DecodeError_clone(&*owner->contents.err);
10872 }
10873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10874         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10875         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10876         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
10877         int64_t ret_ref = tag_ptr(ret_copy, true);
10878         return ret_ref;
10879 }
10880
10881 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10882         LDKTxInitRbf ret = *owner->contents.result;
10883         ret.is_owned = false;
10884         return ret;
10885 }
10886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10887         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10888         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
10889         int64_t ret_ref = 0;
10890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10892         return ret_ref;
10893 }
10894
10895 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10896 CHECK(!owner->result_ok);
10897         return DecodeError_clone(&*owner->contents.err);
10898 }
10899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10900         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10901         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10902         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
10903         int64_t ret_ref = tag_ptr(ret_copy, true);
10904         return ret_ref;
10905 }
10906
10907 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10908         LDKTxAckRbf ret = *owner->contents.result;
10909         ret.is_owned = false;
10910         return ret;
10911 }
10912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10913         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10914         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
10915         int64_t ret_ref = 0;
10916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10918         return ret_ref;
10919 }
10920
10921 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10922 CHECK(!owner->result_ok);
10923         return DecodeError_clone(&*owner->contents.err);
10924 }
10925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10926         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10927         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10928         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
10929         int64_t ret_ref = tag_ptr(ret_copy, true);
10930         return ret_ref;
10931 }
10932
10933 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10934         LDKTxAbort ret = *owner->contents.result;
10935         ret.is_owned = false;
10936         return ret;
10937 }
10938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10939         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10940         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
10941         int64_t ret_ref = 0;
10942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10944         return ret_ref;
10945 }
10946
10947 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10948 CHECK(!owner->result_ok);
10949         return DecodeError_clone(&*owner->contents.err);
10950 }
10951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10952         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10953         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10954         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
10955         int64_t ret_ref = tag_ptr(ret_copy, true);
10956         return ret_ref;
10957 }
10958
10959 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10960         LDKAnnouncementSignatures ret = *owner->contents.result;
10961         ret.is_owned = false;
10962         return ret;
10963 }
10964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10965         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10966         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
10967         int64_t ret_ref = 0;
10968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10970         return ret_ref;
10971 }
10972
10973 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10974 CHECK(!owner->result_ok);
10975         return DecodeError_clone(&*owner->contents.err);
10976 }
10977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10978         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10979         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10980         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
10981         int64_t ret_ref = tag_ptr(ret_copy, true);
10982         return ret_ref;
10983 }
10984
10985 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10986         LDKChannelReestablish ret = *owner->contents.result;
10987         ret.is_owned = false;
10988         return ret;
10989 }
10990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10991         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10992         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
10993         int64_t ret_ref = 0;
10994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10996         return ret_ref;
10997 }
10998
10999 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
11000 CHECK(!owner->result_ok);
11001         return DecodeError_clone(&*owner->contents.err);
11002 }
11003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11004         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
11005         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11006         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
11007         int64_t ret_ref = tag_ptr(ret_copy, true);
11008         return ret_ref;
11009 }
11010
11011 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
11012         LDKClosingSigned ret = *owner->contents.result;
11013         ret.is_owned = false;
11014         return ret;
11015 }
11016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11017         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
11018         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
11019         int64_t ret_ref = 0;
11020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11022         return ret_ref;
11023 }
11024
11025 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
11026 CHECK(!owner->result_ok);
11027         return DecodeError_clone(&*owner->contents.err);
11028 }
11029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11030         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
11031         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11032         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
11033         int64_t ret_ref = tag_ptr(ret_copy, true);
11034         return ret_ref;
11035 }
11036
11037 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
11038         LDKClosingSignedFeeRange ret = *owner->contents.result;
11039         ret.is_owned = false;
11040         return ret;
11041 }
11042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11043         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
11044         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
11045         int64_t ret_ref = 0;
11046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11048         return ret_ref;
11049 }
11050
11051 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
11052 CHECK(!owner->result_ok);
11053         return DecodeError_clone(&*owner->contents.err);
11054 }
11055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11056         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
11057         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11058         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
11059         int64_t ret_ref = tag_ptr(ret_copy, true);
11060         return ret_ref;
11061 }
11062
11063 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
11064         LDKCommitmentSigned ret = *owner->contents.result;
11065         ret.is_owned = false;
11066         return ret;
11067 }
11068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11069         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
11070         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
11071         int64_t ret_ref = 0;
11072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11074         return ret_ref;
11075 }
11076
11077 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
11078 CHECK(!owner->result_ok);
11079         return DecodeError_clone(&*owner->contents.err);
11080 }
11081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11082         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
11083         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11084         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
11085         int64_t ret_ref = tag_ptr(ret_copy, true);
11086         return ret_ref;
11087 }
11088
11089 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
11090         LDKFundingCreated ret = *owner->contents.result;
11091         ret.is_owned = false;
11092         return ret;
11093 }
11094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11095         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
11096         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
11097         int64_t ret_ref = 0;
11098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11100         return ret_ref;
11101 }
11102
11103 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
11104 CHECK(!owner->result_ok);
11105         return DecodeError_clone(&*owner->contents.err);
11106 }
11107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11108         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
11109         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11110         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
11111         int64_t ret_ref = tag_ptr(ret_copy, true);
11112         return ret_ref;
11113 }
11114
11115 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
11116         LDKFundingSigned ret = *owner->contents.result;
11117         ret.is_owned = false;
11118         return ret;
11119 }
11120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11121         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
11122         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
11123         int64_t ret_ref = 0;
11124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11126         return ret_ref;
11127 }
11128
11129 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
11130 CHECK(!owner->result_ok);
11131         return DecodeError_clone(&*owner->contents.err);
11132 }
11133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11134         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
11135         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11136         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
11137         int64_t ret_ref = tag_ptr(ret_copy, true);
11138         return ret_ref;
11139 }
11140
11141 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
11142         LDKChannelReady ret = *owner->contents.result;
11143         ret.is_owned = false;
11144         return ret;
11145 }
11146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11147         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
11148         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
11149         int64_t ret_ref = 0;
11150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11152         return ret_ref;
11153 }
11154
11155 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
11156 CHECK(!owner->result_ok);
11157         return DecodeError_clone(&*owner->contents.err);
11158 }
11159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11160         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
11161         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11162         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
11163         int64_t ret_ref = tag_ptr(ret_copy, true);
11164         return ret_ref;
11165 }
11166
11167 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
11168         LDKInit ret = *owner->contents.result;
11169         ret.is_owned = false;
11170         return ret;
11171 }
11172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11173         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
11174         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
11175         int64_t ret_ref = 0;
11176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11178         return ret_ref;
11179 }
11180
11181 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
11182 CHECK(!owner->result_ok);
11183         return DecodeError_clone(&*owner->contents.err);
11184 }
11185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11186         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
11187         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11188         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
11189         int64_t ret_ref = tag_ptr(ret_copy, true);
11190         return ret_ref;
11191 }
11192
11193 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
11194         LDKOpenChannel ret = *owner->contents.result;
11195         ret.is_owned = false;
11196         return ret;
11197 }
11198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11199         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
11200         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
11201         int64_t ret_ref = 0;
11202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11204         return ret_ref;
11205 }
11206
11207 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
11208 CHECK(!owner->result_ok);
11209         return DecodeError_clone(&*owner->contents.err);
11210 }
11211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11212         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
11213         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11214         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
11215         int64_t ret_ref = tag_ptr(ret_copy, true);
11216         return ret_ref;
11217 }
11218
11219 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
11220         LDKOpenChannelV2 ret = *owner->contents.result;
11221         ret.is_owned = false;
11222         return ret;
11223 }
11224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11225         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
11226         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
11227         int64_t ret_ref = 0;
11228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11230         return ret_ref;
11231 }
11232
11233 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
11234 CHECK(!owner->result_ok);
11235         return DecodeError_clone(&*owner->contents.err);
11236 }
11237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11238         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
11239         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11240         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
11241         int64_t ret_ref = tag_ptr(ret_copy, true);
11242         return ret_ref;
11243 }
11244
11245 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
11246         LDKRevokeAndACK ret = *owner->contents.result;
11247         ret.is_owned = false;
11248         return ret;
11249 }
11250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11251         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
11252         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(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 LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
11260 CHECK(!owner->result_ok);
11261         return DecodeError_clone(&*owner->contents.err);
11262 }
11263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11264         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
11265         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11266         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
11267         int64_t ret_ref = tag_ptr(ret_copy, true);
11268         return ret_ref;
11269 }
11270
11271 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
11272         LDKShutdown ret = *owner->contents.result;
11273         ret.is_owned = false;
11274         return ret;
11275 }
11276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11277         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
11278         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
11279         int64_t ret_ref = 0;
11280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11282         return ret_ref;
11283 }
11284
11285 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
11286 CHECK(!owner->result_ok);
11287         return DecodeError_clone(&*owner->contents.err);
11288 }
11289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11290         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
11291         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11292         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
11293         int64_t ret_ref = tag_ptr(ret_copy, true);
11294         return ret_ref;
11295 }
11296
11297 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
11298         LDKUpdateFailHTLC ret = *owner->contents.result;
11299         ret.is_owned = false;
11300         return ret;
11301 }
11302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11303         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
11304         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
11305         int64_t ret_ref = 0;
11306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11308         return ret_ref;
11309 }
11310
11311 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
11312 CHECK(!owner->result_ok);
11313         return DecodeError_clone(&*owner->contents.err);
11314 }
11315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11316         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
11317         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11318         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
11319         int64_t ret_ref = tag_ptr(ret_copy, true);
11320         return ret_ref;
11321 }
11322
11323 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
11324         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
11325         ret.is_owned = false;
11326         return ret;
11327 }
11328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11329         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
11330         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
11331         int64_t ret_ref = 0;
11332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11334         return ret_ref;
11335 }
11336
11337 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
11338 CHECK(!owner->result_ok);
11339         return DecodeError_clone(&*owner->contents.err);
11340 }
11341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11342         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
11343         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11344         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
11345         int64_t ret_ref = tag_ptr(ret_copy, true);
11346         return ret_ref;
11347 }
11348
11349 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
11350         LDKUpdateFee ret = *owner->contents.result;
11351         ret.is_owned = false;
11352         return ret;
11353 }
11354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11355         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
11356         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
11357         int64_t ret_ref = 0;
11358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11360         return ret_ref;
11361 }
11362
11363 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
11364 CHECK(!owner->result_ok);
11365         return DecodeError_clone(&*owner->contents.err);
11366 }
11367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11368         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
11369         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11370         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
11371         int64_t ret_ref = tag_ptr(ret_copy, true);
11372         return ret_ref;
11373 }
11374
11375 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
11376         LDKUpdateFulfillHTLC ret = *owner->contents.result;
11377         ret.is_owned = false;
11378         return ret;
11379 }
11380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11381         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
11382         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
11383         int64_t ret_ref = 0;
11384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11386         return ret_ref;
11387 }
11388
11389 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
11390 CHECK(!owner->result_ok);
11391         return DecodeError_clone(&*owner->contents.err);
11392 }
11393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11394         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
11395         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11396         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
11397         int64_t ret_ref = tag_ptr(ret_copy, true);
11398         return ret_ref;
11399 }
11400
11401 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
11402         LDKUpdateAddHTLC ret = *owner->contents.result;
11403         ret.is_owned = false;
11404         return ret;
11405 }
11406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11407         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
11408         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
11409         int64_t ret_ref = 0;
11410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11412         return ret_ref;
11413 }
11414
11415 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
11416 CHECK(!owner->result_ok);
11417         return DecodeError_clone(&*owner->contents.err);
11418 }
11419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11420         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
11421         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11422         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
11423         int64_t ret_ref = tag_ptr(ret_copy, true);
11424         return ret_ref;
11425 }
11426
11427 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
11428         LDKOnionMessage ret = *owner->contents.result;
11429         ret.is_owned = false;
11430         return ret;
11431 }
11432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11433         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
11434         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
11435         int64_t ret_ref = 0;
11436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11438         return ret_ref;
11439 }
11440
11441 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
11442 CHECK(!owner->result_ok);
11443         return DecodeError_clone(&*owner->contents.err);
11444 }
11445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11446         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
11447         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11448         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
11449         int64_t ret_ref = tag_ptr(ret_copy, true);
11450         return ret_ref;
11451 }
11452
11453 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11454         LDKPing ret = *owner->contents.result;
11455         ret.is_owned = false;
11456         return ret;
11457 }
11458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11459         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11460         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
11461         int64_t ret_ref = 0;
11462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11464         return ret_ref;
11465 }
11466
11467 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
11468 CHECK(!owner->result_ok);
11469         return DecodeError_clone(&*owner->contents.err);
11470 }
11471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11472         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
11473         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11474         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
11475         int64_t ret_ref = tag_ptr(ret_copy, true);
11476         return ret_ref;
11477 }
11478
11479 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11480         LDKPong ret = *owner->contents.result;
11481         ret.is_owned = false;
11482         return ret;
11483 }
11484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11485         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11486         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
11487         int64_t ret_ref = 0;
11488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11490         return ret_ref;
11491 }
11492
11493 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
11494 CHECK(!owner->result_ok);
11495         return DecodeError_clone(&*owner->contents.err);
11496 }
11497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11498         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
11499         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11500         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
11501         int64_t ret_ref = tag_ptr(ret_copy, true);
11502         return ret_ref;
11503 }
11504
11505 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11506         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
11507         ret.is_owned = false;
11508         return ret;
11509 }
11510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11511         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11512         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11513         int64_t ret_ref = 0;
11514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11516         return ret_ref;
11517 }
11518
11519 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11520 CHECK(!owner->result_ok);
11521         return DecodeError_clone(&*owner->contents.err);
11522 }
11523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11524         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11525         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11526         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11527         int64_t ret_ref = tag_ptr(ret_copy, true);
11528         return ret_ref;
11529 }
11530
11531 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11532         LDKChannelAnnouncement ret = *owner->contents.result;
11533         ret.is_owned = false;
11534         return ret;
11535 }
11536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11537         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11538         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
11539         int64_t ret_ref = 0;
11540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11542         return ret_ref;
11543 }
11544
11545 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11546 CHECK(!owner->result_ok);
11547         return DecodeError_clone(&*owner->contents.err);
11548 }
11549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11550         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
11551         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11552         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
11553         int64_t ret_ref = tag_ptr(ret_copy, true);
11554         return ret_ref;
11555 }
11556
11557 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11558         LDKUnsignedChannelUpdate ret = *owner->contents.result;
11559         ret.is_owned = false;
11560         return ret;
11561 }
11562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11563         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11564         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11565         int64_t ret_ref = 0;
11566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11568         return ret_ref;
11569 }
11570
11571 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11572 CHECK(!owner->result_ok);
11573         return DecodeError_clone(&*owner->contents.err);
11574 }
11575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11576         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11577         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11578         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
11579         int64_t ret_ref = tag_ptr(ret_copy, true);
11580         return ret_ref;
11581 }
11582
11583 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11584         LDKChannelUpdate ret = *owner->contents.result;
11585         ret.is_owned = false;
11586         return ret;
11587 }
11588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11589         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11590         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
11591         int64_t ret_ref = 0;
11592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11594         return ret_ref;
11595 }
11596
11597 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
11598 CHECK(!owner->result_ok);
11599         return DecodeError_clone(&*owner->contents.err);
11600 }
11601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11602         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
11603         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11604         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
11605         int64_t ret_ref = tag_ptr(ret_copy, true);
11606         return ret_ref;
11607 }
11608
11609 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11610         LDKErrorMessage ret = *owner->contents.result;
11611         ret.is_owned = false;
11612         return ret;
11613 }
11614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11615         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11616         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
11617         int64_t ret_ref = 0;
11618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11620         return ret_ref;
11621 }
11622
11623 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
11624 CHECK(!owner->result_ok);
11625         return DecodeError_clone(&*owner->contents.err);
11626 }
11627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11628         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
11629         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11630         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
11631         int64_t ret_ref = tag_ptr(ret_copy, true);
11632         return ret_ref;
11633 }
11634
11635 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11636         LDKWarningMessage ret = *owner->contents.result;
11637         ret.is_owned = false;
11638         return ret;
11639 }
11640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11641         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11642         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
11643         int64_t ret_ref = 0;
11644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11646         return ret_ref;
11647 }
11648
11649 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
11650 CHECK(!owner->result_ok);
11651         return DecodeError_clone(&*owner->contents.err);
11652 }
11653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11654         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
11655         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11656         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
11657         int64_t ret_ref = tag_ptr(ret_copy, true);
11658         return ret_ref;
11659 }
11660
11661 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11662         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
11663         ret.is_owned = false;
11664         return ret;
11665 }
11666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11667         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11668         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11669         int64_t ret_ref = 0;
11670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11672         return ret_ref;
11673 }
11674
11675 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11676 CHECK(!owner->result_ok);
11677         return DecodeError_clone(&*owner->contents.err);
11678 }
11679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11680         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11681         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11682         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11683         int64_t ret_ref = tag_ptr(ret_copy, true);
11684         return ret_ref;
11685 }
11686
11687 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11688         LDKNodeAnnouncement ret = *owner->contents.result;
11689         ret.is_owned = false;
11690         return ret;
11691 }
11692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11693         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11694         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11695         int64_t ret_ref = 0;
11696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11698         return ret_ref;
11699 }
11700
11701 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11702 CHECK(!owner->result_ok);
11703         return DecodeError_clone(&*owner->contents.err);
11704 }
11705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11706         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11707         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11708         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11709         int64_t ret_ref = tag_ptr(ret_copy, true);
11710         return ret_ref;
11711 }
11712
11713 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11714         LDKQueryShortChannelIds ret = *owner->contents.result;
11715         ret.is_owned = false;
11716         return ret;
11717 }
11718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11719         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11720         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
11721         int64_t ret_ref = 0;
11722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11724         return ret_ref;
11725 }
11726
11727 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11728 CHECK(!owner->result_ok);
11729         return DecodeError_clone(&*owner->contents.err);
11730 }
11731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11732         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11733         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11734         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
11735         int64_t ret_ref = tag_ptr(ret_copy, true);
11736         return ret_ref;
11737 }
11738
11739 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11740         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
11741         ret.is_owned = false;
11742         return ret;
11743 }
11744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11745         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11746         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
11747         int64_t ret_ref = 0;
11748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11750         return ret_ref;
11751 }
11752
11753 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11754 CHECK(!owner->result_ok);
11755         return DecodeError_clone(&*owner->contents.err);
11756 }
11757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11758         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11759         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11760         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
11761         int64_t ret_ref = tag_ptr(ret_copy, true);
11762         return ret_ref;
11763 }
11764
11765 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11766         LDKQueryChannelRange ret = *owner->contents.result;
11767         ret.is_owned = false;
11768         return ret;
11769 }
11770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11771         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11772         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
11773         int64_t ret_ref = 0;
11774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11776         return ret_ref;
11777 }
11778
11779 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11780 CHECK(!owner->result_ok);
11781         return DecodeError_clone(&*owner->contents.err);
11782 }
11783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11784         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11785         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11786         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
11787         int64_t ret_ref = tag_ptr(ret_copy, true);
11788         return ret_ref;
11789 }
11790
11791 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11792         LDKReplyChannelRange ret = *owner->contents.result;
11793         ret.is_owned = false;
11794         return ret;
11795 }
11796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11797         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11798         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
11799         int64_t ret_ref = 0;
11800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11802         return ret_ref;
11803 }
11804
11805 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11806 CHECK(!owner->result_ok);
11807         return DecodeError_clone(&*owner->contents.err);
11808 }
11809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11810         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11811         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11812         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
11813         int64_t ret_ref = tag_ptr(ret_copy, true);
11814         return ret_ref;
11815 }
11816
11817 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11818         LDKGossipTimestampFilter ret = *owner->contents.result;
11819         ret.is_owned = false;
11820         return ret;
11821 }
11822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11823         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11824         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
11825         int64_t ret_ref = 0;
11826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11828         return ret_ref;
11829 }
11830
11831 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11832 CHECK(!owner->result_ok);
11833         return DecodeError_clone(&*owner->contents.err);
11834 }
11835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11836         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11837         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11838         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
11839         int64_t ret_ref = tag_ptr(ret_copy, true);
11840         return ret_ref;
11841 }
11842
11843 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
11844         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
11845         for (size_t i = 0; i < ret.datalen; i++) {
11846                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
11847         }
11848         return ret;
11849 }
11850 static jclass LDKSignOrCreationError_SignError_class = NULL;
11851 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
11852 static jclass LDKSignOrCreationError_CreationError_class = NULL;
11853 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
11854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
11855         LDKSignOrCreationError_SignError_class =
11856                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
11857         CHECK(LDKSignOrCreationError_SignError_class != NULL);
11858         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
11859         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
11860         LDKSignOrCreationError_CreationError_class =
11861                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
11862         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
11863         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
11864         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
11865 }
11866 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11867         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
11868         switch(obj->tag) {
11869                 case LDKSignOrCreationError_SignError: {
11870                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
11871                 }
11872                 case LDKSignOrCreationError_CreationError: {
11873                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
11874                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
11875                 }
11876                 default: abort();
11877         }
11878 }
11879 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11880         LDKBolt11Invoice ret = *owner->contents.result;
11881         ret.is_owned = false;
11882         return ret;
11883 }
11884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11885         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11886         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
11887         int64_t ret_ref = 0;
11888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11890         return ret_ref;
11891 }
11892
11893 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11894 CHECK(!owner->result_ok);
11895         return SignOrCreationError_clone(&*owner->contents.err);
11896 }
11897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11898         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11899         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
11900         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
11901         int64_t ret_ref = tag_ptr(ret_copy, true);
11902         return ret_ref;
11903 }
11904
11905 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
11906         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
11907         for (size_t i = 0; i < ret.datalen; i++) {
11908                 ret.data[i] = Future_clone(&orig->data[i]);
11909         }
11910         return ret;
11911 }
11912 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11913 CHECK(owner->result_ok);
11914         return OffersMessage_clone(&*owner->contents.result);
11915 }
11916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11917         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11918         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
11919         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
11920         int64_t ret_ref = tag_ptr(ret_copy, true);
11921         return ret_ref;
11922 }
11923
11924 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11925 CHECK(!owner->result_ok);
11926         return DecodeError_clone(&*owner->contents.err);
11927 }
11928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11929         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11930         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11931         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
11932         int64_t ret_ref = tag_ptr(ret_copy, true);
11933         return ret_ref;
11934 }
11935
11936 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
11937 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
11938 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
11939 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
11940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
11941         LDKCOption_HTLCClaimZ_Some_class =
11942                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
11943         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
11944         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
11945         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
11946         LDKCOption_HTLCClaimZ_None_class =
11947                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
11948         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
11949         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
11950         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
11951 }
11952 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11953         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
11954         switch(obj->tag) {
11955                 case LDKCOption_HTLCClaimZ_Some: {
11956                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
11957                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
11958                 }
11959                 case LDKCOption_HTLCClaimZ_None: {
11960                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
11961                 }
11962                 default: abort();
11963         }
11964 }
11965 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11966         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
11967         ret.is_owned = false;
11968         return ret;
11969 }
11970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11971         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11972         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
11973         int64_t ret_ref = 0;
11974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11976         return ret_ref;
11977 }
11978
11979 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11980 CHECK(!owner->result_ok);
11981         return DecodeError_clone(&*owner->contents.err);
11982 }
11983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11984         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11986         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
11987         int64_t ret_ref = tag_ptr(ret_copy, true);
11988         return ret_ref;
11989 }
11990
11991 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11992         LDKTxCreationKeys ret = *owner->contents.result;
11993         ret.is_owned = false;
11994         return ret;
11995 }
11996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11997         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11998         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
11999         int64_t ret_ref = 0;
12000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12002         return ret_ref;
12003 }
12004
12005 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
12006 CHECK(!owner->result_ok);
12007         return DecodeError_clone(&*owner->contents.err);
12008 }
12009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12010         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
12011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12012         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
12013         int64_t ret_ref = tag_ptr(ret_copy, true);
12014         return ret_ref;
12015 }
12016
12017 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
12018         LDKChannelPublicKeys ret = *owner->contents.result;
12019         ret.is_owned = false;
12020         return ret;
12021 }
12022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12023         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
12024         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
12025         int64_t ret_ref = 0;
12026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12028         return ret_ref;
12029 }
12030
12031 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
12032 CHECK(!owner->result_ok);
12033         return DecodeError_clone(&*owner->contents.err);
12034 }
12035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12036         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
12037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12038         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
12039         int64_t ret_ref = tag_ptr(ret_copy, true);
12040         return ret_ref;
12041 }
12042
12043 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
12044         LDKHTLCOutputInCommitment ret = *owner->contents.result;
12045         ret.is_owned = false;
12046         return ret;
12047 }
12048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12049         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
12050         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
12051         int64_t ret_ref = 0;
12052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12054         return ret_ref;
12055 }
12056
12057 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
12058 CHECK(!owner->result_ok);
12059         return DecodeError_clone(&*owner->contents.err);
12060 }
12061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12062         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
12063         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12064         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
12065         int64_t ret_ref = tag_ptr(ret_copy, true);
12066         return ret_ref;
12067 }
12068
12069 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
12070         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
12071         ret.is_owned = false;
12072         return ret;
12073 }
12074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12075         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
12076         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
12077         int64_t ret_ref = 0;
12078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12080         return ret_ref;
12081 }
12082
12083 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
12084 CHECK(!owner->result_ok);
12085         return DecodeError_clone(&*owner->contents.err);
12086 }
12087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12088         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
12089         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12090         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
12091         int64_t ret_ref = tag_ptr(ret_copy, true);
12092         return ret_ref;
12093 }
12094
12095 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
12096         LDKChannelTransactionParameters ret = *owner->contents.result;
12097         ret.is_owned = false;
12098         return ret;
12099 }
12100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12101         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
12102         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
12103         int64_t ret_ref = 0;
12104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12106         return ret_ref;
12107 }
12108
12109 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
12110 CHECK(!owner->result_ok);
12111         return DecodeError_clone(&*owner->contents.err);
12112 }
12113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12114         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
12115         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12116         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
12117         int64_t ret_ref = tag_ptr(ret_copy, true);
12118         return ret_ref;
12119 }
12120
12121 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12122         LDKHolderCommitmentTransaction ret = *owner->contents.result;
12123         ret.is_owned = false;
12124         return ret;
12125 }
12126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12127         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12128         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
12129         int64_t ret_ref = 0;
12130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12132         return ret_ref;
12133 }
12134
12135 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12136 CHECK(!owner->result_ok);
12137         return DecodeError_clone(&*owner->contents.err);
12138 }
12139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12140         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12141         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12142         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
12143         int64_t ret_ref = tag_ptr(ret_copy, true);
12144         return ret_ref;
12145 }
12146
12147 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12148         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
12149         ret.is_owned = false;
12150         return ret;
12151 }
12152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12153         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12154         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
12155         int64_t ret_ref = 0;
12156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12158         return ret_ref;
12159 }
12160
12161 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12162 CHECK(!owner->result_ok);
12163         return DecodeError_clone(&*owner->contents.err);
12164 }
12165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12166         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12167         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12168         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
12169         int64_t ret_ref = tag_ptr(ret_copy, true);
12170         return ret_ref;
12171 }
12172
12173 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
12174         LDKTrustedClosingTransaction ret = *owner->contents.result;
12175         ret.is_owned = false;
12176         return ret;
12177 }
12178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12179         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
12180         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
12181         int64_t ret_ref = 0;
12182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12184         return ret_ref;
12185 }
12186
12187 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
12188 CHECK(!owner->result_ok);
12189         return *owner->contents.err;
12190 }
12191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12192         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
12193         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
12194 }
12195
12196 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12197         LDKCommitmentTransaction ret = *owner->contents.result;
12198         ret.is_owned = false;
12199         return ret;
12200 }
12201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12202         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12203         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
12204         int64_t ret_ref = 0;
12205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12207         return ret_ref;
12208 }
12209
12210 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
12211 CHECK(!owner->result_ok);
12212         return DecodeError_clone(&*owner->contents.err);
12213 }
12214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12215         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
12216         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12217         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
12218         int64_t ret_ref = tag_ptr(ret_copy, true);
12219         return ret_ref;
12220 }
12221
12222 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
12223         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
12224         ret.is_owned = false;
12225         return ret;
12226 }
12227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12228         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
12229         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
12230         int64_t ret_ref = 0;
12231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12233         return ret_ref;
12234 }
12235
12236 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
12237 CHECK(!owner->result_ok);
12238         return *owner->contents.err;
12239 }
12240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12241         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
12242         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
12243 }
12244
12245 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
12246 CHECK(owner->result_ok);
12247         return *owner->contents.result;
12248 }
12249 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12250         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
12251         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
12252         jobjectArray ret_arr = NULL;
12253         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
12254         ;
12255         for (size_t i = 0; i < ret_var.datalen; i++) {
12256                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
12257                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
12258                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
12259         }
12260         
12261         return ret_arr;
12262 }
12263
12264 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
12265 CHECK(!owner->result_ok);
12266         return *owner->contents.err;
12267 }
12268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12269         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
12270         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
12271 }
12272
12273 static jclass LDKCOption_usizeZ_Some_class = NULL;
12274 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
12275 static jclass LDKCOption_usizeZ_None_class = NULL;
12276 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
12277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
12278         LDKCOption_usizeZ_Some_class =
12279                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
12280         CHECK(LDKCOption_usizeZ_Some_class != NULL);
12281         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
12282         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
12283         LDKCOption_usizeZ_None_class =
12284                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
12285         CHECK(LDKCOption_usizeZ_None_class != NULL);
12286         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
12287         CHECK(LDKCOption_usizeZ_None_meth != NULL);
12288 }
12289 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12290         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
12291         switch(obj->tag) {
12292                 case LDKCOption_usizeZ_Some: {
12293                         int64_t some_conv = obj->some;
12294                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
12295                 }
12296                 case LDKCOption_usizeZ_None: {
12297                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
12298                 }
12299                 default: abort();
12300         }
12301 }
12302 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
12303         LDKShutdownScript ret = *owner->contents.result;
12304         ret.is_owned = false;
12305         return ret;
12306 }
12307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12308         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
12309         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
12310         int64_t ret_ref = 0;
12311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12313         return ret_ref;
12314 }
12315
12316 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
12317 CHECK(!owner->result_ok);
12318         return DecodeError_clone(&*owner->contents.err);
12319 }
12320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12321         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
12322         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12323         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
12324         int64_t ret_ref = tag_ptr(ret_copy, true);
12325         return ret_ref;
12326 }
12327
12328 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
12329         LDKShutdownScript ret = *owner->contents.result;
12330         ret.is_owned = false;
12331         return ret;
12332 }
12333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12334         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
12335         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
12336         int64_t ret_ref = 0;
12337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12339         return ret_ref;
12340 }
12341
12342 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
12343         LDKInvalidShutdownScript ret = *owner->contents.err;
12344         ret.is_owned = false;
12345         return ret;
12346 }
12347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12348         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
12349         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
12350         int64_t ret_ref = 0;
12351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12353         return ret_ref;
12354 }
12355
12356 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
12357 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
12358 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
12359 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
12360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
12361         LDKPaymentPurpose_InvoicePayment_class =
12362                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
12363         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
12364         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "(J[B)V");
12365         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
12366         LDKPaymentPurpose_SpontaneousPayment_class =
12367                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
12368         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
12369         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
12370         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
12371 }
12372 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12373         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
12374         switch(obj->tag) {
12375                 case LDKPaymentPurpose_InvoicePayment: {
12376                         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
12377                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
12378                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
12379                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
12380                 }
12381                 case LDKPaymentPurpose_SpontaneousPayment: {
12382                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
12383                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
12384                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
12385                 }
12386                 default: abort();
12387         }
12388 }
12389 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
12390 CHECK(owner->result_ok);
12391         return PaymentPurpose_clone(&*owner->contents.result);
12392 }
12393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12394         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
12395         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
12396         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
12397         int64_t ret_ref = tag_ptr(ret_copy, true);
12398         return ret_ref;
12399 }
12400
12401 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
12402 CHECK(!owner->result_ok);
12403         return DecodeError_clone(&*owner->contents.err);
12404 }
12405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12406         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
12407         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12408         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
12409         int64_t ret_ref = tag_ptr(ret_copy, true);
12410         return ret_ref;
12411 }
12412
12413 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
12414         LDKClaimedHTLC ret = *owner->contents.result;
12415         ret.is_owned = false;
12416         return ret;
12417 }
12418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12419         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
12420         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
12421         int64_t ret_ref = 0;
12422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12424         return ret_ref;
12425 }
12426
12427 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
12428 CHECK(!owner->result_ok);
12429         return DecodeError_clone(&*owner->contents.err);
12430 }
12431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12432         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
12433         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12434         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
12435         int64_t ret_ref = tag_ptr(ret_copy, true);
12436         return ret_ref;
12437 }
12438
12439 static jclass LDKPathFailure_InitialSend_class = NULL;
12440 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
12441 static jclass LDKPathFailure_OnPath_class = NULL;
12442 static jmethodID LDKPathFailure_OnPath_meth = NULL;
12443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
12444         LDKPathFailure_InitialSend_class =
12445                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
12446         CHECK(LDKPathFailure_InitialSend_class != NULL);
12447         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
12448         CHECK(LDKPathFailure_InitialSend_meth != NULL);
12449         LDKPathFailure_OnPath_class =
12450                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
12451         CHECK(LDKPathFailure_OnPath_class != NULL);
12452         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
12453         CHECK(LDKPathFailure_OnPath_meth != NULL);
12454 }
12455 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12456         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
12457         switch(obj->tag) {
12458                 case LDKPathFailure_InitialSend: {
12459                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
12460                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
12461                 }
12462                 case LDKPathFailure_OnPath: {
12463                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
12464                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
12465                 }
12466                 default: abort();
12467         }
12468 }
12469 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
12470 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
12471 static jclass LDKCOption_PathFailureZ_None_class = NULL;
12472 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
12473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
12474         LDKCOption_PathFailureZ_Some_class =
12475                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
12476         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
12477         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
12478         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
12479         LDKCOption_PathFailureZ_None_class =
12480                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
12481         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
12482         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
12483         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
12484 }
12485 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12486         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
12487         switch(obj->tag) {
12488                 case LDKCOption_PathFailureZ_Some: {
12489                         int64_t some_ref = tag_ptr(&obj->some, false);
12490                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
12491                 }
12492                 case LDKCOption_PathFailureZ_None: {
12493                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
12494                 }
12495                 default: abort();
12496         }
12497 }
12498 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
12499 CHECK(owner->result_ok);
12500         return COption_PathFailureZ_clone(&*owner->contents.result);
12501 }
12502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12503         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
12504         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
12505         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
12506         int64_t ret_ref = tag_ptr(ret_copy, true);
12507         return ret_ref;
12508 }
12509
12510 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
12511 CHECK(!owner->result_ok);
12512         return DecodeError_clone(&*owner->contents.err);
12513 }
12514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12515         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
12516         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12517         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
12518         int64_t ret_ref = tag_ptr(ret_copy, true);
12519         return ret_ref;
12520 }
12521
12522 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
12523 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
12524 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
12525 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
12526 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
12527 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
12528 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
12529 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
12530 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
12531 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
12532 static jclass LDKClosureReason_ProcessingError_class = NULL;
12533 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
12534 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
12535 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
12536 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
12537 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
12538 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
12539 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
12540 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
12541 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
12542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
12543         LDKClosureReason_CounterpartyForceClosed_class =
12544                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
12545         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
12546         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
12547         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
12548         LDKClosureReason_HolderForceClosed_class =
12549                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
12550         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
12551         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
12552         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
12553         LDKClosureReason_CooperativeClosure_class =
12554                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
12555         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
12556         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
12557         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
12558         LDKClosureReason_CommitmentTxConfirmed_class =
12559                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
12560         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
12561         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
12562         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
12563         LDKClosureReason_FundingTimedOut_class =
12564                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
12565         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
12566         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
12567         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
12568         LDKClosureReason_ProcessingError_class =
12569                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
12570         CHECK(LDKClosureReason_ProcessingError_class != NULL);
12571         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
12572         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
12573         LDKClosureReason_DisconnectedPeer_class =
12574                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
12575         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
12576         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
12577         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
12578         LDKClosureReason_OutdatedChannelManager_class =
12579                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
12580         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
12581         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
12582         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
12583         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
12584                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
12585         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
12586         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
12587         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
12588         LDKClosureReason_FundingBatchClosure_class =
12589                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
12590         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
12591         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
12592         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
12593 }
12594 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12595         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
12596         switch(obj->tag) {
12597                 case LDKClosureReason_CounterpartyForceClosed: {
12598                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
12599                         int64_t peer_msg_ref = 0;
12600                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
12601                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
12602                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
12603                 }
12604                 case LDKClosureReason_HolderForceClosed: {
12605                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
12606                 }
12607                 case LDKClosureReason_CooperativeClosure: {
12608                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
12609                 }
12610                 case LDKClosureReason_CommitmentTxConfirmed: {
12611                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
12612                 }
12613                 case LDKClosureReason_FundingTimedOut: {
12614                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
12615                 }
12616                 case LDKClosureReason_ProcessingError: {
12617                         LDKStr err_str = obj->processing_error.err;
12618                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
12619                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
12620                 }
12621                 case LDKClosureReason_DisconnectedPeer: {
12622                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
12623                 }
12624                 case LDKClosureReason_OutdatedChannelManager: {
12625                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
12626                 }
12627                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
12628                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
12629                 }
12630                 case LDKClosureReason_FundingBatchClosure: {
12631                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
12632                 }
12633                 default: abort();
12634         }
12635 }
12636 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
12637 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
12638 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
12639 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
12640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
12641         LDKCOption_ClosureReasonZ_Some_class =
12642                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
12643         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
12644         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
12645         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
12646         LDKCOption_ClosureReasonZ_None_class =
12647                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
12648         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
12649         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
12650         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
12651 }
12652 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12653         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
12654         switch(obj->tag) {
12655                 case LDKCOption_ClosureReasonZ_Some: {
12656                         int64_t some_ref = tag_ptr(&obj->some, false);
12657                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
12658                 }
12659                 case LDKCOption_ClosureReasonZ_None: {
12660                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
12661                 }
12662                 default: abort();
12663         }
12664 }
12665 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
12666 CHECK(owner->result_ok);
12667         return COption_ClosureReasonZ_clone(&*owner->contents.result);
12668 }
12669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12670         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
12671         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12672         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
12673         int64_t ret_ref = tag_ptr(ret_copy, true);
12674         return ret_ref;
12675 }
12676
12677 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
12678 CHECK(!owner->result_ok);
12679         return DecodeError_clone(&*owner->contents.err);
12680 }
12681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12682         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
12683         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12684         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
12685         int64_t ret_ref = tag_ptr(ret_copy, true);
12686         return ret_ref;
12687 }
12688
12689 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
12690 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
12691 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
12692 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
12693 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
12694 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
12695 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
12696 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
12697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
12698         LDKHTLCDestination_NextHopChannel_class =
12699                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
12700         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
12701         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
12702         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
12703         LDKHTLCDestination_UnknownNextHop_class =
12704                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
12705         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
12706         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
12707         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
12708         LDKHTLCDestination_InvalidForward_class =
12709                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
12710         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
12711         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
12712         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
12713         LDKHTLCDestination_FailedPayment_class =
12714                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
12715         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
12716         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
12717         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
12718 }
12719 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12720         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
12721         switch(obj->tag) {
12722                 case LDKHTLCDestination_NextHopChannel: {
12723                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
12724                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
12725                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12726                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
12727                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
12728                 }
12729                 case LDKHTLCDestination_UnknownNextHop: {
12730                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
12731                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
12732                 }
12733                 case LDKHTLCDestination_InvalidForward: {
12734                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
12735                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
12736                 }
12737                 case LDKHTLCDestination_FailedPayment: {
12738                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12739                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
12740                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
12741                 }
12742                 default: abort();
12743         }
12744 }
12745 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
12746 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
12747 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
12748 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
12749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
12750         LDKCOption_HTLCDestinationZ_Some_class =
12751                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
12752         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
12753         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
12754         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
12755         LDKCOption_HTLCDestinationZ_None_class =
12756                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
12757         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
12758         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
12759         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
12760 }
12761 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12762         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
12763         switch(obj->tag) {
12764                 case LDKCOption_HTLCDestinationZ_Some: {
12765                         int64_t some_ref = tag_ptr(&obj->some, false);
12766                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
12767                 }
12768                 case LDKCOption_HTLCDestinationZ_None: {
12769                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
12770                 }
12771                 default: abort();
12772         }
12773 }
12774 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12775 CHECK(owner->result_ok);
12776         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
12777 }
12778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12779         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12780         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12781         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
12782         int64_t ret_ref = tag_ptr(ret_copy, true);
12783         return ret_ref;
12784 }
12785
12786 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12787 CHECK(!owner->result_ok);
12788         return DecodeError_clone(&*owner->contents.err);
12789 }
12790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12791         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12792         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12793         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
12794         int64_t ret_ref = tag_ptr(ret_copy, true);
12795         return ret_ref;
12796 }
12797
12798 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12799 CHECK(owner->result_ok);
12800         return PaymentFailureReason_clone(&*owner->contents.result);
12801 }
12802 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12803         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12804         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
12805         return ret_conv;
12806 }
12807
12808 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12809 CHECK(!owner->result_ok);
12810         return DecodeError_clone(&*owner->contents.err);
12811 }
12812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12813         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12814         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12815         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
12816         int64_t ret_ref = tag_ptr(ret_copy, true);
12817         return ret_ref;
12818 }
12819
12820 static jclass LDKCOption_U128Z_Some_class = NULL;
12821 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
12822 static jclass LDKCOption_U128Z_None_class = NULL;
12823 static jmethodID LDKCOption_U128Z_None_meth = NULL;
12824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
12825         LDKCOption_U128Z_Some_class =
12826                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
12827         CHECK(LDKCOption_U128Z_Some_class != NULL);
12828         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
12829         CHECK(LDKCOption_U128Z_Some_meth != NULL);
12830         LDKCOption_U128Z_None_class =
12831                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
12832         CHECK(LDKCOption_U128Z_None_class != NULL);
12833         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
12834         CHECK(LDKCOption_U128Z_None_meth != NULL);
12835 }
12836 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12837         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
12838         switch(obj->tag) {
12839                 case LDKCOption_U128Z_Some: {
12840                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
12841                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
12842                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
12843                 }
12844                 case LDKCOption_U128Z_None: {
12845                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
12846                 }
12847                 default: abort();
12848         }
12849 }
12850 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
12851         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
12852         for (size_t i = 0; i < ret.datalen; i++) {
12853                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
12854         }
12855         return ret;
12856 }
12857 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
12858 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
12859 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
12860 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
12861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
12862         LDKCOption_PaymentFailureReasonZ_Some_class =
12863                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
12864         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
12865         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
12866         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
12867         LDKCOption_PaymentFailureReasonZ_None_class =
12868                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
12869         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
12870         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
12871         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
12872 }
12873 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12874         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
12875         switch(obj->tag) {
12876                 case LDKCOption_PaymentFailureReasonZ_Some: {
12877                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
12878                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
12879                 }
12880                 case LDKCOption_PaymentFailureReasonZ_None: {
12881                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
12882                 }
12883                 default: abort();
12884         }
12885 }
12886 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
12887 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
12888 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
12889 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
12890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
12891         LDKBumpTransactionEvent_ChannelClose_class =
12892                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
12893         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
12894         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "([BI[BJJ[J)V");
12895         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
12896         LDKBumpTransactionEvent_HTLCResolution_class =
12897                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
12898         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
12899         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "([BI[JI)V");
12900         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
12901 }
12902 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12903         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
12904         switch(obj->tag) {
12905                 case LDKBumpTransactionEvent_ChannelClose: {
12906                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12907                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
12908                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
12909                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
12910                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
12911                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
12912                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
12913                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
12914                         int64_t anchor_descriptor_ref = 0;
12915                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
12916                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
12917                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
12918                         int64_tArray pending_htlcs_arr = NULL;
12919                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
12920                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
12921                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
12922                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
12923                                 int64_t pending_htlcs_conv_24_ref = 0;
12924                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
12925                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
12926                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
12927                         }
12928                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
12929                         return (*env)->NewObject(env, LDKBumpTransactionEvent_ChannelClose_class, LDKBumpTransactionEvent_ChannelClose_meth, claim_id_arr, package_target_feerate_sat_per_1000_weight_conv, commitment_tx_arr, commitment_tx_fee_satoshis_conv, anchor_descriptor_ref, pending_htlcs_arr);
12930                 }
12931                 case LDKBumpTransactionEvent_HTLCResolution: {
12932                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12933                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
12934                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
12935                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
12936                         int64_tArray htlc_descriptors_arr = NULL;
12937                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
12938                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
12939                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
12940                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
12941                                 int64_t htlc_descriptors_conv_16_ref = 0;
12942                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
12943                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
12944                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
12945                         }
12946                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
12947                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
12948                         return (*env)->NewObject(env, LDKBumpTransactionEvent_HTLCResolution_class, LDKBumpTransactionEvent_HTLCResolution_meth, claim_id_arr, target_feerate_sat_per_1000_weight_conv, htlc_descriptors_arr, tx_lock_time_conv);
12949                 }
12950                 default: abort();
12951         }
12952 }
12953 static jclass LDKEvent_FundingGenerationReady_class = NULL;
12954 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
12955 static jclass LDKEvent_PaymentClaimable_class = NULL;
12956 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
12957 static jclass LDKEvent_PaymentClaimed_class = NULL;
12958 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
12959 static jclass LDKEvent_InvoiceRequestFailed_class = NULL;
12960 static jmethodID LDKEvent_InvoiceRequestFailed_meth = NULL;
12961 static jclass LDKEvent_PaymentSent_class = NULL;
12962 static jmethodID LDKEvent_PaymentSent_meth = NULL;
12963 static jclass LDKEvent_PaymentFailed_class = NULL;
12964 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
12965 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
12966 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
12967 static jclass LDKEvent_PaymentPathFailed_class = NULL;
12968 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
12969 static jclass LDKEvent_ProbeSuccessful_class = NULL;
12970 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
12971 static jclass LDKEvent_ProbeFailed_class = NULL;
12972 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
12973 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
12974 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
12975 static jclass LDKEvent_HTLCIntercepted_class = NULL;
12976 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
12977 static jclass LDKEvent_SpendableOutputs_class = NULL;
12978 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
12979 static jclass LDKEvent_PaymentForwarded_class = NULL;
12980 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
12981 static jclass LDKEvent_ChannelPending_class = NULL;
12982 static jmethodID LDKEvent_ChannelPending_meth = NULL;
12983 static jclass LDKEvent_ChannelReady_class = NULL;
12984 static jmethodID LDKEvent_ChannelReady_meth = NULL;
12985 static jclass LDKEvent_ChannelClosed_class = NULL;
12986 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
12987 static jclass LDKEvent_DiscardFunding_class = NULL;
12988 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
12989 static jclass LDKEvent_OpenChannelRequest_class = NULL;
12990 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
12991 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
12992 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
12993 static jclass LDKEvent_BumpTransaction_class = NULL;
12994 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
12995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
12996         LDKEvent_FundingGenerationReady_class =
12997                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
12998         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
12999         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
13000         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
13001         LDKEvent_PaymentClaimable_class =
13002                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
13003         CHECK(LDKEvent_PaymentClaimable_class != NULL);
13004         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
13005         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
13006         LDKEvent_PaymentClaimed_class =
13007                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
13008         CHECK(LDKEvent_PaymentClaimed_class != NULL);
13009         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
13010         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
13011         LDKEvent_InvoiceRequestFailed_class =
13012                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$InvoiceRequestFailed"));
13013         CHECK(LDKEvent_InvoiceRequestFailed_class != NULL);
13014         LDKEvent_InvoiceRequestFailed_meth = (*env)->GetMethodID(env, LDKEvent_InvoiceRequestFailed_class, "<init>", "([B)V");
13015         CHECK(LDKEvent_InvoiceRequestFailed_meth != NULL);
13016         LDKEvent_PaymentSent_class =
13017                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
13018         CHECK(LDKEvent_PaymentSent_class != NULL);
13019         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
13020         CHECK(LDKEvent_PaymentSent_meth != NULL);
13021         LDKEvent_PaymentFailed_class =
13022                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
13023         CHECK(LDKEvent_PaymentFailed_class != NULL);
13024         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
13025         CHECK(LDKEvent_PaymentFailed_meth != NULL);
13026         LDKEvent_PaymentPathSuccessful_class =
13027                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
13028         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
13029         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
13030         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
13031         LDKEvent_PaymentPathFailed_class =
13032                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
13033         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
13034         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
13035         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
13036         LDKEvent_ProbeSuccessful_class =
13037                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
13038         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
13039         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
13040         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
13041         LDKEvent_ProbeFailed_class =
13042                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
13043         CHECK(LDKEvent_ProbeFailed_class != NULL);
13044         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
13045         CHECK(LDKEvent_ProbeFailed_meth != NULL);
13046         LDKEvent_PendingHTLCsForwardable_class =
13047                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
13048         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
13049         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
13050         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
13051         LDKEvent_HTLCIntercepted_class =
13052                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
13053         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
13054         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
13055         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
13056         LDKEvent_SpendableOutputs_class =
13057                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
13058         CHECK(LDKEvent_SpendableOutputs_class != NULL);
13059         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
13060         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
13061         LDKEvent_PaymentForwarded_class =
13062                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
13063         CHECK(LDKEvent_PaymentForwarded_class != NULL);
13064         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJZJ)V");
13065         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
13066         LDKEvent_ChannelPending_class =
13067                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
13068         CHECK(LDKEvent_ChannelPending_class != NULL);
13069         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "([B[BJ[BJ)V");
13070         CHECK(LDKEvent_ChannelPending_meth != NULL);
13071         LDKEvent_ChannelReady_class =
13072                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
13073         CHECK(LDKEvent_ChannelReady_class != NULL);
13074         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
13075         CHECK(LDKEvent_ChannelReady_meth != NULL);
13076         LDKEvent_ChannelClosed_class =
13077                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
13078         CHECK(LDKEvent_ChannelClosed_class != NULL);
13079         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ[BJ)V");
13080         CHECK(LDKEvent_ChannelClosed_meth != NULL);
13081         LDKEvent_DiscardFunding_class =
13082                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
13083         CHECK(LDKEvent_DiscardFunding_class != NULL);
13084         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
13085         CHECK(LDKEvent_DiscardFunding_meth != NULL);
13086         LDKEvent_OpenChannelRequest_class =
13087                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
13088         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
13089         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
13090         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
13091         LDKEvent_HTLCHandlingFailed_class =
13092                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
13093         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
13094         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
13095         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
13096         LDKEvent_BumpTransaction_class =
13097                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
13098         CHECK(LDKEvent_BumpTransaction_class != NULL);
13099         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
13100         CHECK(LDKEvent_BumpTransaction_meth != NULL);
13101 }
13102 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13103         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
13104         switch(obj->tag) {
13105                 case LDKEvent_FundingGenerationReady: {
13106                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
13107                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
13108                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13109                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
13110                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
13111                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
13112                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
13113                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
13114                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13115                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
13116                         return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_arr);
13117                 }
13118                 case LDKEvent_PaymentClaimable: {
13119                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
13120                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
13121                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13122                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
13123                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
13124                         int64_t onion_fields_ref = 0;
13125                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
13126                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
13127                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
13128                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
13129                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
13130                         int64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
13131                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
13132                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
13133                         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);
13134                 }
13135                 case LDKEvent_PaymentClaimed: {
13136                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
13137                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
13138                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13139                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
13140                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
13141                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
13142                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
13143                         int64_tArray htlcs_arr = NULL;
13144                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
13145                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
13146                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
13147                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
13148                                 int64_t htlcs_conv_13_ref = 0;
13149                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
13150                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
13151                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
13152                         }
13153                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
13154                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
13155                         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);
13156                 }
13157                 case LDKEvent_InvoiceRequestFailed: {
13158                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13159                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->invoice_request_failed.payment_id.data);
13160                         return (*env)->NewObject(env, LDKEvent_InvoiceRequestFailed_class, LDKEvent_InvoiceRequestFailed_meth, payment_id_arr);
13161                 }
13162                 case LDKEvent_PaymentSent: {
13163                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
13164                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13165                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
13166                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13167                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
13168                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
13169                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
13170                 }
13171                 case LDKEvent_PaymentFailed: {
13172                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13173                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
13174                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13175                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
13176                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
13177                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
13178                 }
13179                 case LDKEvent_PaymentPathSuccessful: {
13180                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13181                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
13182                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
13183                         LDKPath path_var = obj->payment_path_successful.path;
13184                         int64_t path_ref = 0;
13185                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13186                         path_ref = tag_ptr(path_var.inner, false);
13187                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
13188                 }
13189                 case LDKEvent_PaymentPathFailed: {
13190                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
13191                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13192                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
13193                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
13194                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
13195                         LDKPath path_var = obj->payment_path_failed.path;
13196                         int64_t path_ref = 0;
13197                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13198                         path_ref = tag_ptr(path_var.inner, false);
13199                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
13200                         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);
13201                 }
13202                 case LDKEvent_ProbeSuccessful: {
13203                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13204                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
13205                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13206                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
13207                         LDKPath path_var = obj->probe_successful.path;
13208                         int64_t path_ref = 0;
13209                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13210                         path_ref = tag_ptr(path_var.inner, false);
13211                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
13212                 }
13213                 case LDKEvent_ProbeFailed: {
13214                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13215                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
13216                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13217                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
13218                         LDKPath path_var = obj->probe_failed.path;
13219                         int64_t path_ref = 0;
13220                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
13221                         path_ref = tag_ptr(path_var.inner, false);
13222                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
13223                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
13224                 }
13225                 case LDKEvent_PendingHTLCsForwardable: {
13226                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
13227                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
13228                 }
13229                 case LDKEvent_HTLCIntercepted: {
13230                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
13231                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
13232                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
13233                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13234                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
13235                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
13236                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
13237                         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);
13238                 }
13239                 case LDKEvent_SpendableOutputs: {
13240                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
13241                         int64_tArray outputs_arr = NULL;
13242                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
13243                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
13244                         for (size_t b = 0; b < outputs_var.datalen; b++) {
13245                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
13246                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
13247                         }
13248                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
13249                         int64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
13250                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
13251                 }
13252                 case LDKEvent_PaymentForwarded: {
13253                         int64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
13254                         int64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
13255                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
13256                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
13257                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
13258                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_ref, claim_from_onchain_tx_conv, outbound_amount_forwarded_msat_ref);
13259                 }
13260                 case LDKEvent_ChannelPending: {
13261                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13262                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_pending.channel_id.data);
13263                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13264                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
13265                         int64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
13266                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13267                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
13268                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
13269                         int64_t funding_txo_ref = 0;
13270                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
13271                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
13272                         return (*env)->NewObject(env, LDKEvent_ChannelPending_class, LDKEvent_ChannelPending_meth, channel_id_arr, user_channel_id_arr, former_temporary_channel_id_ref, counterparty_node_id_arr, funding_txo_ref);
13273                 }
13274                 case LDKEvent_ChannelReady: {
13275                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13276                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
13277                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13278                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
13279                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13280                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
13281                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
13282                         int64_t channel_type_ref = 0;
13283                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
13284                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
13285                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
13286                 }
13287                 case LDKEvent_ChannelClosed: {
13288                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13289                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
13290                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
13291                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
13292                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
13293                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13294                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
13295                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
13296                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_arr, reason_ref, counterparty_node_id_arr, channel_capacity_sats_ref);
13297                 }
13298                 case LDKEvent_DiscardFunding: {
13299                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13300                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
13301                         LDKTransaction transaction_var = obj->discard_funding.transaction;
13302                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
13303                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
13304                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
13305                 }
13306                 case LDKEvent_OpenChannelRequest: {
13307                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
13308                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
13309                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
13310                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
13311                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
13312                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
13313                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
13314                         int64_t channel_type_ref = 0;
13315                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
13316                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
13317                         return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
13318                 }
13319                 case LDKEvent_HTLCHandlingFailed: {
13320                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
13321                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
13322                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
13323                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
13324                 }
13325                 case LDKEvent_BumpTransaction: {
13326                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
13327                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
13328                 }
13329                 default: abort();
13330         }
13331 }
13332 static jclass LDKCOption_EventZ_Some_class = NULL;
13333 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
13334 static jclass LDKCOption_EventZ_None_class = NULL;
13335 static jmethodID LDKCOption_EventZ_None_meth = NULL;
13336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
13337         LDKCOption_EventZ_Some_class =
13338                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
13339         CHECK(LDKCOption_EventZ_Some_class != NULL);
13340         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
13341         CHECK(LDKCOption_EventZ_Some_meth != NULL);
13342         LDKCOption_EventZ_None_class =
13343                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
13344         CHECK(LDKCOption_EventZ_None_class != NULL);
13345         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
13346         CHECK(LDKCOption_EventZ_None_meth != NULL);
13347 }
13348 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13349         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
13350         switch(obj->tag) {
13351                 case LDKCOption_EventZ_Some: {
13352                         int64_t some_ref = tag_ptr(&obj->some, false);
13353                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
13354                 }
13355                 case LDKCOption_EventZ_None: {
13356                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
13357                 }
13358                 default: abort();
13359         }
13360 }
13361 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
13362 CHECK(owner->result_ok);
13363         return COption_EventZ_clone(&*owner->contents.result);
13364 }
13365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13366         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
13367         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13368         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
13369         int64_t ret_ref = tag_ptr(ret_copy, true);
13370         return ret_ref;
13371 }
13372
13373 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
13374 CHECK(!owner->result_ok);
13375         return DecodeError_clone(&*owner->contents.err);
13376 }
13377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13378         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
13379         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13380         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
13381         int64_t ret_ref = tag_ptr(ret_copy, true);
13382         return ret_ref;
13383 }
13384
13385 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
13386 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
13387 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
13388 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
13389 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
13390 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
13391 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
13392 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
13393 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
13394 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
13395 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
13396 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
13397 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
13398 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
13399 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
13400 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
13401 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
13402 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
13403 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
13404 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
13405 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
13406 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
13407 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
13408 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
13409 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
13410 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
13411 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
13412 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
13413 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
13414 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
13415 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
13416 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
13417 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
13418 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
13419 static jclass LDKBolt11ParseError_Skip_class = NULL;
13420 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
13421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
13422         LDKBolt11ParseError_Bech32Error_class =
13423                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
13424         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
13425         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
13426         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
13427         LDKBolt11ParseError_ParseAmountError_class =
13428                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
13429         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
13430         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
13431         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
13432         LDKBolt11ParseError_MalformedSignature_class =
13433                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
13434         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
13435         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
13436         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
13437         LDKBolt11ParseError_BadPrefix_class =
13438                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
13439         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
13440         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
13441         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
13442         LDKBolt11ParseError_UnknownCurrency_class =
13443                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
13444         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
13445         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
13446         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
13447         LDKBolt11ParseError_UnknownSiPrefix_class =
13448                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
13449         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
13450         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
13451         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
13452         LDKBolt11ParseError_MalformedHRP_class =
13453                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
13454         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
13455         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
13456         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
13457         LDKBolt11ParseError_TooShortDataPart_class =
13458                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
13459         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
13460         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
13461         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
13462         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
13463                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
13464         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
13465         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
13466         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
13467         LDKBolt11ParseError_DescriptionDecodeError_class =
13468                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
13469         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
13470         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
13471         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
13472         LDKBolt11ParseError_PaddingError_class =
13473                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
13474         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
13475         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
13476         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
13477         LDKBolt11ParseError_IntegerOverflowError_class =
13478                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
13479         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
13480         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
13481         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
13482         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
13483                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
13484         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
13485         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
13486         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
13487         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
13488                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
13489         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
13490         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
13491         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
13492         LDKBolt11ParseError_InvalidScriptHashLength_class =
13493                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
13494         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
13495         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
13496         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
13497         LDKBolt11ParseError_InvalidRecoveryId_class =
13498                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
13499         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
13500         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
13501         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
13502         LDKBolt11ParseError_InvalidSliceLength_class =
13503                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
13504         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
13505         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
13506         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
13507         LDKBolt11ParseError_Skip_class =
13508                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
13509         CHECK(LDKBolt11ParseError_Skip_class != NULL);
13510         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
13511         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
13512 }
13513 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13514         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
13515         switch(obj->tag) {
13516                 case LDKBolt11ParseError_Bech32Error: {
13517                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
13518                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
13519                 }
13520                 case LDKBolt11ParseError_ParseAmountError: {
13521                         /*obj->parse_amount_error*/
13522                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
13523                 }
13524                 case LDKBolt11ParseError_MalformedSignature: {
13525                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
13526                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
13527                 }
13528                 case LDKBolt11ParseError_BadPrefix: {
13529                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
13530                 }
13531                 case LDKBolt11ParseError_UnknownCurrency: {
13532                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
13533                 }
13534                 case LDKBolt11ParseError_UnknownSiPrefix: {
13535                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
13536                 }
13537                 case LDKBolt11ParseError_MalformedHRP: {
13538                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
13539                 }
13540                 case LDKBolt11ParseError_TooShortDataPart: {
13541                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
13542                 }
13543                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
13544                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
13545                 }
13546                 case LDKBolt11ParseError_DescriptionDecodeError: {
13547                         /*obj->description_decode_error*/
13548                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
13549                 }
13550                 case LDKBolt11ParseError_PaddingError: {
13551                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
13552                 }
13553                 case LDKBolt11ParseError_IntegerOverflowError: {
13554                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
13555                 }
13556                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
13557                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
13558                 }
13559                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
13560                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
13561                 }
13562                 case LDKBolt11ParseError_InvalidScriptHashLength: {
13563                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
13564                 }
13565                 case LDKBolt11ParseError_InvalidRecoveryId: {
13566                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
13567                 }
13568                 case LDKBolt11ParseError_InvalidSliceLength: {
13569                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
13570                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
13571                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
13572                 }
13573                 case LDKBolt11ParseError_Skip: {
13574                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
13575                 }
13576                 default: abort();
13577         }
13578 }
13579 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
13580 CHECK(owner->result_ok);
13581         return SiPrefix_clone(&*owner->contents.result);
13582 }
13583 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13584         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
13585         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
13586         return ret_conv;
13587 }
13588
13589 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
13590 CHECK(!owner->result_ok);
13591         return Bolt11ParseError_clone(&*owner->contents.err);
13592 }
13593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13594         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
13595         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
13596         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
13597         int64_t ret_ref = tag_ptr(ret_copy, true);
13598         return ret_ref;
13599 }
13600
13601 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
13602 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
13603 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
13604 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
13605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
13606         LDKParseOrSemanticError_ParseError_class =
13607                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
13608         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
13609         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
13610         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
13611         LDKParseOrSemanticError_SemanticError_class =
13612                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
13613         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
13614         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
13615         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
13616 }
13617 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13618         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
13619         switch(obj->tag) {
13620                 case LDKParseOrSemanticError_ParseError: {
13621                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
13622                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
13623                 }
13624                 case LDKParseOrSemanticError_SemanticError: {
13625                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
13626                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
13627                 }
13628                 default: abort();
13629         }
13630 }
13631 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
13632         LDKBolt11Invoice ret = *owner->contents.result;
13633         ret.is_owned = false;
13634         return ret;
13635 }
13636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13637         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
13638         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
13639         int64_t ret_ref = 0;
13640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13642         return ret_ref;
13643 }
13644
13645 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
13646 CHECK(!owner->result_ok);
13647         return ParseOrSemanticError_clone(&*owner->contents.err);
13648 }
13649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13650         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
13651         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
13652         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
13653         int64_t ret_ref = tag_ptr(ret_copy, true);
13654         return ret_ref;
13655 }
13656
13657 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
13658         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
13659         ret.is_owned = false;
13660         return ret;
13661 }
13662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13663         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
13664         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
13665         int64_t ret_ref = 0;
13666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13668         return ret_ref;
13669 }
13670
13671 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
13672 CHECK(!owner->result_ok);
13673         return Bolt11ParseError_clone(&*owner->contents.err);
13674 }
13675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13676         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
13677         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
13678         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
13679         int64_t ret_ref = tag_ptr(ret_copy, true);
13680         return ret_ref;
13681 }
13682
13683 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13684         LDKRawBolt11Invoice ret = owner->a;
13685         ret.is_owned = false;
13686         return ret;
13687 }
13688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
13689         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13690         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
13691         int64_t ret_ref = 0;
13692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13694         return ret_ref;
13695 }
13696
13697 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13698         return ThirtyTwoBytes_clone(&owner->b);
13699 }
13700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
13701         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13702         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13703         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
13704         return ret_arr;
13705 }
13706
13707 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
13708         LDKBolt11InvoiceSignature ret = owner->c;
13709         ret.is_owned = false;
13710         return ret;
13711 }
13712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
13713         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
13714         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
13715         int64_t ret_ref = 0;
13716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13718         return ret_ref;
13719 }
13720
13721 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
13722         LDKPayeePubKey ret = *owner->contents.result;
13723         ret.is_owned = false;
13724         return ret;
13725 }
13726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13727         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
13728         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
13729         int64_t ret_ref = 0;
13730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13732         return ret_ref;
13733 }
13734
13735 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
13736 CHECK(!owner->result_ok);
13737         return *owner->contents.err;
13738 }
13739 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13740         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
13741         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
13742         return ret_conv;
13743 }
13744
13745 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
13746         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
13747         for (size_t i = 0; i < ret.datalen; i++) {
13748                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
13749         }
13750         return ret;
13751 }
13752 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13753         LDKPositiveTimestamp ret = *owner->contents.result;
13754         ret.is_owned = false;
13755         return ret;
13756 }
13757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13758         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13759         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_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 enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13767 CHECK(!owner->result_ok);
13768         return CreationError_clone(&*owner->contents.err);
13769 }
13770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13771         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13772         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
13773         return ret_conv;
13774 }
13775
13776 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13777 CHECK(owner->result_ok);
13778         return *owner->contents.result;
13779 }
13780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13781         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13782         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
13783 }
13784
13785 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13786 CHECK(!owner->result_ok);
13787         return Bolt11SemanticError_clone(&*owner->contents.err);
13788 }
13789 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13790         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13791         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
13792         return ret_conv;
13793 }
13794
13795 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13796         LDKBolt11Invoice ret = *owner->contents.result;
13797         ret.is_owned = false;
13798         return ret;
13799 }
13800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13801         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13802         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
13803         int64_t ret_ref = 0;
13804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13806         return ret_ref;
13807 }
13808
13809 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13810 CHECK(!owner->result_ok);
13811         return Bolt11SemanticError_clone(&*owner->contents.err);
13812 }
13813 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13814         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13815         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
13816         return ret_conv;
13817 }
13818
13819 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13820         LDKDescription ret = *owner->contents.result;
13821         ret.is_owned = false;
13822         return ret;
13823 }
13824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13825         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13826         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
13827         int64_t ret_ref = 0;
13828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13830         return ret_ref;
13831 }
13832
13833 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13834 CHECK(!owner->result_ok);
13835         return CreationError_clone(&*owner->contents.err);
13836 }
13837 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13838         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13839         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
13840         return ret_conv;
13841 }
13842
13843 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13844         LDKPrivateRoute ret = *owner->contents.result;
13845         ret.is_owned = false;
13846         return ret;
13847 }
13848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13849         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13850         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
13851         int64_t ret_ref = 0;
13852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13854         return ret_ref;
13855 }
13856
13857 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13858 CHECK(!owner->result_ok);
13859         return CreationError_clone(&*owner->contents.err);
13860 }
13861 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13862         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13863         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
13864         return ret_conv;
13865 }
13866
13867 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13868         LDKOutPoint ret = *owner->contents.result;
13869         ret.is_owned = false;
13870         return ret;
13871 }
13872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13873         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13874         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
13875         int64_t ret_ref = 0;
13876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13878         return ret_ref;
13879 }
13880
13881 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13882 CHECK(!owner->result_ok);
13883         return DecodeError_clone(&*owner->contents.err);
13884 }
13885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13886         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13887         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13888         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
13889         int64_t ret_ref = tag_ptr(ret_copy, true);
13890         return ret_ref;
13891 }
13892
13893 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13894         LDKBigSize ret = *owner->contents.result;
13895         ret.is_owned = false;
13896         return ret;
13897 }
13898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13899         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13900         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
13901         int64_t ret_ref = 0;
13902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13904         return ret_ref;
13905 }
13906
13907 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13908 CHECK(!owner->result_ok);
13909         return DecodeError_clone(&*owner->contents.err);
13910 }
13911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13912         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13913         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13914         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
13915         int64_t ret_ref = tag_ptr(ret_copy, true);
13916         return ret_ref;
13917 }
13918
13919 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13920         LDKHostname ret = *owner->contents.result;
13921         ret.is_owned = false;
13922         return ret;
13923 }
13924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13925         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13926         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
13927         int64_t ret_ref = 0;
13928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13930         return ret_ref;
13931 }
13932
13933 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13934 CHECK(!owner->result_ok);
13935         return DecodeError_clone(&*owner->contents.err);
13936 }
13937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13938         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13939         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13940         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
13941         int64_t ret_ref = tag_ptr(ret_copy, true);
13942         return ret_ref;
13943 }
13944
13945 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13946         LDKTransactionU16LenLimited ret = *owner->contents.result;
13947         ret.is_owned = false;
13948         return ret;
13949 }
13950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13951         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13952         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
13953         int64_t ret_ref = 0;
13954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13956         return ret_ref;
13957 }
13958
13959 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13960 CHECK(!owner->result_ok);
13961         return *owner->contents.err;
13962 }
13963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13964         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13965         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
13966 }
13967
13968 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13969         LDKTransactionU16LenLimited ret = *owner->contents.result;
13970         ret.is_owned = false;
13971         return ret;
13972 }
13973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13974         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13975         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
13976         int64_t ret_ref = 0;
13977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13979         return ret_ref;
13980 }
13981
13982 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13983 CHECK(!owner->result_ok);
13984         return DecodeError_clone(&*owner->contents.err);
13985 }
13986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13987         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13988         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13989         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
13990         int64_t ret_ref = tag_ptr(ret_copy, true);
13991         return ret_ref;
13992 }
13993
13994 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13995         LDKUntrustedString ret = *owner->contents.result;
13996         ret.is_owned = false;
13997         return ret;
13998 }
13999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14000         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
14001         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
14002         int64_t ret_ref = 0;
14003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14005         return ret_ref;
14006 }
14007
14008 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
14009 CHECK(!owner->result_ok);
14010         return DecodeError_clone(&*owner->contents.err);
14011 }
14012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14013         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
14014         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14015         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
14016         int64_t ret_ref = tag_ptr(ret_copy, true);
14017         return ret_ref;
14018 }
14019
14020 static inline struct LDKReceiveTlvs CResult_ReceiveTlvsDecodeErrorZ_get_ok(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
14021         LDKReceiveTlvs ret = *owner->contents.result;
14022         ret.is_owned = false;
14023         return ret;
14024 }
14025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14026         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
14027         LDKReceiveTlvs ret_var = CResult_ReceiveTlvsDecodeErrorZ_get_ok(owner_conv);
14028         int64_t ret_ref = 0;
14029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14031         return ret_ref;
14032 }
14033
14034 static inline struct LDKDecodeError CResult_ReceiveTlvsDecodeErrorZ_get_err(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR owner){
14035 CHECK(!owner->result_ok);
14036         return DecodeError_clone(&*owner->contents.err);
14037 }
14038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14039         LDKCResult_ReceiveTlvsDecodeErrorZ* owner_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(owner);
14040         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14041         *ret_copy = CResult_ReceiveTlvsDecodeErrorZ_get_err(owner_conv);
14042         int64_t ret_ref = tag_ptr(ret_copy, true);
14043         return ret_ref;
14044 }
14045
14046 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
14047         LDKPaymentRelay ret = *owner->contents.result;
14048         ret.is_owned = false;
14049         return ret;
14050 }
14051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14052         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
14053         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
14054         int64_t ret_ref = 0;
14055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14057         return ret_ref;
14058 }
14059
14060 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
14061 CHECK(!owner->result_ok);
14062         return DecodeError_clone(&*owner->contents.err);
14063 }
14064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14065         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
14066         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14067         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
14068         int64_t ret_ref = tag_ptr(ret_copy, true);
14069         return ret_ref;
14070 }
14071
14072 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
14073         LDKPaymentConstraints ret = *owner->contents.result;
14074         ret.is_owned = false;
14075         return ret;
14076 }
14077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14078         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
14079         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
14080         int64_t ret_ref = 0;
14081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14083         return ret_ref;
14084 }
14085
14086 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
14087 CHECK(!owner->result_ok);
14088         return DecodeError_clone(&*owner->contents.err);
14089 }
14090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14091         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
14092         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14093         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
14094         int64_t ret_ref = tag_ptr(ret_copy, true);
14095         return ret_ref;
14096 }
14097
14098 static jclass LDKPaymentError_Invoice_class = NULL;
14099 static jmethodID LDKPaymentError_Invoice_meth = NULL;
14100 static jclass LDKPaymentError_Sending_class = NULL;
14101 static jmethodID LDKPaymentError_Sending_meth = NULL;
14102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
14103         LDKPaymentError_Invoice_class =
14104                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
14105         CHECK(LDKPaymentError_Invoice_class != NULL);
14106         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
14107         CHECK(LDKPaymentError_Invoice_meth != NULL);
14108         LDKPaymentError_Sending_class =
14109                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
14110         CHECK(LDKPaymentError_Sending_class != NULL);
14111         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(Lorg/ldk/enums/RetryableSendFailure;)V");
14112         CHECK(LDKPaymentError_Sending_meth != NULL);
14113 }
14114 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14115         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
14116         switch(obj->tag) {
14117                 case LDKPaymentError_Invoice: {
14118                         LDKStr invoice_str = obj->invoice;
14119                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
14120                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
14121                 }
14122                 case LDKPaymentError_Sending: {
14123                         jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending);
14124                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv);
14125                 }
14126                 default: abort();
14127         }
14128 }
14129 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
14130 CHECK(owner->result_ok);
14131         return ThirtyTwoBytes_clone(&*owner->contents.result);
14132 }
14133 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14134         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
14135         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14136         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentErrorZ_get_ok(owner_conv).data);
14137         return ret_arr;
14138 }
14139
14140 static inline struct LDKPaymentError CResult_ThirtyTwoBytesPaymentErrorZ_get_err(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR owner){
14141 CHECK(!owner->result_ok);
14142         return PaymentError_clone(&*owner->contents.err);
14143 }
14144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14145         LDKCResult_ThirtyTwoBytesPaymentErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(owner);
14146         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
14147         *ret_copy = CResult_ThirtyTwoBytesPaymentErrorZ_get_err(owner_conv);
14148         int64_t ret_ref = tag_ptr(ret_copy, true);
14149         return ret_ref;
14150 }
14151
14152 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
14153 CHECK(owner->result_ok);
14154         return *owner->contents.result;
14155 }
14156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14157         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
14158         CResult_NonePaymentErrorZ_get_ok(owner_conv);
14159 }
14160
14161 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
14162 CHECK(!owner->result_ok);
14163         return PaymentError_clone(&*owner->contents.err);
14164 }
14165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14166         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
14167         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
14168         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
14169         int64_t ret_ref = tag_ptr(ret_copy, true);
14170         return ret_ref;
14171 }
14172
14173 static jclass LDKProbingError_Invoice_class = NULL;
14174 static jmethodID LDKProbingError_Invoice_meth = NULL;
14175 static jclass LDKProbingError_Sending_class = NULL;
14176 static jmethodID LDKProbingError_Sending_meth = NULL;
14177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbingError_init (JNIEnv *env, jclass clz) {
14178         LDKProbingError_Invoice_class =
14179                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbingError$Invoice"));
14180         CHECK(LDKProbingError_Invoice_class != NULL);
14181         LDKProbingError_Invoice_meth = (*env)->GetMethodID(env, LDKProbingError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
14182         CHECK(LDKProbingError_Invoice_meth != NULL);
14183         LDKProbingError_Sending_class =
14184                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbingError$Sending"));
14185         CHECK(LDKProbingError_Sending_class != NULL);
14186         LDKProbingError_Sending_meth = (*env)->GetMethodID(env, LDKProbingError_Sending_class, "<init>", "(J)V");
14187         CHECK(LDKProbingError_Sending_meth != NULL);
14188 }
14189 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbingError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14190         LDKProbingError *obj = (LDKProbingError*)untag_ptr(ptr);
14191         switch(obj->tag) {
14192                 case LDKProbingError_Invoice: {
14193                         LDKStr invoice_str = obj->invoice;
14194                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
14195                         return (*env)->NewObject(env, LDKProbingError_Invoice_class, LDKProbingError_Invoice_meth, invoice_conv);
14196                 }
14197                 case LDKProbingError_Sending: {
14198                         int64_t sending_ref = tag_ptr(&obj->sending, false);
14199                         return (*env)->NewObject(env, LDKProbingError_Sending_class, LDKProbingError_Sending_meth, sending_ref);
14200                 }
14201                 default: abort();
14202         }
14203 }
14204 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
14205 CHECK(owner->result_ok);
14206         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
14207 }
14208 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14209         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
14210         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_ok(owner_conv);
14211         int64_tArray ret_arr = NULL;
14212         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14213         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14214         for (size_t o = 0; o < ret_var.datalen; o++) {
14215                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
14216                 *ret_conv_40_conv = ret_var.data[o];
14217                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
14218         }
14219         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14220         FREE(ret_var.data);
14221         return ret_arr;
14222 }
14223
14224 static inline struct LDKProbingError CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR owner){
14225 CHECK(!owner->result_ok);
14226         return ProbingError_clone(&*owner->contents.err);
14227 }
14228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14229         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(owner);
14230         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
14231         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_get_err(owner_conv);
14232         int64_t ret_ref = tag_ptr(ret_copy, true);
14233         return ret_ref;
14234 }
14235
14236 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
14237 CHECK(owner->result_ok);
14238         return *owner->contents.result;
14239 }
14240 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14241         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
14242         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
14243         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14244         return ret_conv;
14245 }
14246
14247 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
14248 CHECK(!owner->result_ok);
14249         return *owner->contents.err;
14250 }
14251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14252         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
14253         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
14254         return ret_conv;
14255 }
14256
14257 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
14258         LDKOnionMessagePath ret = *owner->contents.result;
14259         ret.is_owned = false;
14260         return ret;
14261 }
14262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14263         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
14264         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
14265         int64_t ret_ref = 0;
14266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14268         return ret_ref;
14269 }
14270
14271 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
14272 CHECK(!owner->result_ok);
14273         return *owner->contents.err;
14274 }
14275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14276         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
14277         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
14278 }
14279
14280 static inline struct LDKPublicKey C2Tuple_PublicKeyOnionMessageZ_get_a(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
14281         return owner->a;
14282 }
14283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14284         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
14285         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14286         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyOnionMessageZ_get_a(owner_conv).compressed_form);
14287         return ret_arr;
14288 }
14289
14290 static inline struct LDKOnionMessage C2Tuple_PublicKeyOnionMessageZ_get_b(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR owner){
14291         LDKOnionMessage ret = owner->b;
14292         ret.is_owned = false;
14293         return ret;
14294 }
14295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14296         LDKC2Tuple_PublicKeyOnionMessageZ* owner_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(owner);
14297         LDKOnionMessage ret_var = C2Tuple_PublicKeyOnionMessageZ_get_b(owner_conv);
14298         int64_t ret_ref = 0;
14299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14301         return ret_ref;
14302 }
14303
14304 static jclass LDKSendError_Secp256k1_class = NULL;
14305 static jmethodID LDKSendError_Secp256k1_meth = NULL;
14306 static jclass LDKSendError_TooBigPacket_class = NULL;
14307 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
14308 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
14309 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
14310 static jclass LDKSendError_InvalidFirstHop_class = NULL;
14311 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
14312 static jclass LDKSendError_InvalidMessage_class = NULL;
14313 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
14314 static jclass LDKSendError_BufferFull_class = NULL;
14315 static jmethodID LDKSendError_BufferFull_meth = NULL;
14316 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
14317 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
14318 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
14319 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
14320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
14321         LDKSendError_Secp256k1_class =
14322                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
14323         CHECK(LDKSendError_Secp256k1_class != NULL);
14324         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
14325         CHECK(LDKSendError_Secp256k1_meth != NULL);
14326         LDKSendError_TooBigPacket_class =
14327                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
14328         CHECK(LDKSendError_TooBigPacket_class != NULL);
14329         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
14330         CHECK(LDKSendError_TooBigPacket_meth != NULL);
14331         LDKSendError_TooFewBlindedHops_class =
14332                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
14333         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
14334         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
14335         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
14336         LDKSendError_InvalidFirstHop_class =
14337                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
14338         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
14339         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "()V");
14340         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
14341         LDKSendError_InvalidMessage_class =
14342                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
14343         CHECK(LDKSendError_InvalidMessage_class != NULL);
14344         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
14345         CHECK(LDKSendError_InvalidMessage_meth != NULL);
14346         LDKSendError_BufferFull_class =
14347                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
14348         CHECK(LDKSendError_BufferFull_class != NULL);
14349         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
14350         CHECK(LDKSendError_BufferFull_meth != NULL);
14351         LDKSendError_GetNodeIdFailed_class =
14352                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
14353         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
14354         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
14355         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
14356         LDKSendError_BlindedPathAdvanceFailed_class =
14357                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
14358         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
14359         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
14360         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
14361 }
14362 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14363         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
14364         switch(obj->tag) {
14365                 case LDKSendError_Secp256k1: {
14366                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
14367                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
14368                 }
14369                 case LDKSendError_TooBigPacket: {
14370                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
14371                 }
14372                 case LDKSendError_TooFewBlindedHops: {
14373                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
14374                 }
14375                 case LDKSendError_InvalidFirstHop: {
14376                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth);
14377                 }
14378                 case LDKSendError_InvalidMessage: {
14379                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
14380                 }
14381                 case LDKSendError_BufferFull: {
14382                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
14383                 }
14384                 case LDKSendError_GetNodeIdFailed: {
14385                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
14386                 }
14387                 case LDKSendError_BlindedPathAdvanceFailed: {
14388                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
14389                 }
14390                 default: abort();
14391         }
14392 }
14393 static inline struct LDKC2Tuple_PublicKeyOnionMessageZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
14394 CHECK(owner->result_ok);
14395         return C2Tuple_PublicKeyOnionMessageZ_clone(&*owner->contents.result);
14396 }
14397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14398         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
14399         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
14400         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(owner_conv);
14401         return tag_ptr(ret_conv, true);
14402 }
14403
14404 static inline struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner){
14405 CHECK(!owner->result_ok);
14406         return SendError_clone(&*owner->contents.err);
14407 }
14408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14409         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* owner_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(owner);
14410         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
14411         *ret_copy = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(owner_conv);
14412         int64_t ret_ref = tag_ptr(ret_copy, true);
14413         return ret_ref;
14414 }
14415
14416 static jclass LDKParsedOnionMessageContents_Offers_class = NULL;
14417 static jmethodID LDKParsedOnionMessageContents_Offers_meth = NULL;
14418 static jclass LDKParsedOnionMessageContents_Custom_class = NULL;
14419 static jmethodID LDKParsedOnionMessageContents_Custom_meth = NULL;
14420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init (JNIEnv *env, jclass clz) {
14421         LDKParsedOnionMessageContents_Offers_class =
14422                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Offers"));
14423         CHECK(LDKParsedOnionMessageContents_Offers_class != NULL);
14424         LDKParsedOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Offers_class, "<init>", "(J)V");
14425         CHECK(LDKParsedOnionMessageContents_Offers_meth != NULL);
14426         LDKParsedOnionMessageContents_Custom_class =
14427                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Custom"));
14428         CHECK(LDKParsedOnionMessageContents_Custom_class != NULL);
14429         LDKParsedOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Custom_class, "<init>", "(J)V");
14430         CHECK(LDKParsedOnionMessageContents_Custom_meth != NULL);
14431 }
14432 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14433         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
14434         switch(obj->tag) {
14435                 case LDKParsedOnionMessageContents_Offers: {
14436                         int64_t offers_ref = tag_ptr(&obj->offers, false);
14437                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Offers_class, LDKParsedOnionMessageContents_Offers_meth, offers_ref);
14438                 }
14439                 case LDKParsedOnionMessageContents_Custom: {
14440                         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
14441                         *custom_ret = OnionMessageContents_clone(&obj->custom);
14442                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Custom_class, LDKParsedOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
14443                 }
14444                 default: abort();
14445         }
14446 }
14447 static jclass LDKPeeledOnion_Forward_class = NULL;
14448 static jmethodID LDKPeeledOnion_Forward_meth = NULL;
14449 static jclass LDKPeeledOnion_Receive_class = NULL;
14450 static jmethodID LDKPeeledOnion_Receive_meth = NULL;
14451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init (JNIEnv *env, jclass clz) {
14452         LDKPeeledOnion_Forward_class =
14453                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Forward"));
14454         CHECK(LDKPeeledOnion_Forward_class != NULL);
14455         LDKPeeledOnion_Forward_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Forward_class, "<init>", "([BJ)V");
14456         CHECK(LDKPeeledOnion_Forward_meth != NULL);
14457         LDKPeeledOnion_Receive_class =
14458                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Receive"));
14459         CHECK(LDKPeeledOnion_Receive_class != NULL);
14460         LDKPeeledOnion_Receive_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Receive_class, "<init>", "(J[BJ)V");
14461         CHECK(LDKPeeledOnion_Receive_meth != NULL);
14462 }
14463 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14464         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
14465         switch(obj->tag) {
14466                 case LDKPeeledOnion_Forward: {
14467                         int8_tArray _0_arr = (*env)->NewByteArray(env, 33);
14468                         (*env)->SetByteArrayRegion(env, _0_arr, 0, 33, obj->forward._0.compressed_form);
14469                         LDKOnionMessage _1_var = obj->forward._1;
14470                         int64_t _1_ref = 0;
14471                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
14472                         _1_ref = tag_ptr(_1_var.inner, false);
14473                         return (*env)->NewObject(env, LDKPeeledOnion_Forward_class, LDKPeeledOnion_Forward_meth, _0_arr, _1_ref);
14474                 }
14475                 case LDKPeeledOnion_Receive: {
14476                         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
14477                         int8_tArray _1_arr = (*env)->NewByteArray(env, 32);
14478                         (*env)->SetByteArrayRegion(env, _1_arr, 0, 32, obj->receive._1.data);
14479                         LDKBlindedPath _2_var = obj->receive._2;
14480                         int64_t _2_ref = 0;
14481                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
14482                         _2_ref = tag_ptr(_2_var.inner, false);
14483                         return (*env)->NewObject(env, LDKPeeledOnion_Receive_class, LDKPeeledOnion_Receive_meth, _0_ref, _1_arr, _2_ref);
14484                 }
14485                 default: abort();
14486         }
14487 }
14488 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
14489 CHECK(owner->result_ok);
14490         return PeeledOnion_clone(&*owner->contents.result);
14491 }
14492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14493         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
14494         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
14495         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
14496         int64_t ret_ref = tag_ptr(ret_copy, true);
14497         return ret_ref;
14498 }
14499
14500 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
14501 CHECK(!owner->result_ok);
14502         return *owner->contents.err;
14503 }
14504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14505         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
14506         CResult_PeeledOnionNoneZ_get_err(owner_conv);
14507 }
14508
14509 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
14510 CHECK(owner->result_ok);
14511         return *owner->contents.result;
14512 }
14513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14514         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
14515         CResult_NoneSendErrorZ_get_ok(owner_conv);
14516 }
14517
14518 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
14519 CHECK(!owner->result_ok);
14520         return SendError_clone(&*owner->contents.err);
14521 }
14522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14523         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
14524         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
14525         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
14526         int64_t ret_ref = tag_ptr(ret_copy, true);
14527         return ret_ref;
14528 }
14529
14530 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
14531         LDKBlindedPath ret = *owner->contents.result;
14532         ret.is_owned = false;
14533         return ret;
14534 }
14535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14536         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
14537         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
14538         int64_t ret_ref = 0;
14539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14541         return ret_ref;
14542 }
14543
14544 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
14545 CHECK(!owner->result_ok);
14546         return *owner->contents.err;
14547 }
14548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14549         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
14550         CResult_BlindedPathNoneZ_get_err(owner_conv);
14551 }
14552
14553 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
14554 CHECK(owner->result_ok);
14555         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
14556 }
14557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14558         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
14559         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
14560         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
14561         return tag_ptr(ret_conv, true);
14562 }
14563
14564 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
14565 CHECK(!owner->result_ok);
14566         return *owner->contents.err;
14567 }
14568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14569         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
14570         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
14571 }
14572
14573 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
14574         LDKBlindedPath ret = *owner->contents.result;
14575         ret.is_owned = false;
14576         return ret;
14577 }
14578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14579         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
14580         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
14581         int64_t ret_ref = 0;
14582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14584         return ret_ref;
14585 }
14586
14587 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
14588 CHECK(!owner->result_ok);
14589         return DecodeError_clone(&*owner->contents.err);
14590 }
14591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14592         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
14593         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14594         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
14595         int64_t ret_ref = tag_ptr(ret_copy, true);
14596         return ret_ref;
14597 }
14598
14599 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
14600         LDKBlindedHop ret = *owner->contents.result;
14601         ret.is_owned = false;
14602         return ret;
14603 }
14604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14605         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
14606         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
14607         int64_t ret_ref = 0;
14608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14610         return ret_ref;
14611 }
14612
14613 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
14614 CHECK(!owner->result_ok);
14615         return DecodeError_clone(&*owner->contents.err);
14616 }
14617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14618         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
14619         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14620         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
14621         int64_t ret_ref = tag_ptr(ret_copy, true);
14622         return ret_ref;
14623 }
14624
14625 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
14626         LDKInvoiceError ret = *owner->contents.result;
14627         ret.is_owned = false;
14628         return ret;
14629 }
14630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14631         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
14632         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
14633         int64_t ret_ref = 0;
14634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14636         return ret_ref;
14637 }
14638
14639 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
14640 CHECK(!owner->result_ok);
14641         return DecodeError_clone(&*owner->contents.err);
14642 }
14643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14644         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
14645         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14646         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
14647         int64_t ret_ref = tag_ptr(ret_copy, true);
14648         return ret_ref;
14649 }
14650
14651 typedef struct LDKFilter_JCalls {
14652         atomic_size_t refcnt;
14653         JavaVM *vm;
14654         jweak o;
14655         jmethodID register_tx_meth;
14656         jmethodID register_output_meth;
14657 } LDKFilter_JCalls;
14658 static void LDKFilter_JCalls_free(void* this_arg) {
14659         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14660         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14661                 JNIEnv *env;
14662                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14663                 if (get_jenv_res == JNI_EDETACHED) {
14664                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14665                 } else {
14666                         DO_ASSERT(get_jenv_res == JNI_OK);
14667                 }
14668                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14669                 if (get_jenv_res == JNI_EDETACHED) {
14670                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14671                 }
14672                 FREE(j_calls);
14673         }
14674 }
14675 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
14676         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14677         JNIEnv *env;
14678         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14679         if (get_jenv_res == JNI_EDETACHED) {
14680                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14681         } else {
14682                 DO_ASSERT(get_jenv_res == JNI_OK);
14683         }
14684         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
14685         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
14686         LDKu8slice script_pubkey_var = script_pubkey;
14687         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
14688         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
14689         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14690         CHECK(obj != NULL);
14691         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
14692         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14693                 (*env)->ExceptionDescribe(env);
14694                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
14695         }
14696         if (get_jenv_res == JNI_EDETACHED) {
14697                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14698         }
14699 }
14700 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
14701         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
14702         JNIEnv *env;
14703         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14704         if (get_jenv_res == JNI_EDETACHED) {
14705                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14706         } else {
14707                 DO_ASSERT(get_jenv_res == JNI_OK);
14708         }
14709         LDKWatchedOutput output_var = output;
14710         int64_t output_ref = 0;
14711         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
14712         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
14713         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14714         CHECK(obj != NULL);
14715         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
14716         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14717                 (*env)->ExceptionDescribe(env);
14718                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
14719         }
14720         if (get_jenv_res == JNI_EDETACHED) {
14721                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14722         }
14723 }
14724 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
14725         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
14726         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14727 }
14728 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
14729         jclass c = (*env)->GetObjectClass(env, o);
14730         CHECK(c != NULL);
14731         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
14732         atomic_init(&calls->refcnt, 1);
14733         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14734         calls->o = (*env)->NewWeakGlobalRef(env, o);
14735         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
14736         CHECK(calls->register_tx_meth != NULL);
14737         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
14738         CHECK(calls->register_output_meth != NULL);
14739
14740         LDKFilter ret = {
14741                 .this_arg = (void*) calls,
14742                 .register_tx = register_tx_LDKFilter_jcall,
14743                 .register_output = register_output_LDKFilter_jcall,
14744                 .free = LDKFilter_JCalls_free,
14745         };
14746         return ret;
14747 }
14748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
14749         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
14750         *res_ptr = LDKFilter_init(env, clz, o);
14751         return tag_ptr(res_ptr, true);
14752 }
14753 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) {
14754         void* this_arg_ptr = untag_ptr(this_arg);
14755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14756         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
14757         uint8_t txid_arr[32];
14758         CHECK((*env)->GetArrayLength(env, txid) == 32);
14759         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14760         uint8_t (*txid_ref)[32] = &txid_arr;
14761         LDKu8slice script_pubkey_ref;
14762         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14763         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
14764         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
14765         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
14766 }
14767
14768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
14769         void* this_arg_ptr = untag_ptr(this_arg);
14770         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14771         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
14772         LDKWatchedOutput output_conv;
14773         output_conv.inner = untag_ptr(output);
14774         output_conv.is_owned = ptr_is_owned(output);
14775         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
14776         output_conv = WatchedOutput_clone(&output_conv);
14777         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
14778 }
14779
14780 static jclass LDKCOption_FilterZ_Some_class = NULL;
14781 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
14782 static jclass LDKCOption_FilterZ_None_class = NULL;
14783 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
14784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
14785         LDKCOption_FilterZ_Some_class =
14786                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
14787         CHECK(LDKCOption_FilterZ_Some_class != NULL);
14788         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
14789         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
14790         LDKCOption_FilterZ_None_class =
14791                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
14792         CHECK(LDKCOption_FilterZ_None_class != NULL);
14793         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
14794         CHECK(LDKCOption_FilterZ_None_meth != NULL);
14795 }
14796 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14797         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
14798         switch(obj->tag) {
14799                 case LDKCOption_FilterZ_Some: {
14800                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
14801                         *some_ret = obj->some;
14802                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
14803                         if ((*some_ret).free == LDKFilter_JCalls_free) {
14804                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14805                                 LDKFilter_JCalls_cloned(&(*some_ret));
14806                         }
14807                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
14808                 }
14809                 case LDKCOption_FilterZ_None: {
14810                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
14811                 }
14812                 default: abort();
14813         }
14814 }
14815 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14816         LDKLockedChannelMonitor ret = *owner->contents.result;
14817         ret.is_owned = false;
14818         return ret;
14819 }
14820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14821         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14822         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
14823         int64_t ret_ref = 0;
14824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14826         return ret_ref;
14827 }
14828
14829 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14830 CHECK(!owner->result_ok);
14831         return *owner->contents.err;
14832 }
14833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14834         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14835         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
14836 }
14837
14838 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
14839         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
14840         for (size_t i = 0; i < ret.datalen; i++) {
14841                 ret.data[i] = OutPoint_clone(&orig->data[i]);
14842         }
14843         return ret;
14844 }
14845 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
14846         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
14847         for (size_t i = 0; i < ret.datalen; i++) {
14848                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
14849         }
14850         return ret;
14851 }
14852 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14853         LDKOutPoint ret = owner->a;
14854         ret.is_owned = false;
14855         return ret;
14856 }
14857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14858         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14859         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
14860         int64_t ret_ref = 0;
14861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14863         return ret_ref;
14864 }
14865
14866 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14867         return CVec_MonitorUpdateIdZ_clone(&owner->b);
14868 }
14869 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14870         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14871         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
14872         int64_tArray ret_arr = NULL;
14873         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14874         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14875         for (size_t r = 0; r < ret_var.datalen; r++) {
14876                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
14877                 int64_t ret_conv_17_ref = 0;
14878                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
14879                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
14880                 ret_arr_ptr[r] = ret_conv_17_ref;
14881         }
14882         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14883         FREE(ret_var.data);
14884         return ret_arr;
14885 }
14886
14887 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
14888         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
14889         for (size_t i = 0; i < ret.datalen; i++) {
14890                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
14891         }
14892         return ret;
14893 }
14894 typedef struct LDKKVStore_JCalls {
14895         atomic_size_t refcnt;
14896         JavaVM *vm;
14897         jweak o;
14898         jmethodID read_meth;
14899         jmethodID write_meth;
14900         jmethodID remove_meth;
14901         jmethodID list_meth;
14902 } LDKKVStore_JCalls;
14903 static void LDKKVStore_JCalls_free(void* this_arg) {
14904         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14905         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14906                 JNIEnv *env;
14907                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14908                 if (get_jenv_res == JNI_EDETACHED) {
14909                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14910                 } else {
14911                         DO_ASSERT(get_jenv_res == JNI_OK);
14912                 }
14913                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14914                 if (get_jenv_res == JNI_EDETACHED) {
14915                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14916                 }
14917                 FREE(j_calls);
14918         }
14919 }
14920 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
14921         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14922         JNIEnv *env;
14923         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14924         if (get_jenv_res == JNI_EDETACHED) {
14925                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14926         } else {
14927                 DO_ASSERT(get_jenv_res == JNI_OK);
14928         }
14929         LDKStr primary_namespace_str = primary_namespace;
14930         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14931         Str_free(primary_namespace_str);
14932         LDKStr secondary_namespace_str = secondary_namespace;
14933         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14934         Str_free(secondary_namespace_str);
14935         LDKStr key_str = key;
14936         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14937         Str_free(key_str);
14938         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14939         CHECK(obj != NULL);
14940         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
14941         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14942                 (*env)->ExceptionDescribe(env);
14943                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
14944         }
14945         void* ret_ptr = untag_ptr(ret);
14946         CHECK_ACCESS(ret_ptr);
14947         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
14948         FREE(untag_ptr(ret));
14949         if (get_jenv_res == JNI_EDETACHED) {
14950                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14951         }
14952         return ret_conv;
14953 }
14954 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
14955         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14956         JNIEnv *env;
14957         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14958         if (get_jenv_res == JNI_EDETACHED) {
14959                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14960         } else {
14961                 DO_ASSERT(get_jenv_res == JNI_OK);
14962         }
14963         LDKStr primary_namespace_str = primary_namespace;
14964         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
14965         Str_free(primary_namespace_str);
14966         LDKStr secondary_namespace_str = secondary_namespace;
14967         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
14968         Str_free(secondary_namespace_str);
14969         LDKStr key_str = key;
14970         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
14971         Str_free(key_str);
14972         LDKu8slice buf_var = buf;
14973         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
14974         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
14975         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14976         CHECK(obj != NULL);
14977         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
14978         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14979                 (*env)->ExceptionDescribe(env);
14980                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
14981         }
14982         void* ret_ptr = untag_ptr(ret);
14983         CHECK_ACCESS(ret_ptr);
14984         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14985         FREE(untag_ptr(ret));
14986         if (get_jenv_res == JNI_EDETACHED) {
14987                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14988         }
14989         return ret_conv;
14990 }
14991 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
14992         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14993         JNIEnv *env;
14994         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14995         if (get_jenv_res == JNI_EDETACHED) {
14996                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14997         } else {
14998                 DO_ASSERT(get_jenv_res == JNI_OK);
14999         }
15000         LDKStr primary_namespace_str = primary_namespace;
15001         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
15002         Str_free(primary_namespace_str);
15003         LDKStr secondary_namespace_str = secondary_namespace;
15004         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
15005         Str_free(secondary_namespace_str);
15006         LDKStr key_str = key;
15007         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
15008         Str_free(key_str);
15009         jboolean lazy_conv = lazy;
15010         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15011         CHECK(obj != NULL);
15012         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
15013         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15014                 (*env)->ExceptionDescribe(env);
15015                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
15016         }
15017         void* ret_ptr = untag_ptr(ret);
15018         CHECK_ACCESS(ret_ptr);
15019         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
15020         FREE(untag_ptr(ret));
15021         if (get_jenv_res == JNI_EDETACHED) {
15022                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15023         }
15024         return ret_conv;
15025 }
15026 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
15027         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
15028         JNIEnv *env;
15029         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15030         if (get_jenv_res == JNI_EDETACHED) {
15031                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15032         } else {
15033                 DO_ASSERT(get_jenv_res == JNI_OK);
15034         }
15035         LDKStr primary_namespace_str = primary_namespace;
15036         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
15037         Str_free(primary_namespace_str);
15038         LDKStr secondary_namespace_str = secondary_namespace;
15039         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
15040         Str_free(secondary_namespace_str);
15041         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15042         CHECK(obj != NULL);
15043         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
15044         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15045                 (*env)->ExceptionDescribe(env);
15046                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
15047         }
15048         void* ret_ptr = untag_ptr(ret);
15049         CHECK_ACCESS(ret_ptr);
15050         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
15051         FREE(untag_ptr(ret));
15052         if (get_jenv_res == JNI_EDETACHED) {
15053                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15054         }
15055         return ret_conv;
15056 }
15057 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
15058         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
15059         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15060 }
15061 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
15062         jclass c = (*env)->GetObjectClass(env, o);
15063         CHECK(c != NULL);
15064         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
15065         atomic_init(&calls->refcnt, 1);
15066         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15067         calls->o = (*env)->NewWeakGlobalRef(env, o);
15068         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
15069         CHECK(calls->read_meth != NULL);
15070         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
15071         CHECK(calls->write_meth != NULL);
15072         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
15073         CHECK(calls->remove_meth != NULL);
15074         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
15075         CHECK(calls->list_meth != NULL);
15076
15077         LDKKVStore ret = {
15078                 .this_arg = (void*) calls,
15079                 .read = read_LDKKVStore_jcall,
15080                 .write = write_LDKKVStore_jcall,
15081                 .remove = remove_LDKKVStore_jcall,
15082                 .list = list_LDKKVStore_jcall,
15083                 .free = LDKKVStore_JCalls_free,
15084         };
15085         return ret;
15086 }
15087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
15088         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
15089         *res_ptr = LDKKVStore_init(env, clz, o);
15090         return tag_ptr(res_ptr, true);
15091 }
15092 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) {
15093         void* this_arg_ptr = untag_ptr(this_arg);
15094         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15095         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
15096         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
15097         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
15098         LDKStr key_conv = java_to_owned_str(env, key);
15099         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
15100         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
15101         return tag_ptr(ret_conv, true);
15102 }
15103
15104 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) {
15105         void* this_arg_ptr = untag_ptr(this_arg);
15106         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15107         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
15108         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
15109         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
15110         LDKStr key_conv = java_to_owned_str(env, key);
15111         LDKu8slice buf_ref;
15112         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
15113         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
15114         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15115         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
15116         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
15117         return tag_ptr(ret_conv, true);
15118 }
15119
15120 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) {
15121         void* this_arg_ptr = untag_ptr(this_arg);
15122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15123         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
15124         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
15125         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
15126         LDKStr key_conv = java_to_owned_str(env, key);
15127         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15128         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
15129         return tag_ptr(ret_conv, true);
15130 }
15131
15132 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) {
15133         void* this_arg_ptr = untag_ptr(this_arg);
15134         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15135         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
15136         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
15137         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
15138         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
15139         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
15140         return tag_ptr(ret_conv, true);
15141 }
15142
15143 typedef struct LDKPersister_JCalls {
15144         atomic_size_t refcnt;
15145         JavaVM *vm;
15146         jweak o;
15147         jmethodID persist_manager_meth;
15148         jmethodID persist_graph_meth;
15149         jmethodID persist_scorer_meth;
15150 } LDKPersister_JCalls;
15151 static void LDKPersister_JCalls_free(void* this_arg) {
15152         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
15153         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15154                 JNIEnv *env;
15155                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15156                 if (get_jenv_res == JNI_EDETACHED) {
15157                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15158                 } else {
15159                         DO_ASSERT(get_jenv_res == JNI_OK);
15160                 }
15161                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15162                 if (get_jenv_res == JNI_EDETACHED) {
15163                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15164                 }
15165                 FREE(j_calls);
15166         }
15167 }
15168 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
15169         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
15170         JNIEnv *env;
15171         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15172         if (get_jenv_res == JNI_EDETACHED) {
15173                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15174         } else {
15175                 DO_ASSERT(get_jenv_res == JNI_OK);
15176         }
15177         LDKChannelManager channel_manager_var = *channel_manager;
15178         int64_t channel_manager_ref = 0;
15179         // WARNING: we may need a move here but no clone is available for LDKChannelManager
15180         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
15181         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
15182         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15183         CHECK(obj != NULL);
15184         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
15185         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15186                 (*env)->ExceptionDescribe(env);
15187                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
15188         }
15189         void* ret_ptr = untag_ptr(ret);
15190         CHECK_ACCESS(ret_ptr);
15191         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
15192         FREE(untag_ptr(ret));
15193         if (get_jenv_res == JNI_EDETACHED) {
15194                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15195         }
15196         return ret_conv;
15197 }
15198 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
15199         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
15200         JNIEnv *env;
15201         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15202         if (get_jenv_res == JNI_EDETACHED) {
15203                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15204         } else {
15205                 DO_ASSERT(get_jenv_res == JNI_OK);
15206         }
15207         LDKNetworkGraph network_graph_var = *network_graph;
15208         int64_t network_graph_ref = 0;
15209         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
15210         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
15211         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
15212         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15213         CHECK(obj != NULL);
15214         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
15215         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15216                 (*env)->ExceptionDescribe(env);
15217                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
15218         }
15219         void* ret_ptr = untag_ptr(ret);
15220         CHECK_ACCESS(ret_ptr);
15221         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
15222         FREE(untag_ptr(ret));
15223         if (get_jenv_res == JNI_EDETACHED) {
15224                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15225         }
15226         return ret_conv;
15227 }
15228 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
15229         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
15230         JNIEnv *env;
15231         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15232         if (get_jenv_res == JNI_EDETACHED) {
15233                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15234         } else {
15235                 DO_ASSERT(get_jenv_res == JNI_OK);
15236         }
15237         // WARNING: This object doesn't live past this scope, needs clone!
15238         int64_t ret_scorer = tag_ptr(scorer, false);
15239         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15240         CHECK(obj != NULL);
15241         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
15242         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15243                 (*env)->ExceptionDescribe(env);
15244                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
15245         }
15246         void* ret_ptr = untag_ptr(ret);
15247         CHECK_ACCESS(ret_ptr);
15248         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
15249         FREE(untag_ptr(ret));
15250         if (get_jenv_res == JNI_EDETACHED) {
15251                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15252         }
15253         return ret_conv;
15254 }
15255 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
15256         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
15257         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15258 }
15259 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
15260         jclass c = (*env)->GetObjectClass(env, o);
15261         CHECK(c != NULL);
15262         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
15263         atomic_init(&calls->refcnt, 1);
15264         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15265         calls->o = (*env)->NewWeakGlobalRef(env, o);
15266         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
15267         CHECK(calls->persist_manager_meth != NULL);
15268         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
15269         CHECK(calls->persist_graph_meth != NULL);
15270         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
15271         CHECK(calls->persist_scorer_meth != NULL);
15272
15273         LDKPersister ret = {
15274                 .this_arg = (void*) calls,
15275                 .persist_manager = persist_manager_LDKPersister_jcall,
15276                 .persist_graph = persist_graph_LDKPersister_jcall,
15277                 .persist_scorer = persist_scorer_LDKPersister_jcall,
15278                 .free = LDKPersister_JCalls_free,
15279         };
15280         return ret;
15281 }
15282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
15283         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
15284         *res_ptr = LDKPersister_init(env, clz, o);
15285         return tag_ptr(res_ptr, true);
15286 }
15287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
15288         void* this_arg_ptr = untag_ptr(this_arg);
15289         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15290         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15291         LDKChannelManager channel_manager_conv;
15292         channel_manager_conv.inner = untag_ptr(channel_manager);
15293         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
15294         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
15295         channel_manager_conv.is_owned = false;
15296         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15297         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
15298         return tag_ptr(ret_conv, true);
15299 }
15300
15301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
15302         void* this_arg_ptr = untag_ptr(this_arg);
15303         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15304         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15305         LDKNetworkGraph network_graph_conv;
15306         network_graph_conv.inner = untag_ptr(network_graph);
15307         network_graph_conv.is_owned = ptr_is_owned(network_graph);
15308         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
15309         network_graph_conv.is_owned = false;
15310         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15311         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
15312         return tag_ptr(ret_conv, true);
15313 }
15314
15315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
15316         void* this_arg_ptr = untag_ptr(this_arg);
15317         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15318         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
15319         void* scorer_ptr = untag_ptr(scorer);
15320         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
15321         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
15322         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
15323         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
15324         return tag_ptr(ret_conv, true);
15325 }
15326
15327 typedef struct LDKPersist_JCalls {
15328         atomic_size_t refcnt;
15329         JavaVM *vm;
15330         jweak o;
15331         jmethodID persist_new_channel_meth;
15332         jmethodID update_persisted_channel_meth;
15333 } LDKPersist_JCalls;
15334 static void LDKPersist_JCalls_free(void* this_arg) {
15335         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15336         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15337                 JNIEnv *env;
15338                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15339                 if (get_jenv_res == JNI_EDETACHED) {
15340                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15341                 } else {
15342                         DO_ASSERT(get_jenv_res == JNI_OK);
15343                 }
15344                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15345                 if (get_jenv_res == JNI_EDETACHED) {
15346                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15347                 }
15348                 FREE(j_calls);
15349         }
15350 }
15351 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
15352         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15353         JNIEnv *env;
15354         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15355         if (get_jenv_res == JNI_EDETACHED) {
15356                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15357         } else {
15358                 DO_ASSERT(get_jenv_res == JNI_OK);
15359         }
15360         LDKOutPoint channel_id_var = channel_id;
15361         int64_t channel_id_ref = 0;
15362         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15363         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
15364         LDKChannelMonitor data_var = *data;
15365         int64_t data_ref = 0;
15366         data_var = ChannelMonitor_clone(&data_var);
15367         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
15368         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
15369         LDKMonitorUpdateId update_id_var = update_id;
15370         int64_t update_id_ref = 0;
15371         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
15372         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
15373         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15374         CHECK(obj != NULL);
15375         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
15376         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15377                 (*env)->ExceptionDescribe(env);
15378                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
15379         }
15380         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
15381         if (get_jenv_res == JNI_EDETACHED) {
15382                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15383         }
15384         return ret_conv;
15385 }
15386 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
15387         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
15388         JNIEnv *env;
15389         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15390         if (get_jenv_res == JNI_EDETACHED) {
15391                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15392         } else {
15393                 DO_ASSERT(get_jenv_res == JNI_OK);
15394         }
15395         LDKOutPoint channel_id_var = channel_id;
15396         int64_t channel_id_ref = 0;
15397         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15398         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
15399         LDKChannelMonitorUpdate update_var = update;
15400         int64_t update_ref = 0;
15401         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
15402         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
15403         LDKChannelMonitor data_var = *data;
15404         int64_t data_ref = 0;
15405         data_var = ChannelMonitor_clone(&data_var);
15406         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
15407         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
15408         LDKMonitorUpdateId update_id_var = update_id;
15409         int64_t update_id_ref = 0;
15410         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
15411         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
15412         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15413         CHECK(obj != NULL);
15414         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
15415         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15416                 (*env)->ExceptionDescribe(env);
15417                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
15418         }
15419         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
15420         if (get_jenv_res == JNI_EDETACHED) {
15421                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15422         }
15423         return ret_conv;
15424 }
15425 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
15426         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
15427         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15428 }
15429 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
15430         jclass c = (*env)->GetObjectClass(env, o);
15431         CHECK(c != NULL);
15432         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
15433         atomic_init(&calls->refcnt, 1);
15434         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15435         calls->o = (*env)->NewWeakGlobalRef(env, o);
15436         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
15437         CHECK(calls->persist_new_channel_meth != NULL);
15438         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
15439         CHECK(calls->update_persisted_channel_meth != NULL);
15440
15441         LDKPersist ret = {
15442                 .this_arg = (void*) calls,
15443                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
15444                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
15445                 .free = LDKPersist_JCalls_free,
15446         };
15447         return ret;
15448 }
15449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
15450         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
15451         *res_ptr = LDKPersist_init(env, clz, o);
15452         return tag_ptr(res_ptr, true);
15453 }
15454 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
15455         void* this_arg_ptr = untag_ptr(this_arg);
15456         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15457         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
15458         LDKOutPoint channel_id_conv;
15459         channel_id_conv.inner = untag_ptr(channel_id);
15460         channel_id_conv.is_owned = ptr_is_owned(channel_id);
15461         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
15462         channel_id_conv = OutPoint_clone(&channel_id_conv);
15463         LDKChannelMonitor data_conv;
15464         data_conv.inner = untag_ptr(data);
15465         data_conv.is_owned = ptr_is_owned(data);
15466         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
15467         data_conv.is_owned = false;
15468         LDKMonitorUpdateId update_id_conv;
15469         update_id_conv.inner = untag_ptr(update_id);
15470         update_id_conv.is_owned = ptr_is_owned(update_id);
15471         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
15472         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
15473         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
15474         return ret_conv;
15475 }
15476
15477 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
15478         void* this_arg_ptr = untag_ptr(this_arg);
15479         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15480         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
15481         LDKOutPoint channel_id_conv;
15482         channel_id_conv.inner = untag_ptr(channel_id);
15483         channel_id_conv.is_owned = ptr_is_owned(channel_id);
15484         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
15485         channel_id_conv = OutPoint_clone(&channel_id_conv);
15486         LDKChannelMonitorUpdate update_conv;
15487         update_conv.inner = untag_ptr(update);
15488         update_conv.is_owned = ptr_is_owned(update);
15489         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
15490         update_conv = ChannelMonitorUpdate_clone(&update_conv);
15491         LDKChannelMonitor data_conv;
15492         data_conv.inner = untag_ptr(data);
15493         data_conv.is_owned = ptr_is_owned(data);
15494         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
15495         data_conv.is_owned = false;
15496         LDKMonitorUpdateId update_id_conv;
15497         update_id_conv.inner = untag_ptr(update_id);
15498         update_id_conv.is_owned = ptr_is_owned(update_id);
15499         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
15500         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
15501         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv));
15502         return ret_conv;
15503 }
15504
15505 typedef struct LDKFutureCallback_JCalls {
15506         atomic_size_t refcnt;
15507         JavaVM *vm;
15508         jweak o;
15509         jmethodID call_meth;
15510 } LDKFutureCallback_JCalls;
15511 static void LDKFutureCallback_JCalls_free(void* this_arg) {
15512         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15513         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15514                 JNIEnv *env;
15515                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15516                 if (get_jenv_res == JNI_EDETACHED) {
15517                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15518                 } else {
15519                         DO_ASSERT(get_jenv_res == JNI_OK);
15520                 }
15521                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15522                 if (get_jenv_res == JNI_EDETACHED) {
15523                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15524                 }
15525                 FREE(j_calls);
15526         }
15527 }
15528 void call_LDKFutureCallback_jcall(const void* this_arg) {
15529         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15530         JNIEnv *env;
15531         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15532         if (get_jenv_res == JNI_EDETACHED) {
15533                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15534         } else {
15535                 DO_ASSERT(get_jenv_res == JNI_OK);
15536         }
15537         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15538         CHECK(obj != NULL);
15539         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
15540         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15541                 (*env)->ExceptionDescribe(env);
15542                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
15543         }
15544         if (get_jenv_res == JNI_EDETACHED) {
15545                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15546         }
15547 }
15548 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
15549         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
15550         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15551 }
15552 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
15553         jclass c = (*env)->GetObjectClass(env, o);
15554         CHECK(c != NULL);
15555         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
15556         atomic_init(&calls->refcnt, 1);
15557         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15558         calls->o = (*env)->NewWeakGlobalRef(env, o);
15559         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
15560         CHECK(calls->call_meth != NULL);
15561
15562         LDKFutureCallback ret = {
15563                 .this_arg = (void*) calls,
15564                 .call = call_LDKFutureCallback_jcall,
15565                 .free = LDKFutureCallback_JCalls_free,
15566         };
15567         return ret;
15568 }
15569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
15570         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
15571         *res_ptr = LDKFutureCallback_init(env, clz, o);
15572         return tag_ptr(res_ptr, true);
15573 }
15574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
15575         void* this_arg_ptr = untag_ptr(this_arg);
15576         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15577         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
15578         (this_arg_conv->call)(this_arg_conv->this_arg);
15579 }
15580
15581 typedef struct LDKListen_JCalls {
15582         atomic_size_t refcnt;
15583         JavaVM *vm;
15584         jweak o;
15585         jmethodID filtered_block_connected_meth;
15586         jmethodID block_connected_meth;
15587         jmethodID block_disconnected_meth;
15588 } LDKListen_JCalls;
15589 static void LDKListen_JCalls_free(void* this_arg) {
15590         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15591         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15592                 JNIEnv *env;
15593                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15594                 if (get_jenv_res == JNI_EDETACHED) {
15595                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15596                 } else {
15597                         DO_ASSERT(get_jenv_res == JNI_OK);
15598                 }
15599                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15600                 if (get_jenv_res == JNI_EDETACHED) {
15601                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15602                 }
15603                 FREE(j_calls);
15604         }
15605 }
15606 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15607         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15608         JNIEnv *env;
15609         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15610         if (get_jenv_res == JNI_EDETACHED) {
15611                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15612         } else {
15613                 DO_ASSERT(get_jenv_res == JNI_OK);
15614         }
15615         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15616         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15617         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15618         int64_tArray txdata_arr = NULL;
15619         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
15620         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
15621         for (size_t c = 0; c < txdata_var.datalen; c++) {
15622                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15623                 *txdata_conv_28_conv = txdata_var.data[c];
15624                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15625         }
15626         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
15627         FREE(txdata_var.data);
15628         int32_t height_conv = height;
15629         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15630         CHECK(obj != NULL);
15631         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
15632         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15633                 (*env)->ExceptionDescribe(env);
15634                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
15635         }
15636         if (get_jenv_res == JNI_EDETACHED) {
15637                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15638         }
15639 }
15640 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
15641         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15642         JNIEnv *env;
15643         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15644         if (get_jenv_res == JNI_EDETACHED) {
15645                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15646         } else {
15647                 DO_ASSERT(get_jenv_res == JNI_OK);
15648         }
15649         LDKu8slice block_var = block;
15650         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
15651         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
15652         int32_t height_conv = height;
15653         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15654         CHECK(obj != NULL);
15655         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
15656         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15657                 (*env)->ExceptionDescribe(env);
15658                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
15659         }
15660         if (get_jenv_res == JNI_EDETACHED) {
15661                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15662         }
15663 }
15664 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15665         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
15666         JNIEnv *env;
15667         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15668         if (get_jenv_res == JNI_EDETACHED) {
15669                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15670         } else {
15671                 DO_ASSERT(get_jenv_res == JNI_OK);
15672         }
15673         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15674         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15675         int32_t height_conv = height;
15676         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15677         CHECK(obj != NULL);
15678         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
15679         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15680                 (*env)->ExceptionDescribe(env);
15681                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
15682         }
15683         if (get_jenv_res == JNI_EDETACHED) {
15684                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15685         }
15686 }
15687 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
15688         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
15689         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15690 }
15691 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
15692         jclass c = (*env)->GetObjectClass(env, o);
15693         CHECK(c != NULL);
15694         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
15695         atomic_init(&calls->refcnt, 1);
15696         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15697         calls->o = (*env)->NewWeakGlobalRef(env, o);
15698         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
15699         CHECK(calls->filtered_block_connected_meth != NULL);
15700         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
15701         CHECK(calls->block_connected_meth != NULL);
15702         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
15703         CHECK(calls->block_disconnected_meth != NULL);
15704
15705         LDKListen ret = {
15706                 .this_arg = (void*) calls,
15707                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
15708                 .block_connected = block_connected_LDKListen_jcall,
15709                 .block_disconnected = block_disconnected_LDKListen_jcall,
15710                 .free = LDKListen_JCalls_free,
15711         };
15712         return ret;
15713 }
15714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
15715         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
15716         *res_ptr = LDKListen_init(env, clz, o);
15717         return tag_ptr(res_ptr, true);
15718 }
15719 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) {
15720         void* this_arg_ptr = untag_ptr(this_arg);
15721         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15722         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15723         uint8_t header_arr[80];
15724         CHECK((*env)->GetArrayLength(env, header) == 80);
15725         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15726         uint8_t (*header_ref)[80] = &header_arr;
15727         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15728         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15729         if (txdata_constr.datalen > 0)
15730                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15731         else
15732                 txdata_constr.data = NULL;
15733         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15734         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15735                 int64_t txdata_conv_28 = txdata_vals[c];
15736                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15737                 CHECK_ACCESS(txdata_conv_28_ptr);
15738                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15739                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15740                 txdata_constr.data[c] = txdata_conv_28_conv;
15741         }
15742         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15743         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15744 }
15745
15746 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) {
15747         void* this_arg_ptr = untag_ptr(this_arg);
15748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15749         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15750         LDKu8slice block_ref;
15751         block_ref.datalen = (*env)->GetArrayLength(env, block);
15752         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
15753         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
15754         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
15755 }
15756
15757 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) {
15758         void* this_arg_ptr = untag_ptr(this_arg);
15759         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15760         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15761         uint8_t header_arr[80];
15762         CHECK((*env)->GetArrayLength(env, header) == 80);
15763         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15764         uint8_t (*header_ref)[80] = &header_arr;
15765         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
15766 }
15767
15768 typedef struct LDKConfirm_JCalls {
15769         atomic_size_t refcnt;
15770         JavaVM *vm;
15771         jweak o;
15772         jmethodID transactions_confirmed_meth;
15773         jmethodID transaction_unconfirmed_meth;
15774         jmethodID best_block_updated_meth;
15775         jmethodID get_relevant_txids_meth;
15776 } LDKConfirm_JCalls;
15777 static void LDKConfirm_JCalls_free(void* this_arg) {
15778         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15779         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15780                 JNIEnv *env;
15781                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15782                 if (get_jenv_res == JNI_EDETACHED) {
15783                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15784                 } else {
15785                         DO_ASSERT(get_jenv_res == JNI_OK);
15786                 }
15787                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15788                 if (get_jenv_res == JNI_EDETACHED) {
15789                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15790                 }
15791                 FREE(j_calls);
15792         }
15793 }
15794 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15795         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15796         JNIEnv *env;
15797         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15798         if (get_jenv_res == JNI_EDETACHED) {
15799                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15800         } else {
15801                 DO_ASSERT(get_jenv_res == JNI_OK);
15802         }
15803         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15804         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15805         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15806         int64_tArray txdata_arr = NULL;
15807         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
15808         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
15809         for (size_t c = 0; c < txdata_var.datalen; c++) {
15810                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15811                 *txdata_conv_28_conv = txdata_var.data[c];
15812                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15813         }
15814         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
15815         FREE(txdata_var.data);
15816         int32_t height_conv = height;
15817         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15818         CHECK(obj != NULL);
15819         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
15820         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15821                 (*env)->ExceptionDescribe(env);
15822                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
15823         }
15824         if (get_jenv_res == JNI_EDETACHED) {
15825                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15826         }
15827 }
15828 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
15829         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15830         JNIEnv *env;
15831         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15832         if (get_jenv_res == JNI_EDETACHED) {
15833                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15834         } else {
15835                 DO_ASSERT(get_jenv_res == JNI_OK);
15836         }
15837         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
15838         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
15839         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15840         CHECK(obj != NULL);
15841         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
15842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15843                 (*env)->ExceptionDescribe(env);
15844                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
15845         }
15846         if (get_jenv_res == JNI_EDETACHED) {
15847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15848         }
15849 }
15850 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15851         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15852         JNIEnv *env;
15853         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15854         if (get_jenv_res == JNI_EDETACHED) {
15855                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15856         } else {
15857                 DO_ASSERT(get_jenv_res == JNI_OK);
15858         }
15859         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
15860         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
15861         int32_t height_conv = height;
15862         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15863         CHECK(obj != NULL);
15864         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
15865         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15866                 (*env)->ExceptionDescribe(env);
15867                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
15868         }
15869         if (get_jenv_res == JNI_EDETACHED) {
15870                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15871         }
15872 }
15873 LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
15874         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15875         JNIEnv *env;
15876         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15877         if (get_jenv_res == JNI_EDETACHED) {
15878                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15879         } else {
15880                 DO_ASSERT(get_jenv_res == JNI_OK);
15881         }
15882         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15883         CHECK(obj != NULL);
15884         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
15885         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15886                 (*env)->ExceptionDescribe(env);
15887                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
15888         }
15889         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_constr;
15890         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
15891         if (ret_constr.datalen > 0)
15892                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
15893         else
15894                 ret_constr.data = NULL;
15895         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
15896         for (size_t x = 0; x < ret_constr.datalen; x++) {
15897                 int64_t ret_conv_49 = ret_vals[x];
15898                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
15899                 CHECK_ACCESS(ret_conv_49_ptr);
15900                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ ret_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(ret_conv_49_ptr);
15901                 FREE(untag_ptr(ret_conv_49));
15902                 ret_constr.data[x] = ret_conv_49_conv;
15903         }
15904         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
15905         if (get_jenv_res == JNI_EDETACHED) {
15906                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15907         }
15908         return ret_constr;
15909 }
15910 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
15911         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
15912         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15913 }
15914 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
15915         jclass c = (*env)->GetObjectClass(env, o);
15916         CHECK(c != NULL);
15917         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
15918         atomic_init(&calls->refcnt, 1);
15919         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15920         calls->o = (*env)->NewWeakGlobalRef(env, o);
15921         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
15922         CHECK(calls->transactions_confirmed_meth != NULL);
15923         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
15924         CHECK(calls->transaction_unconfirmed_meth != NULL);
15925         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
15926         CHECK(calls->best_block_updated_meth != NULL);
15927         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
15928         CHECK(calls->get_relevant_txids_meth != NULL);
15929
15930         LDKConfirm ret = {
15931                 .this_arg = (void*) calls,
15932                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
15933                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
15934                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
15935                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
15936                 .free = LDKConfirm_JCalls_free,
15937         };
15938         return ret;
15939 }
15940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
15941         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15942         *res_ptr = LDKConfirm_init(env, clz, o);
15943         return tag_ptr(res_ptr, true);
15944 }
15945 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) {
15946         void* this_arg_ptr = untag_ptr(this_arg);
15947         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15948         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15949         uint8_t header_arr[80];
15950         CHECK((*env)->GetArrayLength(env, header) == 80);
15951         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15952         uint8_t (*header_ref)[80] = &header_arr;
15953         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15954         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15955         if (txdata_constr.datalen > 0)
15956                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15957         else
15958                 txdata_constr.data = NULL;
15959         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15960         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15961                 int64_t txdata_conv_28 = txdata_vals[c];
15962                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15963                 CHECK_ACCESS(txdata_conv_28_ptr);
15964                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15965                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15966                 txdata_constr.data[c] = txdata_conv_28_conv;
15967         }
15968         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15969         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15970 }
15971
15972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
15973         void* this_arg_ptr = untag_ptr(this_arg);
15974         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15975         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15976         uint8_t txid_arr[32];
15977         CHECK((*env)->GetArrayLength(env, txid) == 32);
15978         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
15979         uint8_t (*txid_ref)[32] = &txid_arr;
15980         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
15981 }
15982
15983 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) {
15984         void* this_arg_ptr = untag_ptr(this_arg);
15985         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15986         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15987         uint8_t header_arr[80];
15988         CHECK((*env)->GetArrayLength(env, header) == 80);
15989         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15990         uint8_t (*header_ref)[80] = &header_arr;
15991         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
15992 }
15993
15994 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
15995         void* this_arg_ptr = untag_ptr(this_arg);
15996         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15997         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15998         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
15999         int64_tArray ret_arr = NULL;
16000         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16001         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16002         for (size_t x = 0; x < ret_var.datalen; x++) {
16003                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
16004                 *ret_conv_49_conv = ret_var.data[x];
16005                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
16006         }
16007         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16008         FREE(ret_var.data);
16009         return ret_arr;
16010 }
16011
16012 typedef struct LDKEventHandler_JCalls {
16013         atomic_size_t refcnt;
16014         JavaVM *vm;
16015         jweak o;
16016         jmethodID handle_event_meth;
16017 } LDKEventHandler_JCalls;
16018 static void LDKEventHandler_JCalls_free(void* this_arg) {
16019         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
16020         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16021                 JNIEnv *env;
16022                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16023                 if (get_jenv_res == JNI_EDETACHED) {
16024                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16025                 } else {
16026                         DO_ASSERT(get_jenv_res == JNI_OK);
16027                 }
16028                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16029                 if (get_jenv_res == JNI_EDETACHED) {
16030                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16031                 }
16032                 FREE(j_calls);
16033         }
16034 }
16035 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
16036         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
16037         JNIEnv *env;
16038         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16039         if (get_jenv_res == JNI_EDETACHED) {
16040                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16041         } else {
16042                 DO_ASSERT(get_jenv_res == JNI_OK);
16043         }
16044         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16045         *event_copy = event;
16046         int64_t event_ref = tag_ptr(event_copy, true);
16047         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16048         CHECK(obj != NULL);
16049         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
16050         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16051                 (*env)->ExceptionDescribe(env);
16052                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
16053         }
16054         if (get_jenv_res == JNI_EDETACHED) {
16055                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16056         }
16057 }
16058 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
16059         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
16060         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16061 }
16062 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
16063         jclass c = (*env)->GetObjectClass(env, o);
16064         CHECK(c != NULL);
16065         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
16066         atomic_init(&calls->refcnt, 1);
16067         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16068         calls->o = (*env)->NewWeakGlobalRef(env, o);
16069         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
16070         CHECK(calls->handle_event_meth != NULL);
16071
16072         LDKEventHandler ret = {
16073                 .this_arg = (void*) calls,
16074                 .handle_event = handle_event_LDKEventHandler_jcall,
16075                 .free = LDKEventHandler_JCalls_free,
16076         };
16077         return ret;
16078 }
16079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
16080         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
16081         *res_ptr = LDKEventHandler_init(env, clz, o);
16082         return tag_ptr(res_ptr, true);
16083 }
16084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
16085         void* this_arg_ptr = untag_ptr(this_arg);
16086         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16087         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
16088         void* event_ptr = untag_ptr(event);
16089         CHECK_ACCESS(event_ptr);
16090         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
16091         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
16092         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
16093 }
16094
16095 typedef struct LDKEventsProvider_JCalls {
16096         atomic_size_t refcnt;
16097         JavaVM *vm;
16098         jweak o;
16099         jmethodID process_pending_events_meth;
16100 } LDKEventsProvider_JCalls;
16101 static void LDKEventsProvider_JCalls_free(void* this_arg) {
16102         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
16103         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16104                 JNIEnv *env;
16105                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16106                 if (get_jenv_res == JNI_EDETACHED) {
16107                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16108                 } else {
16109                         DO_ASSERT(get_jenv_res == JNI_OK);
16110                 }
16111                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16112                 if (get_jenv_res == JNI_EDETACHED) {
16113                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16114                 }
16115                 FREE(j_calls);
16116         }
16117 }
16118 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
16119         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
16120         JNIEnv *env;
16121         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16122         if (get_jenv_res == JNI_EDETACHED) {
16123                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16124         } else {
16125                 DO_ASSERT(get_jenv_res == JNI_OK);
16126         }
16127         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
16128         *handler_ret = handler;
16129         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16130         CHECK(obj != NULL);
16131         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
16132         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16133                 (*env)->ExceptionDescribe(env);
16134                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
16135         }
16136         if (get_jenv_res == JNI_EDETACHED) {
16137                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16138         }
16139 }
16140 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
16141         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
16142         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16143 }
16144 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
16145         jclass c = (*env)->GetObjectClass(env, o);
16146         CHECK(c != NULL);
16147         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
16148         atomic_init(&calls->refcnt, 1);
16149         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16150         calls->o = (*env)->NewWeakGlobalRef(env, o);
16151         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
16152         CHECK(calls->process_pending_events_meth != NULL);
16153
16154         LDKEventsProvider ret = {
16155                 .this_arg = (void*) calls,
16156                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
16157                 .free = LDKEventsProvider_JCalls_free,
16158         };
16159         return ret;
16160 }
16161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
16162         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16163         *res_ptr = LDKEventsProvider_init(env, clz, o);
16164         return tag_ptr(res_ptr, true);
16165 }
16166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
16167         void* this_arg_ptr = untag_ptr(this_arg);
16168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16169         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
16170         void* handler_ptr = untag_ptr(handler);
16171         CHECK_ACCESS(handler_ptr);
16172         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
16173         if (handler_conv.free == LDKEventHandler_JCalls_free) {
16174                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16175                 LDKEventHandler_JCalls_cloned(&handler_conv);
16176         }
16177         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
16178 }
16179
16180 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
16181 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
16182 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
16183 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
16184 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
16185 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
16186 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
16187 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
16188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
16189         LDKFailureCode_TemporaryNodeFailure_class =
16190                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
16191         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
16192         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
16193         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
16194         LDKFailureCode_RequiredNodeFeatureMissing_class =
16195                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
16196         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
16197         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
16198         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
16199         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
16200                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
16201         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
16202         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
16203         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
16204         LDKFailureCode_InvalidOnionPayload_class =
16205                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
16206         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
16207         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
16208         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
16209 }
16210 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16211         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
16212         switch(obj->tag) {
16213                 case LDKFailureCode_TemporaryNodeFailure: {
16214                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
16215                 }
16216                 case LDKFailureCode_RequiredNodeFeatureMissing: {
16217                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
16218                 }
16219                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
16220                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
16221                 }
16222                 case LDKFailureCode_InvalidOnionPayload: {
16223                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
16224                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
16225                 }
16226                 default: abort();
16227         }
16228 }
16229 typedef struct LDKMessageSendEventsProvider_JCalls {
16230         atomic_size_t refcnt;
16231         JavaVM *vm;
16232         jweak o;
16233         jmethodID get_and_clear_pending_msg_events_meth;
16234 } LDKMessageSendEventsProvider_JCalls;
16235 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
16236         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
16237         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16238                 JNIEnv *env;
16239                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16240                 if (get_jenv_res == JNI_EDETACHED) {
16241                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16242                 } else {
16243                         DO_ASSERT(get_jenv_res == JNI_OK);
16244                 }
16245                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16246                 if (get_jenv_res == JNI_EDETACHED) {
16247                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16248                 }
16249                 FREE(j_calls);
16250         }
16251 }
16252 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
16253         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
16254         JNIEnv *env;
16255         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16256         if (get_jenv_res == JNI_EDETACHED) {
16257                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16258         } else {
16259                 DO_ASSERT(get_jenv_res == JNI_OK);
16260         }
16261         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16262         CHECK(obj != NULL);
16263         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
16264         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16265                 (*env)->ExceptionDescribe(env);
16266                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
16267         }
16268         LDKCVec_MessageSendEventZ ret_constr;
16269         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
16270         if (ret_constr.datalen > 0)
16271                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
16272         else
16273                 ret_constr.data = NULL;
16274         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
16275         for (size_t s = 0; s < ret_constr.datalen; s++) {
16276                 int64_t ret_conv_18 = ret_vals[s];
16277                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
16278                 CHECK_ACCESS(ret_conv_18_ptr);
16279                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
16280                 FREE(untag_ptr(ret_conv_18));
16281                 ret_constr.data[s] = ret_conv_18_conv;
16282         }
16283         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
16284         if (get_jenv_res == JNI_EDETACHED) {
16285                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16286         }
16287         return ret_constr;
16288 }
16289 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
16290         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
16291         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16292 }
16293 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
16294         jclass c = (*env)->GetObjectClass(env, o);
16295         CHECK(c != NULL);
16296         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
16297         atomic_init(&calls->refcnt, 1);
16298         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16299         calls->o = (*env)->NewWeakGlobalRef(env, o);
16300         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
16301         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
16302
16303         LDKMessageSendEventsProvider ret = {
16304                 .this_arg = (void*) calls,
16305                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
16306                 .free = LDKMessageSendEventsProvider_JCalls_free,
16307         };
16308         return ret;
16309 }
16310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
16311         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16312         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
16313         return tag_ptr(res_ptr, true);
16314 }
16315 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16316         void* this_arg_ptr = untag_ptr(this_arg);
16317         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16318         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
16319         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
16320         int64_tArray ret_arr = NULL;
16321         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16322         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16323         for (size_t s = 0; s < ret_var.datalen; s++) {
16324                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16325                 *ret_conv_18_copy = ret_var.data[s];
16326                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
16327                 ret_arr_ptr[s] = ret_conv_18_ref;
16328         }
16329         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16330         FREE(ret_var.data);
16331         return ret_arr;
16332 }
16333
16334 typedef struct LDKChannelMessageHandler_JCalls {
16335         atomic_size_t refcnt;
16336         JavaVM *vm;
16337         jweak o;
16338         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16339         jmethodID handle_open_channel_meth;
16340         jmethodID handle_open_channel_v2_meth;
16341         jmethodID handle_accept_channel_meth;
16342         jmethodID handle_accept_channel_v2_meth;
16343         jmethodID handle_funding_created_meth;
16344         jmethodID handle_funding_signed_meth;
16345         jmethodID handle_channel_ready_meth;
16346         jmethodID handle_shutdown_meth;
16347         jmethodID handle_closing_signed_meth;
16348         jmethodID handle_tx_add_input_meth;
16349         jmethodID handle_tx_add_output_meth;
16350         jmethodID handle_tx_remove_input_meth;
16351         jmethodID handle_tx_remove_output_meth;
16352         jmethodID handle_tx_complete_meth;
16353         jmethodID handle_tx_signatures_meth;
16354         jmethodID handle_tx_init_rbf_meth;
16355         jmethodID handle_tx_ack_rbf_meth;
16356         jmethodID handle_tx_abort_meth;
16357         jmethodID handle_update_add_htlc_meth;
16358         jmethodID handle_update_fulfill_htlc_meth;
16359         jmethodID handle_update_fail_htlc_meth;
16360         jmethodID handle_update_fail_malformed_htlc_meth;
16361         jmethodID handle_commitment_signed_meth;
16362         jmethodID handle_revoke_and_ack_meth;
16363         jmethodID handle_update_fee_meth;
16364         jmethodID handle_announcement_signatures_meth;
16365         jmethodID peer_disconnected_meth;
16366         jmethodID peer_connected_meth;
16367         jmethodID handle_channel_reestablish_meth;
16368         jmethodID handle_channel_update_meth;
16369         jmethodID handle_error_meth;
16370         jmethodID provided_node_features_meth;
16371         jmethodID provided_init_features_meth;
16372         jmethodID get_chain_hashes_meth;
16373 } LDKChannelMessageHandler_JCalls;
16374 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
16375         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16376         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16377                 JNIEnv *env;
16378                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16379                 if (get_jenv_res == JNI_EDETACHED) {
16380                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16381                 } else {
16382                         DO_ASSERT(get_jenv_res == JNI_OK);
16383                 }
16384                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16385                 if (get_jenv_res == JNI_EDETACHED) {
16386                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16387                 }
16388                 FREE(j_calls);
16389         }
16390 }
16391 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
16392         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16393         JNIEnv *env;
16394         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16395         if (get_jenv_res == JNI_EDETACHED) {
16396                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16397         } else {
16398                 DO_ASSERT(get_jenv_res == JNI_OK);
16399         }
16400         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16401         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16402         LDKOpenChannel msg_var = *msg;
16403         int64_t msg_ref = 0;
16404         msg_var = OpenChannel_clone(&msg_var);
16405         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16406         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16407         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16408         CHECK(obj != NULL);
16409         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
16410         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16411                 (*env)->ExceptionDescribe(env);
16412                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
16413         }
16414         if (get_jenv_res == JNI_EDETACHED) {
16415                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16416         }
16417 }
16418 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
16419         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16420         JNIEnv *env;
16421         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16422         if (get_jenv_res == JNI_EDETACHED) {
16423                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16424         } else {
16425                 DO_ASSERT(get_jenv_res == JNI_OK);
16426         }
16427         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16428         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16429         LDKOpenChannelV2 msg_var = *msg;
16430         int64_t msg_ref = 0;
16431         msg_var = OpenChannelV2_clone(&msg_var);
16432         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16433         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16434         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16435         CHECK(obj != NULL);
16436         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
16437         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16438                 (*env)->ExceptionDescribe(env);
16439                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
16440         }
16441         if (get_jenv_res == JNI_EDETACHED) {
16442                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16443         }
16444 }
16445 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
16446         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16447         JNIEnv *env;
16448         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16449         if (get_jenv_res == JNI_EDETACHED) {
16450                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16451         } else {
16452                 DO_ASSERT(get_jenv_res == JNI_OK);
16453         }
16454         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16455         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16456         LDKAcceptChannel msg_var = *msg;
16457         int64_t msg_ref = 0;
16458         msg_var = AcceptChannel_clone(&msg_var);
16459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16460         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16461         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16462         CHECK(obj != NULL);
16463         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
16464         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16465                 (*env)->ExceptionDescribe(env);
16466                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
16467         }
16468         if (get_jenv_res == JNI_EDETACHED) {
16469                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16470         }
16471 }
16472 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
16473         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16474         JNIEnv *env;
16475         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16476         if (get_jenv_res == JNI_EDETACHED) {
16477                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16478         } else {
16479                 DO_ASSERT(get_jenv_res == JNI_OK);
16480         }
16481         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16482         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16483         LDKAcceptChannelV2 msg_var = *msg;
16484         int64_t msg_ref = 0;
16485         msg_var = AcceptChannelV2_clone(&msg_var);
16486         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16487         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16488         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16489         CHECK(obj != NULL);
16490         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
16491         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16492                 (*env)->ExceptionDescribe(env);
16493                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
16494         }
16495         if (get_jenv_res == JNI_EDETACHED) {
16496                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16497         }
16498 }
16499 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
16500         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16501         JNIEnv *env;
16502         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16503         if (get_jenv_res == JNI_EDETACHED) {
16504                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16505         } else {
16506                 DO_ASSERT(get_jenv_res == JNI_OK);
16507         }
16508         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16509         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16510         LDKFundingCreated msg_var = *msg;
16511         int64_t msg_ref = 0;
16512         msg_var = FundingCreated_clone(&msg_var);
16513         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16514         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16515         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16516         CHECK(obj != NULL);
16517         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
16518         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16519                 (*env)->ExceptionDescribe(env);
16520                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
16521         }
16522         if (get_jenv_res == JNI_EDETACHED) {
16523                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16524         }
16525 }
16526 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
16527         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16528         JNIEnv *env;
16529         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16530         if (get_jenv_res == JNI_EDETACHED) {
16531                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16532         } else {
16533                 DO_ASSERT(get_jenv_res == JNI_OK);
16534         }
16535         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16536         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16537         LDKFundingSigned msg_var = *msg;
16538         int64_t msg_ref = 0;
16539         msg_var = FundingSigned_clone(&msg_var);
16540         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16541         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16542         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16543         CHECK(obj != NULL);
16544         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
16545         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16546                 (*env)->ExceptionDescribe(env);
16547                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
16548         }
16549         if (get_jenv_res == JNI_EDETACHED) {
16550                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16551         }
16552 }
16553 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
16554         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16555         JNIEnv *env;
16556         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16557         if (get_jenv_res == JNI_EDETACHED) {
16558                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16559         } else {
16560                 DO_ASSERT(get_jenv_res == JNI_OK);
16561         }
16562         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16563         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16564         LDKChannelReady msg_var = *msg;
16565         int64_t msg_ref = 0;
16566         msg_var = ChannelReady_clone(&msg_var);
16567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16568         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16569         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16570         CHECK(obj != NULL);
16571         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
16572         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16573                 (*env)->ExceptionDescribe(env);
16574                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
16575         }
16576         if (get_jenv_res == JNI_EDETACHED) {
16577                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16578         }
16579 }
16580 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
16581         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16582         JNIEnv *env;
16583         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16584         if (get_jenv_res == JNI_EDETACHED) {
16585                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16586         } else {
16587                 DO_ASSERT(get_jenv_res == JNI_OK);
16588         }
16589         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16590         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16591         LDKShutdown msg_var = *msg;
16592         int64_t msg_ref = 0;
16593         msg_var = Shutdown_clone(&msg_var);
16594         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16595         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16596         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16597         CHECK(obj != NULL);
16598         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
16599         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16600                 (*env)->ExceptionDescribe(env);
16601                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
16602         }
16603         if (get_jenv_res == JNI_EDETACHED) {
16604                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16605         }
16606 }
16607 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
16608         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16609         JNIEnv *env;
16610         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16611         if (get_jenv_res == JNI_EDETACHED) {
16612                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16613         } else {
16614                 DO_ASSERT(get_jenv_res == JNI_OK);
16615         }
16616         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16617         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16618         LDKClosingSigned msg_var = *msg;
16619         int64_t msg_ref = 0;
16620         msg_var = ClosingSigned_clone(&msg_var);
16621         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16622         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16623         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16624         CHECK(obj != NULL);
16625         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
16626         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16627                 (*env)->ExceptionDescribe(env);
16628                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
16629         }
16630         if (get_jenv_res == JNI_EDETACHED) {
16631                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16632         }
16633 }
16634 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
16635         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16636         JNIEnv *env;
16637         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16638         if (get_jenv_res == JNI_EDETACHED) {
16639                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16640         } else {
16641                 DO_ASSERT(get_jenv_res == JNI_OK);
16642         }
16643         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16644         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16645         LDKTxAddInput msg_var = *msg;
16646         int64_t msg_ref = 0;
16647         msg_var = TxAddInput_clone(&msg_var);
16648         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16649         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16650         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16651         CHECK(obj != NULL);
16652         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
16653         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16654                 (*env)->ExceptionDescribe(env);
16655                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
16656         }
16657         if (get_jenv_res == JNI_EDETACHED) {
16658                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16659         }
16660 }
16661 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
16662         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16663         JNIEnv *env;
16664         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16665         if (get_jenv_res == JNI_EDETACHED) {
16666                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16667         } else {
16668                 DO_ASSERT(get_jenv_res == JNI_OK);
16669         }
16670         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16671         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16672         LDKTxAddOutput msg_var = *msg;
16673         int64_t msg_ref = 0;
16674         msg_var = TxAddOutput_clone(&msg_var);
16675         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16676         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16677         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16678         CHECK(obj != NULL);
16679         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
16680         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16681                 (*env)->ExceptionDescribe(env);
16682                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
16683         }
16684         if (get_jenv_res == JNI_EDETACHED) {
16685                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16686         }
16687 }
16688 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
16689         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16690         JNIEnv *env;
16691         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16692         if (get_jenv_res == JNI_EDETACHED) {
16693                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16694         } else {
16695                 DO_ASSERT(get_jenv_res == JNI_OK);
16696         }
16697         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16698         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16699         LDKTxRemoveInput msg_var = *msg;
16700         int64_t msg_ref = 0;
16701         msg_var = TxRemoveInput_clone(&msg_var);
16702         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16703         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16704         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16705         CHECK(obj != NULL);
16706         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
16707         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16708                 (*env)->ExceptionDescribe(env);
16709                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
16710         }
16711         if (get_jenv_res == JNI_EDETACHED) {
16712                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16713         }
16714 }
16715 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
16716         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16717         JNIEnv *env;
16718         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16719         if (get_jenv_res == JNI_EDETACHED) {
16720                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16721         } else {
16722                 DO_ASSERT(get_jenv_res == JNI_OK);
16723         }
16724         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16725         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16726         LDKTxRemoveOutput msg_var = *msg;
16727         int64_t msg_ref = 0;
16728         msg_var = TxRemoveOutput_clone(&msg_var);
16729         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16730         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16731         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16732         CHECK(obj != NULL);
16733         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
16734         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16735                 (*env)->ExceptionDescribe(env);
16736                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
16737         }
16738         if (get_jenv_res == JNI_EDETACHED) {
16739                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16740         }
16741 }
16742 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
16743         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16744         JNIEnv *env;
16745         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16746         if (get_jenv_res == JNI_EDETACHED) {
16747                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16748         } else {
16749                 DO_ASSERT(get_jenv_res == JNI_OK);
16750         }
16751         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16752         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16753         LDKTxComplete msg_var = *msg;
16754         int64_t msg_ref = 0;
16755         msg_var = TxComplete_clone(&msg_var);
16756         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16757         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16758         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16759         CHECK(obj != NULL);
16760         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
16761         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16762                 (*env)->ExceptionDescribe(env);
16763                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
16764         }
16765         if (get_jenv_res == JNI_EDETACHED) {
16766                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16767         }
16768 }
16769 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
16770         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16771         JNIEnv *env;
16772         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16773         if (get_jenv_res == JNI_EDETACHED) {
16774                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16775         } else {
16776                 DO_ASSERT(get_jenv_res == JNI_OK);
16777         }
16778         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16779         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16780         LDKTxSignatures msg_var = *msg;
16781         int64_t msg_ref = 0;
16782         msg_var = TxSignatures_clone(&msg_var);
16783         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16784         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16785         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16786         CHECK(obj != NULL);
16787         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
16788         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16789                 (*env)->ExceptionDescribe(env);
16790                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler 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 handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
16797         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16806         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16807         LDKTxInitRbf msg_var = *msg;
16808         int64_t msg_ref = 0;
16809         msg_var = TxInitRbf_clone(&msg_var);
16810         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16811         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16812         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16813         CHECK(obj != NULL);
16814         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
16815         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16816                 (*env)->ExceptionDescribe(env);
16817                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
16818         }
16819         if (get_jenv_res == JNI_EDETACHED) {
16820                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16821         }
16822 }
16823 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
16824         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16825         JNIEnv *env;
16826         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16827         if (get_jenv_res == JNI_EDETACHED) {
16828                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16829         } else {
16830                 DO_ASSERT(get_jenv_res == JNI_OK);
16831         }
16832         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16833         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16834         LDKTxAckRbf msg_var = *msg;
16835         int64_t msg_ref = 0;
16836         msg_var = TxAckRbf_clone(&msg_var);
16837         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16838         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16839         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16840         CHECK(obj != NULL);
16841         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
16842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16843                 (*env)->ExceptionDescribe(env);
16844                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
16845         }
16846         if (get_jenv_res == JNI_EDETACHED) {
16847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16848         }
16849 }
16850 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
16851         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16852         JNIEnv *env;
16853         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16854         if (get_jenv_res == JNI_EDETACHED) {
16855                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16856         } else {
16857                 DO_ASSERT(get_jenv_res == JNI_OK);
16858         }
16859         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16860         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16861         LDKTxAbort msg_var = *msg;
16862         int64_t msg_ref = 0;
16863         msg_var = TxAbort_clone(&msg_var);
16864         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16865         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16866         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16867         CHECK(obj != NULL);
16868         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
16869         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16870                 (*env)->ExceptionDescribe(env);
16871                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
16872         }
16873         if (get_jenv_res == JNI_EDETACHED) {
16874                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16875         }
16876 }
16877 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
16878         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16879         JNIEnv *env;
16880         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16881         if (get_jenv_res == JNI_EDETACHED) {
16882                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16883         } else {
16884                 DO_ASSERT(get_jenv_res == JNI_OK);
16885         }
16886         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16887         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16888         LDKUpdateAddHTLC msg_var = *msg;
16889         int64_t msg_ref = 0;
16890         msg_var = UpdateAddHTLC_clone(&msg_var);
16891         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16892         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16893         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16894         CHECK(obj != NULL);
16895         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
16896         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16897                 (*env)->ExceptionDescribe(env);
16898                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
16899         }
16900         if (get_jenv_res == JNI_EDETACHED) {
16901                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16902         }
16903 }
16904 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
16905         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16906         JNIEnv *env;
16907         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16908         if (get_jenv_res == JNI_EDETACHED) {
16909                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16910         } else {
16911                 DO_ASSERT(get_jenv_res == JNI_OK);
16912         }
16913         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16914         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16915         LDKUpdateFulfillHTLC msg_var = *msg;
16916         int64_t msg_ref = 0;
16917         msg_var = UpdateFulfillHTLC_clone(&msg_var);
16918         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16919         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16920         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16921         CHECK(obj != NULL);
16922         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
16923         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16924                 (*env)->ExceptionDescribe(env);
16925                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
16926         }
16927         if (get_jenv_res == JNI_EDETACHED) {
16928                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16929         }
16930 }
16931 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
16932         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16933         JNIEnv *env;
16934         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16935         if (get_jenv_res == JNI_EDETACHED) {
16936                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16937         } else {
16938                 DO_ASSERT(get_jenv_res == JNI_OK);
16939         }
16940         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16941         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16942         LDKUpdateFailHTLC msg_var = *msg;
16943         int64_t msg_ref = 0;
16944         msg_var = UpdateFailHTLC_clone(&msg_var);
16945         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16946         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16947         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16948         CHECK(obj != NULL);
16949         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
16950         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16951                 (*env)->ExceptionDescribe(env);
16952                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
16953         }
16954         if (get_jenv_res == JNI_EDETACHED) {
16955                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16956         }
16957 }
16958 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
16959         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16960         JNIEnv *env;
16961         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16962         if (get_jenv_res == JNI_EDETACHED) {
16963                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16964         } else {
16965                 DO_ASSERT(get_jenv_res == JNI_OK);
16966         }
16967         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16968         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16969         LDKUpdateFailMalformedHTLC msg_var = *msg;
16970         int64_t msg_ref = 0;
16971         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
16972         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16973         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16974         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16975         CHECK(obj != NULL);
16976         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
16977         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16978                 (*env)->ExceptionDescribe(env);
16979                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
16980         }
16981         if (get_jenv_res == JNI_EDETACHED) {
16982                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16983         }
16984 }
16985 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
16986         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
16987         JNIEnv *env;
16988         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16989         if (get_jenv_res == JNI_EDETACHED) {
16990                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16991         } else {
16992                 DO_ASSERT(get_jenv_res == JNI_OK);
16993         }
16994         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16995         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16996         LDKCommitmentSigned msg_var = *msg;
16997         int64_t msg_ref = 0;
16998         msg_var = CommitmentSigned_clone(&msg_var);
16999         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17000         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17001         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17002         CHECK(obj != NULL);
17003         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
17004         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17005                 (*env)->ExceptionDescribe(env);
17006                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
17007         }
17008         if (get_jenv_res == JNI_EDETACHED) {
17009                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17010         }
17011 }
17012 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
17013         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17014         JNIEnv *env;
17015         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17016         if (get_jenv_res == JNI_EDETACHED) {
17017                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17018         } else {
17019                 DO_ASSERT(get_jenv_res == JNI_OK);
17020         }
17021         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17022         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17023         LDKRevokeAndACK msg_var = *msg;
17024         int64_t msg_ref = 0;
17025         msg_var = RevokeAndACK_clone(&msg_var);
17026         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17027         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17028         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17029         CHECK(obj != NULL);
17030         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
17031         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17032                 (*env)->ExceptionDescribe(env);
17033                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
17034         }
17035         if (get_jenv_res == JNI_EDETACHED) {
17036                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17037         }
17038 }
17039 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
17040         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17041         JNIEnv *env;
17042         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17043         if (get_jenv_res == JNI_EDETACHED) {
17044                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17045         } else {
17046                 DO_ASSERT(get_jenv_res == JNI_OK);
17047         }
17048         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17049         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17050         LDKUpdateFee msg_var = *msg;
17051         int64_t msg_ref = 0;
17052         msg_var = UpdateFee_clone(&msg_var);
17053         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17054         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17055         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17056         CHECK(obj != NULL);
17057         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
17058         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17059                 (*env)->ExceptionDescribe(env);
17060                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
17061         }
17062         if (get_jenv_res == JNI_EDETACHED) {
17063                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17064         }
17065 }
17066 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
17067         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17068         JNIEnv *env;
17069         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17070         if (get_jenv_res == JNI_EDETACHED) {
17071                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17072         } else {
17073                 DO_ASSERT(get_jenv_res == JNI_OK);
17074         }
17075         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17076         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17077         LDKAnnouncementSignatures msg_var = *msg;
17078         int64_t msg_ref = 0;
17079         msg_var = AnnouncementSignatures_clone(&msg_var);
17080         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17081         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17082         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17083         CHECK(obj != NULL);
17084         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
17085         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17086                 (*env)->ExceptionDescribe(env);
17087                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
17088         }
17089         if (get_jenv_res == JNI_EDETACHED) {
17090                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17091         }
17092 }
17093 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17094         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17095         JNIEnv *env;
17096         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17097         if (get_jenv_res == JNI_EDETACHED) {
17098                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17099         } else {
17100                 DO_ASSERT(get_jenv_res == JNI_OK);
17101         }
17102         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17103         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17104         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17105         CHECK(obj != NULL);
17106         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
17107         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17108                 (*env)->ExceptionDescribe(env);
17109                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
17110         }
17111         if (get_jenv_res == JNI_EDETACHED) {
17112                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17113         }
17114 }
17115 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
17116         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17117         JNIEnv *env;
17118         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17119         if (get_jenv_res == JNI_EDETACHED) {
17120                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17121         } else {
17122                 DO_ASSERT(get_jenv_res == JNI_OK);
17123         }
17124         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17125         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17126         LDKInit msg_var = *msg;
17127         int64_t msg_ref = 0;
17128         msg_var = Init_clone(&msg_var);
17129         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17130         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17131         jboolean inbound_conv = inbound;
17132         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17133         CHECK(obj != NULL);
17134         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
17135         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17136                 (*env)->ExceptionDescribe(env);
17137                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
17138         }
17139         void* ret_ptr = untag_ptr(ret);
17140         CHECK_ACCESS(ret_ptr);
17141         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
17142         FREE(untag_ptr(ret));
17143         if (get_jenv_res == JNI_EDETACHED) {
17144                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17145         }
17146         return ret_conv;
17147 }
17148 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
17149         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17150         JNIEnv *env;
17151         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17152         if (get_jenv_res == JNI_EDETACHED) {
17153                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17154         } else {
17155                 DO_ASSERT(get_jenv_res == JNI_OK);
17156         }
17157         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17158         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17159         LDKChannelReestablish msg_var = *msg;
17160         int64_t msg_ref = 0;
17161         msg_var = ChannelReestablish_clone(&msg_var);
17162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17163         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17164         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17165         CHECK(obj != NULL);
17166         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
17167         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17168                 (*env)->ExceptionDescribe(env);
17169                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
17170         }
17171         if (get_jenv_res == JNI_EDETACHED) {
17172                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17173         }
17174 }
17175 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
17176         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17177         JNIEnv *env;
17178         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17179         if (get_jenv_res == JNI_EDETACHED) {
17180                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17181         } else {
17182                 DO_ASSERT(get_jenv_res == JNI_OK);
17183         }
17184         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17185         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17186         LDKChannelUpdate msg_var = *msg;
17187         int64_t msg_ref = 0;
17188         msg_var = ChannelUpdate_clone(&msg_var);
17189         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17190         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17191         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17192         CHECK(obj != NULL);
17193         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
17194         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17195                 (*env)->ExceptionDescribe(env);
17196                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
17197         }
17198         if (get_jenv_res == JNI_EDETACHED) {
17199                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17200         }
17201 }
17202 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
17203         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17204         JNIEnv *env;
17205         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17206         if (get_jenv_res == JNI_EDETACHED) {
17207                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17208         } else {
17209                 DO_ASSERT(get_jenv_res == JNI_OK);
17210         }
17211         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17212         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17213         LDKErrorMessage msg_var = *msg;
17214         int64_t msg_ref = 0;
17215         msg_var = ErrorMessage_clone(&msg_var);
17216         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17217         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17218         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17219         CHECK(obj != NULL);
17220         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
17221         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17222                 (*env)->ExceptionDescribe(env);
17223                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
17224         }
17225         if (get_jenv_res == JNI_EDETACHED) {
17226                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17227         }
17228 }
17229 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
17230         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17231         JNIEnv *env;
17232         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17233         if (get_jenv_res == JNI_EDETACHED) {
17234                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17235         } else {
17236                 DO_ASSERT(get_jenv_res == JNI_OK);
17237         }
17238         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17239         CHECK(obj != NULL);
17240         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
17241         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17242                 (*env)->ExceptionDescribe(env);
17243                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
17244         }
17245         LDKNodeFeatures ret_conv;
17246         ret_conv.inner = untag_ptr(ret);
17247         ret_conv.is_owned = ptr_is_owned(ret);
17248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17249         if (get_jenv_res == JNI_EDETACHED) {
17250                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17251         }
17252         return ret_conv;
17253 }
17254 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17255         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17256         JNIEnv *env;
17257         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17258         if (get_jenv_res == JNI_EDETACHED) {
17259                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17260         } else {
17261                 DO_ASSERT(get_jenv_res == JNI_OK);
17262         }
17263         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17264         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17265         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17266         CHECK(obj != NULL);
17267         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
17268         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17269                 (*env)->ExceptionDescribe(env);
17270                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
17271         }
17272         LDKInitFeatures ret_conv;
17273         ret_conv.inner = untag_ptr(ret);
17274         ret_conv.is_owned = ptr_is_owned(ret);
17275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17276         if (get_jenv_res == JNI_EDETACHED) {
17277                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17278         }
17279         return ret_conv;
17280 }
17281 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
17282         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17283         JNIEnv *env;
17284         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17285         if (get_jenv_res == JNI_EDETACHED) {
17286                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17287         } else {
17288                 DO_ASSERT(get_jenv_res == JNI_OK);
17289         }
17290         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17291         CHECK(obj != NULL);
17292         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_chain_hashes_meth);
17293         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17294                 (*env)->ExceptionDescribe(env);
17295                 (*env)->FatalError(env, "A call to get_chain_hashes in LDKChannelMessageHandler from rust threw an exception.");
17296         }
17297         void* ret_ptr = untag_ptr(ret);
17298         CHECK_ACCESS(ret_ptr);
17299         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
17300         FREE(untag_ptr(ret));
17301         if (get_jenv_res == JNI_EDETACHED) {
17302                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17303         }
17304         return ret_conv;
17305 }
17306 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
17307         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
17308         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17309         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
17310 }
17311 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17312         jclass c = (*env)->GetObjectClass(env, o);
17313         CHECK(c != NULL);
17314         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
17315         atomic_init(&calls->refcnt, 1);
17316         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17317         calls->o = (*env)->NewWeakGlobalRef(env, o);
17318         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
17319         CHECK(calls->handle_open_channel_meth != NULL);
17320         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
17321         CHECK(calls->handle_open_channel_v2_meth != NULL);
17322         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
17323         CHECK(calls->handle_accept_channel_meth != NULL);
17324         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
17325         CHECK(calls->handle_accept_channel_v2_meth != NULL);
17326         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
17327         CHECK(calls->handle_funding_created_meth != NULL);
17328         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
17329         CHECK(calls->handle_funding_signed_meth != NULL);
17330         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
17331         CHECK(calls->handle_channel_ready_meth != NULL);
17332         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
17333         CHECK(calls->handle_shutdown_meth != NULL);
17334         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
17335         CHECK(calls->handle_closing_signed_meth != NULL);
17336         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
17337         CHECK(calls->handle_tx_add_input_meth != NULL);
17338         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
17339         CHECK(calls->handle_tx_add_output_meth != NULL);
17340         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
17341         CHECK(calls->handle_tx_remove_input_meth != NULL);
17342         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
17343         CHECK(calls->handle_tx_remove_output_meth != NULL);
17344         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
17345         CHECK(calls->handle_tx_complete_meth != NULL);
17346         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
17347         CHECK(calls->handle_tx_signatures_meth != NULL);
17348         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
17349         CHECK(calls->handle_tx_init_rbf_meth != NULL);
17350         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
17351         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
17352         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
17353         CHECK(calls->handle_tx_abort_meth != NULL);
17354         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
17355         CHECK(calls->handle_update_add_htlc_meth != NULL);
17356         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
17357         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
17358         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
17359         CHECK(calls->handle_update_fail_htlc_meth != NULL);
17360         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
17361         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
17362         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
17363         CHECK(calls->handle_commitment_signed_meth != NULL);
17364         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
17365         CHECK(calls->handle_revoke_and_ack_meth != NULL);
17366         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
17367         CHECK(calls->handle_update_fee_meth != NULL);
17368         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
17369         CHECK(calls->handle_announcement_signatures_meth != NULL);
17370         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
17371         CHECK(calls->peer_disconnected_meth != NULL);
17372         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
17373         CHECK(calls->peer_connected_meth != NULL);
17374         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
17375         CHECK(calls->handle_channel_reestablish_meth != NULL);
17376         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
17377         CHECK(calls->handle_channel_update_meth != NULL);
17378         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
17379         CHECK(calls->handle_error_meth != NULL);
17380         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17381         CHECK(calls->provided_node_features_meth != NULL);
17382         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17383         CHECK(calls->provided_init_features_meth != NULL);
17384         calls->get_chain_hashes_meth = (*env)->GetMethodID(env, c, "get_chain_hashes", "()J");
17385         CHECK(calls->get_chain_hashes_meth != NULL);
17386
17387         LDKChannelMessageHandler ret = {
17388                 .this_arg = (void*) calls,
17389                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
17390                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
17391                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
17392                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
17393                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
17394                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
17395                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
17396                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
17397                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
17398                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
17399                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
17400                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
17401                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
17402                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
17403                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
17404                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
17405                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
17406                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
17407                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
17408                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
17409                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
17410                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
17411                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
17412                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
17413                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
17414                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
17415                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
17416                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
17417                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
17418                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
17419                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
17420                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
17421                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
17422                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
17423                 .free = LDKChannelMessageHandler_JCalls_free,
17424                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
17425         };
17426         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
17427         return ret;
17428 }
17429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17430         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17431         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
17432         return tag_ptr(res_ptr, true);
17433 }
17434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
17435         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
17436         return tag_ptr(&inp->MessageSendEventsProvider, false);
17437 }
17438 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) {
17439         void* this_arg_ptr = untag_ptr(this_arg);
17440         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17441         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17442         LDKPublicKey their_node_id_ref;
17443         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17444         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17445         LDKOpenChannel msg_conv;
17446         msg_conv.inner = untag_ptr(msg);
17447         msg_conv.is_owned = ptr_is_owned(msg);
17448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17449         msg_conv.is_owned = false;
17450         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17451 }
17452
17453 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) {
17454         void* this_arg_ptr = untag_ptr(this_arg);
17455         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17456         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17457         LDKPublicKey their_node_id_ref;
17458         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17459         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17460         LDKOpenChannelV2 msg_conv;
17461         msg_conv.inner = untag_ptr(msg);
17462         msg_conv.is_owned = ptr_is_owned(msg);
17463         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17464         msg_conv.is_owned = false;
17465         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17466 }
17467
17468 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) {
17469         void* this_arg_ptr = untag_ptr(this_arg);
17470         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17471         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17472         LDKPublicKey their_node_id_ref;
17473         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17474         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17475         LDKAcceptChannel msg_conv;
17476         msg_conv.inner = untag_ptr(msg);
17477         msg_conv.is_owned = ptr_is_owned(msg);
17478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17479         msg_conv.is_owned = false;
17480         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17481 }
17482
17483 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) {
17484         void* this_arg_ptr = untag_ptr(this_arg);
17485         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17486         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17487         LDKPublicKey their_node_id_ref;
17488         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17489         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17490         LDKAcceptChannelV2 msg_conv;
17491         msg_conv.inner = untag_ptr(msg);
17492         msg_conv.is_owned = ptr_is_owned(msg);
17493         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17494         msg_conv.is_owned = false;
17495         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17496 }
17497
17498 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) {
17499         void* this_arg_ptr = untag_ptr(this_arg);
17500         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17501         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17502         LDKPublicKey their_node_id_ref;
17503         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17504         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17505         LDKFundingCreated msg_conv;
17506         msg_conv.inner = untag_ptr(msg);
17507         msg_conv.is_owned = ptr_is_owned(msg);
17508         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17509         msg_conv.is_owned = false;
17510         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17511 }
17512
17513 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) {
17514         void* this_arg_ptr = untag_ptr(this_arg);
17515         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17516         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17517         LDKPublicKey their_node_id_ref;
17518         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17519         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17520         LDKFundingSigned msg_conv;
17521         msg_conv.inner = untag_ptr(msg);
17522         msg_conv.is_owned = ptr_is_owned(msg);
17523         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17524         msg_conv.is_owned = false;
17525         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17526 }
17527
17528 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) {
17529         void* this_arg_ptr = untag_ptr(this_arg);
17530         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17531         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17532         LDKPublicKey their_node_id_ref;
17533         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17534         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17535         LDKChannelReady msg_conv;
17536         msg_conv.inner = untag_ptr(msg);
17537         msg_conv.is_owned = ptr_is_owned(msg);
17538         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17539         msg_conv.is_owned = false;
17540         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17541 }
17542
17543 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) {
17544         void* this_arg_ptr = untag_ptr(this_arg);
17545         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17546         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17547         LDKPublicKey their_node_id_ref;
17548         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17549         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17550         LDKShutdown msg_conv;
17551         msg_conv.inner = untag_ptr(msg);
17552         msg_conv.is_owned = ptr_is_owned(msg);
17553         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17554         msg_conv.is_owned = false;
17555         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17556 }
17557
17558 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) {
17559         void* this_arg_ptr = untag_ptr(this_arg);
17560         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17561         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17562         LDKPublicKey their_node_id_ref;
17563         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17564         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17565         LDKClosingSigned msg_conv;
17566         msg_conv.inner = untag_ptr(msg);
17567         msg_conv.is_owned = ptr_is_owned(msg);
17568         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17569         msg_conv.is_owned = false;
17570         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17571 }
17572
17573 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) {
17574         void* this_arg_ptr = untag_ptr(this_arg);
17575         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17576         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17577         LDKPublicKey their_node_id_ref;
17578         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17579         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17580         LDKTxAddInput msg_conv;
17581         msg_conv.inner = untag_ptr(msg);
17582         msg_conv.is_owned = ptr_is_owned(msg);
17583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17584         msg_conv.is_owned = false;
17585         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17586 }
17587
17588 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) {
17589         void* this_arg_ptr = untag_ptr(this_arg);
17590         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17591         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17592         LDKPublicKey their_node_id_ref;
17593         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17594         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17595         LDKTxAddOutput msg_conv;
17596         msg_conv.inner = untag_ptr(msg);
17597         msg_conv.is_owned = ptr_is_owned(msg);
17598         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17599         msg_conv.is_owned = false;
17600         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17601 }
17602
17603 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) {
17604         void* this_arg_ptr = untag_ptr(this_arg);
17605         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17606         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17607         LDKPublicKey their_node_id_ref;
17608         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17609         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17610         LDKTxRemoveInput msg_conv;
17611         msg_conv.inner = untag_ptr(msg);
17612         msg_conv.is_owned = ptr_is_owned(msg);
17613         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17614         msg_conv.is_owned = false;
17615         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17616 }
17617
17618 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) {
17619         void* this_arg_ptr = untag_ptr(this_arg);
17620         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17621         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17622         LDKPublicKey their_node_id_ref;
17623         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17624         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17625         LDKTxRemoveOutput msg_conv;
17626         msg_conv.inner = untag_ptr(msg);
17627         msg_conv.is_owned = ptr_is_owned(msg);
17628         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17629         msg_conv.is_owned = false;
17630         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17631 }
17632
17633 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) {
17634         void* this_arg_ptr = untag_ptr(this_arg);
17635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17636         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17637         LDKPublicKey their_node_id_ref;
17638         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17639         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17640         LDKTxComplete msg_conv;
17641         msg_conv.inner = untag_ptr(msg);
17642         msg_conv.is_owned = ptr_is_owned(msg);
17643         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17644         msg_conv.is_owned = false;
17645         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17646 }
17647
17648 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) {
17649         void* this_arg_ptr = untag_ptr(this_arg);
17650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17651         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17652         LDKPublicKey their_node_id_ref;
17653         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17654         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17655         LDKTxSignatures msg_conv;
17656         msg_conv.inner = untag_ptr(msg);
17657         msg_conv.is_owned = ptr_is_owned(msg);
17658         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17659         msg_conv.is_owned = false;
17660         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17661 }
17662
17663 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) {
17664         void* this_arg_ptr = untag_ptr(this_arg);
17665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17666         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17667         LDKPublicKey their_node_id_ref;
17668         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17669         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17670         LDKTxInitRbf msg_conv;
17671         msg_conv.inner = untag_ptr(msg);
17672         msg_conv.is_owned = ptr_is_owned(msg);
17673         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17674         msg_conv.is_owned = false;
17675         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17676 }
17677
17678 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) {
17679         void* this_arg_ptr = untag_ptr(this_arg);
17680         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17681         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17682         LDKPublicKey their_node_id_ref;
17683         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17684         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17685         LDKTxAckRbf msg_conv;
17686         msg_conv.inner = untag_ptr(msg);
17687         msg_conv.is_owned = ptr_is_owned(msg);
17688         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17689         msg_conv.is_owned = false;
17690         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17691 }
17692
17693 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) {
17694         void* this_arg_ptr = untag_ptr(this_arg);
17695         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17696         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17697         LDKPublicKey their_node_id_ref;
17698         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17699         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17700         LDKTxAbort msg_conv;
17701         msg_conv.inner = untag_ptr(msg);
17702         msg_conv.is_owned = ptr_is_owned(msg);
17703         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17704         msg_conv.is_owned = false;
17705         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17706 }
17707
17708 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) {
17709         void* this_arg_ptr = untag_ptr(this_arg);
17710         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17711         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17712         LDKPublicKey their_node_id_ref;
17713         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17714         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17715         LDKUpdateAddHTLC msg_conv;
17716         msg_conv.inner = untag_ptr(msg);
17717         msg_conv.is_owned = ptr_is_owned(msg);
17718         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17719         msg_conv.is_owned = false;
17720         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17721 }
17722
17723 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) {
17724         void* this_arg_ptr = untag_ptr(this_arg);
17725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17726         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17727         LDKPublicKey their_node_id_ref;
17728         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17729         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17730         LDKUpdateFulfillHTLC msg_conv;
17731         msg_conv.inner = untag_ptr(msg);
17732         msg_conv.is_owned = ptr_is_owned(msg);
17733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17734         msg_conv.is_owned = false;
17735         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17736 }
17737
17738 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) {
17739         void* this_arg_ptr = untag_ptr(this_arg);
17740         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17741         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17742         LDKPublicKey their_node_id_ref;
17743         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17744         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17745         LDKUpdateFailHTLC msg_conv;
17746         msg_conv.inner = untag_ptr(msg);
17747         msg_conv.is_owned = ptr_is_owned(msg);
17748         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17749         msg_conv.is_owned = false;
17750         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17751 }
17752
17753 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) {
17754         void* this_arg_ptr = untag_ptr(this_arg);
17755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17756         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17757         LDKPublicKey their_node_id_ref;
17758         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17759         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17760         LDKUpdateFailMalformedHTLC msg_conv;
17761         msg_conv.inner = untag_ptr(msg);
17762         msg_conv.is_owned = ptr_is_owned(msg);
17763         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17764         msg_conv.is_owned = false;
17765         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17766 }
17767
17768 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) {
17769         void* this_arg_ptr = untag_ptr(this_arg);
17770         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17771         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17772         LDKPublicKey their_node_id_ref;
17773         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17774         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17775         LDKCommitmentSigned msg_conv;
17776         msg_conv.inner = untag_ptr(msg);
17777         msg_conv.is_owned = ptr_is_owned(msg);
17778         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17779         msg_conv.is_owned = false;
17780         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17781 }
17782
17783 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) {
17784         void* this_arg_ptr = untag_ptr(this_arg);
17785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17786         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17787         LDKPublicKey their_node_id_ref;
17788         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17789         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17790         LDKRevokeAndACK msg_conv;
17791         msg_conv.inner = untag_ptr(msg);
17792         msg_conv.is_owned = ptr_is_owned(msg);
17793         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17794         msg_conv.is_owned = false;
17795         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17796 }
17797
17798 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) {
17799         void* this_arg_ptr = untag_ptr(this_arg);
17800         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17801         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17802         LDKPublicKey their_node_id_ref;
17803         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17804         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17805         LDKUpdateFee msg_conv;
17806         msg_conv.inner = untag_ptr(msg);
17807         msg_conv.is_owned = ptr_is_owned(msg);
17808         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17809         msg_conv.is_owned = false;
17810         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17811 }
17812
17813 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) {
17814         void* this_arg_ptr = untag_ptr(this_arg);
17815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17816         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17817         LDKPublicKey their_node_id_ref;
17818         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17819         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17820         LDKAnnouncementSignatures msg_conv;
17821         msg_conv.inner = untag_ptr(msg);
17822         msg_conv.is_owned = ptr_is_owned(msg);
17823         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17824         msg_conv.is_owned = false;
17825         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17826 }
17827
17828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17829         void* this_arg_ptr = untag_ptr(this_arg);
17830         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17831         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17832         LDKPublicKey their_node_id_ref;
17833         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17834         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17835         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
17836 }
17837
17838 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) {
17839         void* this_arg_ptr = untag_ptr(this_arg);
17840         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17841         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17842         LDKPublicKey their_node_id_ref;
17843         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17844         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17845         LDKInit msg_conv;
17846         msg_conv.inner = untag_ptr(msg);
17847         msg_conv.is_owned = ptr_is_owned(msg);
17848         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17849         msg_conv.is_owned = false;
17850         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17851         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
17852         return tag_ptr(ret_conv, true);
17853 }
17854
17855 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) {
17856         void* this_arg_ptr = untag_ptr(this_arg);
17857         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17858         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17859         LDKPublicKey their_node_id_ref;
17860         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17861         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17862         LDKChannelReestablish msg_conv;
17863         msg_conv.inner = untag_ptr(msg);
17864         msg_conv.is_owned = ptr_is_owned(msg);
17865         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17866         msg_conv.is_owned = false;
17867         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17868 }
17869
17870 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) {
17871         void* this_arg_ptr = untag_ptr(this_arg);
17872         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17873         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17874         LDKPublicKey their_node_id_ref;
17875         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17876         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17877         LDKChannelUpdate msg_conv;
17878         msg_conv.inner = untag_ptr(msg);
17879         msg_conv.is_owned = ptr_is_owned(msg);
17880         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17881         msg_conv.is_owned = false;
17882         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17883 }
17884
17885 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) {
17886         void* this_arg_ptr = untag_ptr(this_arg);
17887         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17888         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17889         LDKPublicKey their_node_id_ref;
17890         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17891         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17892         LDKErrorMessage msg_conv;
17893         msg_conv.inner = untag_ptr(msg);
17894         msg_conv.is_owned = ptr_is_owned(msg);
17895         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17896         msg_conv.is_owned = false;
17897         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
17898 }
17899
17900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17901         void* this_arg_ptr = untag_ptr(this_arg);
17902         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17903         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17904         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17905         int64_t ret_ref = 0;
17906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17908         return ret_ref;
17909 }
17910
17911 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) {
17912         void* this_arg_ptr = untag_ptr(this_arg);
17913         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17914         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17915         LDKPublicKey their_node_id_ref;
17916         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17917         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17918         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17919         int64_t ret_ref = 0;
17920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17922         return ret_ref;
17923 }
17924
17925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
17926         void* this_arg_ptr = untag_ptr(this_arg);
17927         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17928         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
17929         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17930         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
17931         int64_t ret_ref = tag_ptr(ret_copy, true);
17932         return ret_ref;
17933 }
17934
17935 typedef struct LDKOffersMessageHandler_JCalls {
17936         atomic_size_t refcnt;
17937         JavaVM *vm;
17938         jweak o;
17939         jmethodID handle_message_meth;
17940         jmethodID release_pending_messages_meth;
17941 } LDKOffersMessageHandler_JCalls;
17942 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
17943         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
17944         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17945                 JNIEnv *env;
17946                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17947                 if (get_jenv_res == JNI_EDETACHED) {
17948                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17949                 } else {
17950                         DO_ASSERT(get_jenv_res == JNI_OK);
17951                 }
17952                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17953                 if (get_jenv_res == JNI_EDETACHED) {
17954                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17955                 }
17956                 FREE(j_calls);
17957         }
17958 }
17959 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
17960         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
17961         JNIEnv *env;
17962         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17963         if (get_jenv_res == JNI_EDETACHED) {
17964                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17965         } else {
17966                 DO_ASSERT(get_jenv_res == JNI_OK);
17967         }
17968         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
17969         *message_copy = message;
17970         int64_t message_ref = tag_ptr(message_copy, true);
17971         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17972         CHECK(obj != NULL);
17973         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
17974         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17975                 (*env)->ExceptionDescribe(env);
17976                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
17977         }
17978         void* ret_ptr = untag_ptr(ret);
17979         CHECK_ACCESS(ret_ptr);
17980         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
17981         FREE(untag_ptr(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 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
17988         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_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         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17997         CHECK(obj != NULL);
17998         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_messages_meth);
17999         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18000                 (*env)->ExceptionDescribe(env);
18001                 (*env)->FatalError(env, "A call to release_pending_messages in LDKOffersMessageHandler from rust threw an exception.");
18002         }
18003         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
18004         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18005         if (ret_constr.datalen > 0)
18006                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
18007         else
18008                 ret_constr.data = NULL;
18009         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18010         for (size_t x = 0; x < ret_constr.datalen; x++) {
18011                 int64_t ret_conv_49 = ret_vals[x];
18012                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
18013                 CHECK_ACCESS(ret_conv_49_ptr);
18014                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
18015                 FREE(untag_ptr(ret_conv_49));
18016                 ret_constr.data[x] = ret_conv_49_conv;
18017         }
18018         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18019         if (get_jenv_res == JNI_EDETACHED) {
18020                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18021         }
18022         return ret_constr;
18023 }
18024 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
18025         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
18026         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18027 }
18028 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
18029         jclass c = (*env)->GetObjectClass(env, o);
18030         CHECK(c != NULL);
18031         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
18032         atomic_init(&calls->refcnt, 1);
18033         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18034         calls->o = (*env)->NewWeakGlobalRef(env, o);
18035         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
18036         CHECK(calls->handle_message_meth != NULL);
18037         calls->release_pending_messages_meth = (*env)->GetMethodID(env, c, "release_pending_messages", "()[J");
18038         CHECK(calls->release_pending_messages_meth != NULL);
18039
18040         LDKOffersMessageHandler ret = {
18041                 .this_arg = (void*) calls,
18042                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
18043                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
18044                 .free = LDKOffersMessageHandler_JCalls_free,
18045         };
18046         return ret;
18047 }
18048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18049         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
18050         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
18051         return tag_ptr(res_ptr, true);
18052 }
18053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
18054         void* this_arg_ptr = untag_ptr(this_arg);
18055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18056         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
18057         void* message_ptr = untag_ptr(message);
18058         CHECK_ACCESS(message_ptr);
18059         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
18060         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
18061         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
18062         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
18063         int64_t ret_ref = tag_ptr(ret_copy, true);
18064         return ret_ref;
18065 }
18066
18067 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
18068         void* this_arg_ptr = untag_ptr(this_arg);
18069         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18070         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
18071         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
18072         int64_tArray ret_arr = NULL;
18073         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18074         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18075         for (size_t x = 0; x < ret_var.datalen; x++) {
18076                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
18077                 *ret_conv_49_conv = ret_var.data[x];
18078                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
18079         }
18080         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18081         FREE(ret_var.data);
18082         return ret_arr;
18083 }
18084
18085 typedef struct LDKRoutingMessageHandler_JCalls {
18086         atomic_size_t refcnt;
18087         JavaVM *vm;
18088         jweak o;
18089         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
18090         jmethodID handle_node_announcement_meth;
18091         jmethodID handle_channel_announcement_meth;
18092         jmethodID handle_channel_update_meth;
18093         jmethodID get_next_channel_announcement_meth;
18094         jmethodID get_next_node_announcement_meth;
18095         jmethodID peer_connected_meth;
18096         jmethodID handle_reply_channel_range_meth;
18097         jmethodID handle_reply_short_channel_ids_end_meth;
18098         jmethodID handle_query_channel_range_meth;
18099         jmethodID handle_query_short_channel_ids_meth;
18100         jmethodID processing_queue_high_meth;
18101         jmethodID provided_node_features_meth;
18102         jmethodID provided_init_features_meth;
18103 } LDKRoutingMessageHandler_JCalls;
18104 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
18105         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18106         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18107                 JNIEnv *env;
18108                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18109                 if (get_jenv_res == JNI_EDETACHED) {
18110                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18111                 } else {
18112                         DO_ASSERT(get_jenv_res == JNI_OK);
18113                 }
18114                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18115                 if (get_jenv_res == JNI_EDETACHED) {
18116                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18117                 }
18118                 FREE(j_calls);
18119         }
18120 }
18121 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
18122         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18123         JNIEnv *env;
18124         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18125         if (get_jenv_res == JNI_EDETACHED) {
18126                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18127         } else {
18128                 DO_ASSERT(get_jenv_res == JNI_OK);
18129         }
18130         LDKNodeAnnouncement msg_var = *msg;
18131         int64_t msg_ref = 0;
18132         msg_var = NodeAnnouncement_clone(&msg_var);
18133         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18134         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18135         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18136         CHECK(obj != NULL);
18137         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
18138         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18139                 (*env)->ExceptionDescribe(env);
18140                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
18141         }
18142         void* ret_ptr = untag_ptr(ret);
18143         CHECK_ACCESS(ret_ptr);
18144         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
18145         FREE(untag_ptr(ret));
18146         if (get_jenv_res == JNI_EDETACHED) {
18147                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18148         }
18149         return ret_conv;
18150 }
18151 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
18152         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18153         JNIEnv *env;
18154         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18155         if (get_jenv_res == JNI_EDETACHED) {
18156                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18157         } else {
18158                 DO_ASSERT(get_jenv_res == JNI_OK);
18159         }
18160         LDKChannelAnnouncement msg_var = *msg;
18161         int64_t msg_ref = 0;
18162         msg_var = ChannelAnnouncement_clone(&msg_var);
18163         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18164         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18165         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18166         CHECK(obj != NULL);
18167         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
18168         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18169                 (*env)->ExceptionDescribe(env);
18170                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
18171         }
18172         void* ret_ptr = untag_ptr(ret);
18173         CHECK_ACCESS(ret_ptr);
18174         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
18175         FREE(untag_ptr(ret));
18176         if (get_jenv_res == JNI_EDETACHED) {
18177                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18178         }
18179         return ret_conv;
18180 }
18181 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
18182         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18183         JNIEnv *env;
18184         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18185         if (get_jenv_res == JNI_EDETACHED) {
18186                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18187         } else {
18188                 DO_ASSERT(get_jenv_res == JNI_OK);
18189         }
18190         LDKChannelUpdate msg_var = *msg;
18191         int64_t msg_ref = 0;
18192         msg_var = ChannelUpdate_clone(&msg_var);
18193         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18194         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18195         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18196         CHECK(obj != NULL);
18197         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
18198         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18199                 (*env)->ExceptionDescribe(env);
18200                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
18201         }
18202         void* ret_ptr = untag_ptr(ret);
18203         CHECK_ACCESS(ret_ptr);
18204         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
18205         FREE(untag_ptr(ret));
18206         if (get_jenv_res == JNI_EDETACHED) {
18207                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18208         }
18209         return ret_conv;
18210 }
18211 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
18212         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18213         JNIEnv *env;
18214         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18215         if (get_jenv_res == JNI_EDETACHED) {
18216                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18217         } else {
18218                 DO_ASSERT(get_jenv_res == JNI_OK);
18219         }
18220         int64_t starting_point_conv = starting_point;
18221         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18222         CHECK(obj != NULL);
18223         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
18224         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18225                 (*env)->ExceptionDescribe(env);
18226                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
18227         }
18228         void* ret_ptr = untag_ptr(ret);
18229         CHECK_ACCESS(ret_ptr);
18230         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
18231         FREE(untag_ptr(ret));
18232         if (get_jenv_res == JNI_EDETACHED) {
18233                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18234         }
18235         return ret_conv;
18236 }
18237 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
18238         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18239         JNIEnv *env;
18240         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18241         if (get_jenv_res == JNI_EDETACHED) {
18242                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18243         } else {
18244                 DO_ASSERT(get_jenv_res == JNI_OK);
18245         }
18246         LDKNodeId starting_point_var = starting_point;
18247         int64_t starting_point_ref = 0;
18248         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
18249         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
18250         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18251         CHECK(obj != NULL);
18252         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
18253         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18254                 (*env)->ExceptionDescribe(env);
18255                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
18256         }
18257         LDKNodeAnnouncement ret_conv;
18258         ret_conv.inner = untag_ptr(ret);
18259         ret_conv.is_owned = ptr_is_owned(ret);
18260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18261         if (get_jenv_res == JNI_EDETACHED) {
18262                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18263         }
18264         return ret_conv;
18265 }
18266 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
18267         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18268         JNIEnv *env;
18269         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18270         if (get_jenv_res == JNI_EDETACHED) {
18271                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18272         } else {
18273                 DO_ASSERT(get_jenv_res == JNI_OK);
18274         }
18275         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18276         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18277         LDKInit init_var = *init;
18278         int64_t init_ref = 0;
18279         init_var = Init_clone(&init_var);
18280         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
18281         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
18282         jboolean inbound_conv = inbound;
18283         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18284         CHECK(obj != NULL);
18285         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
18286         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18287                 (*env)->ExceptionDescribe(env);
18288                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
18289         }
18290         void* ret_ptr = untag_ptr(ret);
18291         CHECK_ACCESS(ret_ptr);
18292         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
18293         FREE(untag_ptr(ret));
18294         if (get_jenv_res == JNI_EDETACHED) {
18295                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18296         }
18297         return ret_conv;
18298 }
18299 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
18300         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18301         JNIEnv *env;
18302         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18303         if (get_jenv_res == JNI_EDETACHED) {
18304                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18305         } else {
18306                 DO_ASSERT(get_jenv_res == JNI_OK);
18307         }
18308         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18309         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18310         LDKReplyChannelRange msg_var = msg;
18311         int64_t msg_ref = 0;
18312         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18313         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18314         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18315         CHECK(obj != NULL);
18316         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
18317         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18318                 (*env)->ExceptionDescribe(env);
18319                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
18320         }
18321         void* ret_ptr = untag_ptr(ret);
18322         CHECK_ACCESS(ret_ptr);
18323         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18324         FREE(untag_ptr(ret));
18325         if (get_jenv_res == JNI_EDETACHED) {
18326                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18327         }
18328         return ret_conv;
18329 }
18330 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
18331         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18332         JNIEnv *env;
18333         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18334         if (get_jenv_res == JNI_EDETACHED) {
18335                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18336         } else {
18337                 DO_ASSERT(get_jenv_res == JNI_OK);
18338         }
18339         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18340         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18341         LDKReplyShortChannelIdsEnd msg_var = msg;
18342         int64_t msg_ref = 0;
18343         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18344         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18345         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18346         CHECK(obj != NULL);
18347         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
18348         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18349                 (*env)->ExceptionDescribe(env);
18350                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
18351         }
18352         void* ret_ptr = untag_ptr(ret);
18353         CHECK_ACCESS(ret_ptr);
18354         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18355         FREE(untag_ptr(ret));
18356         if (get_jenv_res == JNI_EDETACHED) {
18357                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18358         }
18359         return ret_conv;
18360 }
18361 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
18362         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18363         JNIEnv *env;
18364         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18365         if (get_jenv_res == JNI_EDETACHED) {
18366                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18367         } else {
18368                 DO_ASSERT(get_jenv_res == JNI_OK);
18369         }
18370         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18371         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18372         LDKQueryChannelRange msg_var = msg;
18373         int64_t msg_ref = 0;
18374         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18375         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18376         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18377         CHECK(obj != NULL);
18378         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
18379         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18380                 (*env)->ExceptionDescribe(env);
18381                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
18382         }
18383         void* ret_ptr = untag_ptr(ret);
18384         CHECK_ACCESS(ret_ptr);
18385         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18386         FREE(untag_ptr(ret));
18387         if (get_jenv_res == JNI_EDETACHED) {
18388                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18389         }
18390         return ret_conv;
18391 }
18392 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
18393         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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 their_node_id_arr = (*env)->NewByteArray(env, 33);
18402         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18403         LDKQueryShortChannelIds msg_var = msg;
18404         int64_t msg_ref = 0;
18405         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18406         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18407         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18408         CHECK(obj != NULL);
18409         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
18410         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18411                 (*env)->ExceptionDescribe(env);
18412                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
18413         }
18414         void* ret_ptr = untag_ptr(ret);
18415         CHECK_ACCESS(ret_ptr);
18416         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
18417         FREE(untag_ptr(ret));
18418         if (get_jenv_res == JNI_EDETACHED) {
18419                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18420         }
18421         return ret_conv;
18422 }
18423 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
18424         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18425         JNIEnv *env;
18426         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18427         if (get_jenv_res == JNI_EDETACHED) {
18428                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18429         } else {
18430                 DO_ASSERT(get_jenv_res == JNI_OK);
18431         }
18432         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18433         CHECK(obj != NULL);
18434         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
18435         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18436                 (*env)->ExceptionDescribe(env);
18437                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
18438         }
18439         if (get_jenv_res == JNI_EDETACHED) {
18440                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18441         }
18442         return ret;
18443 }
18444 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
18445         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18446         JNIEnv *env;
18447         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18448         if (get_jenv_res == JNI_EDETACHED) {
18449                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18450         } else {
18451                 DO_ASSERT(get_jenv_res == JNI_OK);
18452         }
18453         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18454         CHECK(obj != NULL);
18455         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18456         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18457                 (*env)->ExceptionDescribe(env);
18458                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
18459         }
18460         LDKNodeFeatures ret_conv;
18461         ret_conv.inner = untag_ptr(ret);
18462         ret_conv.is_owned = ptr_is_owned(ret);
18463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18464         if (get_jenv_res == JNI_EDETACHED) {
18465                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18466         }
18467         return ret_conv;
18468 }
18469 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18470         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
18471         JNIEnv *env;
18472         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18473         if (get_jenv_res == JNI_EDETACHED) {
18474                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18475         } else {
18476                 DO_ASSERT(get_jenv_res == JNI_OK);
18477         }
18478         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18479         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18480         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18481         CHECK(obj != NULL);
18482         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18483         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18484                 (*env)->ExceptionDescribe(env);
18485                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
18486         }
18487         LDKInitFeatures ret_conv;
18488         ret_conv.inner = untag_ptr(ret);
18489         ret_conv.is_owned = ptr_is_owned(ret);
18490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18491         if (get_jenv_res == JNI_EDETACHED) {
18492                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18493         }
18494         return ret_conv;
18495 }
18496 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
18497         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
18498         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18499         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
18500 }
18501 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18502         jclass c = (*env)->GetObjectClass(env, o);
18503         CHECK(c != NULL);
18504         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
18505         atomic_init(&calls->refcnt, 1);
18506         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18507         calls->o = (*env)->NewWeakGlobalRef(env, o);
18508         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
18509         CHECK(calls->handle_node_announcement_meth != NULL);
18510         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
18511         CHECK(calls->handle_channel_announcement_meth != NULL);
18512         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
18513         CHECK(calls->handle_channel_update_meth != NULL);
18514         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
18515         CHECK(calls->get_next_channel_announcement_meth != NULL);
18516         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
18517         CHECK(calls->get_next_node_announcement_meth != NULL);
18518         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18519         CHECK(calls->peer_connected_meth != NULL);
18520         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
18521         CHECK(calls->handle_reply_channel_range_meth != NULL);
18522         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
18523         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
18524         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
18525         CHECK(calls->handle_query_channel_range_meth != NULL);
18526         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
18527         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
18528         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
18529         CHECK(calls->processing_queue_high_meth != NULL);
18530         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18531         CHECK(calls->provided_node_features_meth != NULL);
18532         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18533         CHECK(calls->provided_init_features_meth != NULL);
18534
18535         LDKRoutingMessageHandler ret = {
18536                 .this_arg = (void*) calls,
18537                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
18538                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
18539                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
18540                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
18541                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
18542                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
18543                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
18544                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
18545                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
18546                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
18547                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
18548                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
18549                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
18550                 .free = LDKRoutingMessageHandler_JCalls_free,
18551                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
18552         };
18553         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
18554         return ret;
18555 }
18556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18557         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
18558         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
18559         return tag_ptr(res_ptr, true);
18560 }
18561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
18562         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
18563         return tag_ptr(&inp->MessageSendEventsProvider, false);
18564 }
18565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18566         void* this_arg_ptr = untag_ptr(this_arg);
18567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18568         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18569         LDKNodeAnnouncement msg_conv;
18570         msg_conv.inner = untag_ptr(msg);
18571         msg_conv.is_owned = ptr_is_owned(msg);
18572         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18573         msg_conv.is_owned = false;
18574         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18575         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
18576         return tag_ptr(ret_conv, true);
18577 }
18578
18579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18580         void* this_arg_ptr = untag_ptr(this_arg);
18581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18582         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18583         LDKChannelAnnouncement msg_conv;
18584         msg_conv.inner = untag_ptr(msg);
18585         msg_conv.is_owned = ptr_is_owned(msg);
18586         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18587         msg_conv.is_owned = false;
18588         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18589         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
18590         return tag_ptr(ret_conv, true);
18591 }
18592
18593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18594         void* this_arg_ptr = untag_ptr(this_arg);
18595         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18596         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18597         LDKChannelUpdate msg_conv;
18598         msg_conv.inner = untag_ptr(msg);
18599         msg_conv.is_owned = ptr_is_owned(msg);
18600         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18601         msg_conv.is_owned = false;
18602         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18603         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
18604         return tag_ptr(ret_conv, true);
18605 }
18606
18607 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) {
18608         void* this_arg_ptr = untag_ptr(this_arg);
18609         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18610         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18611         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
18612         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
18613         int64_t ret_ref = tag_ptr(ret_copy, true);
18614         return ret_ref;
18615 }
18616
18617 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) {
18618         void* this_arg_ptr = untag_ptr(this_arg);
18619         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18620         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18621         LDKNodeId starting_point_conv;
18622         starting_point_conv.inner = untag_ptr(starting_point);
18623         starting_point_conv.is_owned = ptr_is_owned(starting_point);
18624         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
18625         starting_point_conv = NodeId_clone(&starting_point_conv);
18626         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
18627         int64_t ret_ref = 0;
18628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18630         return ret_ref;
18631 }
18632
18633 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) {
18634         void* this_arg_ptr = untag_ptr(this_arg);
18635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18636         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18637         LDKPublicKey their_node_id_ref;
18638         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18639         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18640         LDKInit init_conv;
18641         init_conv.inner = untag_ptr(init);
18642         init_conv.is_owned = ptr_is_owned(init);
18643         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
18644         init_conv.is_owned = false;
18645         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18646         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
18647         return tag_ptr(ret_conv, true);
18648 }
18649
18650 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) {
18651         void* this_arg_ptr = untag_ptr(this_arg);
18652         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18653         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18654         LDKPublicKey their_node_id_ref;
18655         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18656         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18657         LDKReplyChannelRange msg_conv;
18658         msg_conv.inner = untag_ptr(msg);
18659         msg_conv.is_owned = ptr_is_owned(msg);
18660         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18661         msg_conv = ReplyChannelRange_clone(&msg_conv);
18662         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18663         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18664         return tag_ptr(ret_conv, true);
18665 }
18666
18667 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) {
18668         void* this_arg_ptr = untag_ptr(this_arg);
18669         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18670         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18671         LDKPublicKey their_node_id_ref;
18672         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18673         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18674         LDKReplyShortChannelIdsEnd msg_conv;
18675         msg_conv.inner = untag_ptr(msg);
18676         msg_conv.is_owned = ptr_is_owned(msg);
18677         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18678         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
18679         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18680         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18681         return tag_ptr(ret_conv, true);
18682 }
18683
18684 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) {
18685         void* this_arg_ptr = untag_ptr(this_arg);
18686         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18687         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18688         LDKPublicKey their_node_id_ref;
18689         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18690         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18691         LDKQueryChannelRange msg_conv;
18692         msg_conv.inner = untag_ptr(msg);
18693         msg_conv.is_owned = ptr_is_owned(msg);
18694         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18695         msg_conv = QueryChannelRange_clone(&msg_conv);
18696         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18697         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18698         return tag_ptr(ret_conv, true);
18699 }
18700
18701 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) {
18702         void* this_arg_ptr = untag_ptr(this_arg);
18703         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18704         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18705         LDKPublicKey their_node_id_ref;
18706         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18707         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18708         LDKQueryShortChannelIds msg_conv;
18709         msg_conv.inner = untag_ptr(msg);
18710         msg_conv.is_owned = ptr_is_owned(msg);
18711         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18712         msg_conv = QueryShortChannelIds_clone(&msg_conv);
18713         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18714         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
18715         return tag_ptr(ret_conv, true);
18716 }
18717
18718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
18719         void* this_arg_ptr = untag_ptr(this_arg);
18720         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18721         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18722         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
18723         return ret_conv;
18724 }
18725
18726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
18727         void* this_arg_ptr = untag_ptr(this_arg);
18728         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18729         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18730         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
18731         int64_t ret_ref = 0;
18732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18734         return ret_ref;
18735 }
18736
18737 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) {
18738         void* this_arg_ptr = untag_ptr(this_arg);
18739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18740         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
18741         LDKPublicKey their_node_id_ref;
18742         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18743         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18744         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18745         int64_t ret_ref = 0;
18746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18748         return ret_ref;
18749 }
18750
18751 typedef struct LDKOnionMessageHandler_JCalls {
18752         atomic_size_t refcnt;
18753         JavaVM *vm;
18754         jweak o;
18755         jmethodID handle_onion_message_meth;
18756         jmethodID next_onion_message_for_peer_meth;
18757         jmethodID peer_connected_meth;
18758         jmethodID peer_disconnected_meth;
18759         jmethodID provided_node_features_meth;
18760         jmethodID provided_init_features_meth;
18761 } LDKOnionMessageHandler_JCalls;
18762 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
18763         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18764         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18765                 JNIEnv *env;
18766                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18767                 if (get_jenv_res == JNI_EDETACHED) {
18768                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18769                 } else {
18770                         DO_ASSERT(get_jenv_res == JNI_OK);
18771                 }
18772                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18773                 if (get_jenv_res == JNI_EDETACHED) {
18774                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18775                 }
18776                 FREE(j_calls);
18777         }
18778 }
18779 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
18780         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18781         JNIEnv *env;
18782         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18783         if (get_jenv_res == JNI_EDETACHED) {
18784                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18785         } else {
18786                 DO_ASSERT(get_jenv_res == JNI_OK);
18787         }
18788         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
18789         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
18790         LDKOnionMessage msg_var = *msg;
18791         int64_t msg_ref = 0;
18792         msg_var = OnionMessage_clone(&msg_var);
18793         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18794         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18795         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18796         CHECK(obj != NULL);
18797         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
18798         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18799                 (*env)->ExceptionDescribe(env);
18800                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
18801         }
18802         if (get_jenv_res == JNI_EDETACHED) {
18803                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18804         }
18805 }
18806 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
18807         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18808         JNIEnv *env;
18809         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18810         if (get_jenv_res == JNI_EDETACHED) {
18811                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18812         } else {
18813                 DO_ASSERT(get_jenv_res == JNI_OK);
18814         }
18815         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
18816         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
18817         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18818         CHECK(obj != NULL);
18819         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
18820         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18821                 (*env)->ExceptionDescribe(env);
18822                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageHandler from rust threw an exception.");
18823         }
18824         LDKOnionMessage ret_conv;
18825         ret_conv.inner = untag_ptr(ret);
18826         ret_conv.is_owned = ptr_is_owned(ret);
18827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18828         if (get_jenv_res == JNI_EDETACHED) {
18829                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18830         }
18831         return ret_conv;
18832 }
18833 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
18834         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18835         JNIEnv *env;
18836         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18837         if (get_jenv_res == JNI_EDETACHED) {
18838                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18839         } else {
18840                 DO_ASSERT(get_jenv_res == JNI_OK);
18841         }
18842         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18843         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18844         LDKInit init_var = *init;
18845         int64_t init_ref = 0;
18846         init_var = Init_clone(&init_var);
18847         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
18848         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
18849         jboolean inbound_conv = inbound;
18850         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18851         CHECK(obj != NULL);
18852         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
18853         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18854                 (*env)->ExceptionDescribe(env);
18855                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
18856         }
18857         void* ret_ptr = untag_ptr(ret);
18858         CHECK_ACCESS(ret_ptr);
18859         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
18860         FREE(untag_ptr(ret));
18861         if (get_jenv_res == JNI_EDETACHED) {
18862                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18863         }
18864         return ret_conv;
18865 }
18866 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18867         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18868         JNIEnv *env;
18869         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18870         if (get_jenv_res == JNI_EDETACHED) {
18871                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18872         } else {
18873                 DO_ASSERT(get_jenv_res == JNI_OK);
18874         }
18875         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18876         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18877         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18878         CHECK(obj != NULL);
18879         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
18880         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18881                 (*env)->ExceptionDescribe(env);
18882                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
18883         }
18884         if (get_jenv_res == JNI_EDETACHED) {
18885                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18886         }
18887 }
18888 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
18889         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18890         JNIEnv *env;
18891         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18892         if (get_jenv_res == JNI_EDETACHED) {
18893                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18894         } else {
18895                 DO_ASSERT(get_jenv_res == JNI_OK);
18896         }
18897         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18898         CHECK(obj != NULL);
18899         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18900         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18901                 (*env)->ExceptionDescribe(env);
18902                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
18903         }
18904         LDKNodeFeatures ret_conv;
18905         ret_conv.inner = untag_ptr(ret);
18906         ret_conv.is_owned = ptr_is_owned(ret);
18907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18908         if (get_jenv_res == JNI_EDETACHED) {
18909                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18910         }
18911         return ret_conv;
18912 }
18913 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18914         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
18915         JNIEnv *env;
18916         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18917         if (get_jenv_res == JNI_EDETACHED) {
18918                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18919         } else {
18920                 DO_ASSERT(get_jenv_res == JNI_OK);
18921         }
18922         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18923         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18924         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18925         CHECK(obj != NULL);
18926         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18927         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18928                 (*env)->ExceptionDescribe(env);
18929                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
18930         }
18931         LDKInitFeatures ret_conv;
18932         ret_conv.inner = untag_ptr(ret);
18933         ret_conv.is_owned = ptr_is_owned(ret);
18934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18935         if (get_jenv_res == JNI_EDETACHED) {
18936                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18937         }
18938         return ret_conv;
18939 }
18940 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
18941         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
18942         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18943 }
18944 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
18945         jclass c = (*env)->GetObjectClass(env, o);
18946         CHECK(c != NULL);
18947         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
18948         atomic_init(&calls->refcnt, 1);
18949         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18950         calls->o = (*env)->NewWeakGlobalRef(env, o);
18951         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
18952         CHECK(calls->handle_onion_message_meth != NULL);
18953         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
18954         CHECK(calls->next_onion_message_for_peer_meth != NULL);
18955         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18956         CHECK(calls->peer_connected_meth != NULL);
18957         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
18958         CHECK(calls->peer_disconnected_meth != NULL);
18959         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18960         CHECK(calls->provided_node_features_meth != NULL);
18961         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18962         CHECK(calls->provided_init_features_meth != NULL);
18963
18964         LDKOnionMessageHandler ret = {
18965                 .this_arg = (void*) calls,
18966                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
18967                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
18968                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
18969                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
18970                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
18971                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
18972                 .free = LDKOnionMessageHandler_JCalls_free,
18973         };
18974         return ret;
18975 }
18976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18977         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
18978         *res_ptr = LDKOnionMessageHandler_init(env, clz, o);
18979         return tag_ptr(res_ptr, true);
18980 }
18981 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) {
18982         void* this_arg_ptr = untag_ptr(this_arg);
18983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18984         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
18985         LDKPublicKey peer_node_id_ref;
18986         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
18987         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
18988         LDKOnionMessage msg_conv;
18989         msg_conv.inner = untag_ptr(msg);
18990         msg_conv.is_owned = ptr_is_owned(msg);
18991         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18992         msg_conv.is_owned = false;
18993         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
18994 }
18995
18996 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) {
18997         void* this_arg_ptr = untag_ptr(this_arg);
18998         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18999         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19000         LDKPublicKey peer_node_id_ref;
19001         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
19002         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
19003         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
19004         int64_t ret_ref = 0;
19005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19007         return ret_ref;
19008 }
19009
19010 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) {
19011         void* this_arg_ptr = untag_ptr(this_arg);
19012         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19013         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19014         LDKPublicKey their_node_id_ref;
19015         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19016         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19017         LDKInit init_conv;
19018         init_conv.inner = untag_ptr(init);
19019         init_conv.is_owned = ptr_is_owned(init);
19020         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
19021         init_conv.is_owned = false;
19022         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19023         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
19024         return tag_ptr(ret_conv, true);
19025 }
19026
19027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
19028         void* this_arg_ptr = untag_ptr(this_arg);
19029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19030         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19031         LDKPublicKey their_node_id_ref;
19032         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19033         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19034         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
19035 }
19036
19037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
19038         void* this_arg_ptr = untag_ptr(this_arg);
19039         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19040         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19041         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
19042         int64_t ret_ref = 0;
19043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19045         return ret_ref;
19046 }
19047
19048 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) {
19049         void* this_arg_ptr = untag_ptr(this_arg);
19050         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19051         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
19052         LDKPublicKey their_node_id_ref;
19053         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19054         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19055         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
19056         int64_t ret_ref = 0;
19057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19059         return ret_ref;
19060 }
19061
19062 typedef struct LDKCustomMessageReader_JCalls {
19063         atomic_size_t refcnt;
19064         JavaVM *vm;
19065         jweak o;
19066         jmethodID read_meth;
19067 } LDKCustomMessageReader_JCalls;
19068 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
19069         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
19070         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19071                 JNIEnv *env;
19072                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19073                 if (get_jenv_res == JNI_EDETACHED) {
19074                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19075                 } else {
19076                         DO_ASSERT(get_jenv_res == JNI_OK);
19077                 }
19078                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19079                 if (get_jenv_res == JNI_EDETACHED) {
19080                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19081                 }
19082                 FREE(j_calls);
19083         }
19084 }
19085 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
19086         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
19087         JNIEnv *env;
19088         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19089         if (get_jenv_res == JNI_EDETACHED) {
19090                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19091         } else {
19092                 DO_ASSERT(get_jenv_res == JNI_OK);
19093         }
19094         int16_t message_type_conv = message_type;
19095         LDKu8slice buffer_var = buffer;
19096         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
19097         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
19098         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19099         CHECK(obj != NULL);
19100         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
19101         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19102                 (*env)->ExceptionDescribe(env);
19103                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
19104         }
19105         void* ret_ptr = untag_ptr(ret);
19106         CHECK_ACCESS(ret_ptr);
19107         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
19108         FREE(untag_ptr(ret));
19109         if (get_jenv_res == JNI_EDETACHED) {
19110                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19111         }
19112         return ret_conv;
19113 }
19114 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
19115         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
19116         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19117 }
19118 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
19119         jclass c = (*env)->GetObjectClass(env, o);
19120         CHECK(c != NULL);
19121         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
19122         atomic_init(&calls->refcnt, 1);
19123         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19124         calls->o = (*env)->NewWeakGlobalRef(env, o);
19125         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
19126         CHECK(calls->read_meth != NULL);
19127
19128         LDKCustomMessageReader ret = {
19129                 .this_arg = (void*) calls,
19130                 .read = read_LDKCustomMessageReader_jcall,
19131                 .free = LDKCustomMessageReader_JCalls_free,
19132         };
19133         return ret;
19134 }
19135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
19136         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
19137         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
19138         return tag_ptr(res_ptr, true);
19139 }
19140 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) {
19141         void* this_arg_ptr = untag_ptr(this_arg);
19142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19143         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
19144         LDKu8slice buffer_ref;
19145         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
19146         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
19147         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19148         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
19149         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
19150         return tag_ptr(ret_conv, true);
19151 }
19152
19153 typedef struct LDKCustomMessageHandler_JCalls {
19154         atomic_size_t refcnt;
19155         JavaVM *vm;
19156         jweak o;
19157         LDKCustomMessageReader_JCalls* CustomMessageReader;
19158         jmethodID handle_custom_message_meth;
19159         jmethodID get_and_clear_pending_msg_meth;
19160         jmethodID provided_node_features_meth;
19161         jmethodID provided_init_features_meth;
19162 } LDKCustomMessageHandler_JCalls;
19163 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
19164         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19165         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19166                 JNIEnv *env;
19167                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19168                 if (get_jenv_res == JNI_EDETACHED) {
19169                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19170                 } else {
19171                         DO_ASSERT(get_jenv_res == JNI_OK);
19172                 }
19173                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19174                 if (get_jenv_res == JNI_EDETACHED) {
19175                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19176                 }
19177                 FREE(j_calls);
19178         }
19179 }
19180 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
19181         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19182         JNIEnv *env;
19183         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19184         if (get_jenv_res == JNI_EDETACHED) {
19185                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19186         } else {
19187                 DO_ASSERT(get_jenv_res == JNI_OK);
19188         }
19189         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
19190         *msg_ret = msg;
19191         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
19192         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
19193         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19194         CHECK(obj != NULL);
19195         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
19196         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19197                 (*env)->ExceptionDescribe(env);
19198                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
19199         }
19200         void* ret_ptr = untag_ptr(ret);
19201         CHECK_ACCESS(ret_ptr);
19202         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19203         FREE(untag_ptr(ret));
19204         if (get_jenv_res == JNI_EDETACHED) {
19205                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19206         }
19207         return ret_conv;
19208 }
19209 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
19210         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19211         JNIEnv *env;
19212         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19213         if (get_jenv_res == JNI_EDETACHED) {
19214                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19215         } else {
19216                 DO_ASSERT(get_jenv_res == JNI_OK);
19217         }
19218         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19219         CHECK(obj != NULL);
19220         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
19221         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19222                 (*env)->ExceptionDescribe(env);
19223                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
19224         }
19225         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
19226         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
19227         if (ret_constr.datalen > 0)
19228                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
19229         else
19230                 ret_constr.data = NULL;
19231         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
19232         for (size_t z = 0; z < ret_constr.datalen; z++) {
19233                 int64_t ret_conv_25 = ret_vals[z];
19234                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
19235                 CHECK_ACCESS(ret_conv_25_ptr);
19236                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
19237                 FREE(untag_ptr(ret_conv_25));
19238                 ret_constr.data[z] = ret_conv_25_conv;
19239         }
19240         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
19241         if (get_jenv_res == JNI_EDETACHED) {
19242                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19243         }
19244         return ret_constr;
19245 }
19246 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
19247         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19248         JNIEnv *env;
19249         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19250         if (get_jenv_res == JNI_EDETACHED) {
19251                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19252         } else {
19253                 DO_ASSERT(get_jenv_res == JNI_OK);
19254         }
19255         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19256         CHECK(obj != NULL);
19257         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
19258         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19259                 (*env)->ExceptionDescribe(env);
19260                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
19261         }
19262         LDKNodeFeatures ret_conv;
19263         ret_conv.inner = untag_ptr(ret);
19264         ret_conv.is_owned = ptr_is_owned(ret);
19265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19266         if (get_jenv_res == JNI_EDETACHED) {
19267                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19268         }
19269         return ret_conv;
19270 }
19271 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
19272         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
19273         JNIEnv *env;
19274         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19275         if (get_jenv_res == JNI_EDETACHED) {
19276                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19277         } else {
19278                 DO_ASSERT(get_jenv_res == JNI_OK);
19279         }
19280         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19281         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19282         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19283         CHECK(obj != NULL);
19284         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
19285         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19286                 (*env)->ExceptionDescribe(env);
19287                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
19288         }
19289         LDKInitFeatures ret_conv;
19290         ret_conv.inner = untag_ptr(ret);
19291         ret_conv.is_owned = ptr_is_owned(ret);
19292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19293         if (get_jenv_res == JNI_EDETACHED) {
19294                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19295         }
19296         return ret_conv;
19297 }
19298 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
19299         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
19300         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19301         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
19302 }
19303 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
19304         jclass c = (*env)->GetObjectClass(env, o);
19305         CHECK(c != NULL);
19306         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
19307         atomic_init(&calls->refcnt, 1);
19308         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19309         calls->o = (*env)->NewWeakGlobalRef(env, o);
19310         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
19311         CHECK(calls->handle_custom_message_meth != NULL);
19312         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
19313         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
19314         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
19315         CHECK(calls->provided_node_features_meth != NULL);
19316         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
19317         CHECK(calls->provided_init_features_meth != NULL);
19318
19319         LDKCustomMessageHandler ret = {
19320                 .this_arg = (void*) calls,
19321                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
19322                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
19323                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
19324                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
19325                 .free = LDKCustomMessageHandler_JCalls_free,
19326                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
19327         };
19328         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
19329         return ret;
19330 }
19331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
19332         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
19333         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
19334         return tag_ptr(res_ptr, true);
19335 }
19336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
19337         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
19338         return tag_ptr(&inp->CustomMessageReader, false);
19339 }
19340 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) {
19341         void* this_arg_ptr = untag_ptr(this_arg);
19342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19343         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
19344         void* msg_ptr = untag_ptr(msg);
19345         CHECK_ACCESS(msg_ptr);
19346         LDKType msg_conv = *(LDKType*)(msg_ptr);
19347         if (msg_conv.free == LDKType_JCalls_free) {
19348                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19349                 LDKType_JCalls_cloned(&msg_conv);
19350         }
19351         LDKPublicKey sender_node_id_ref;
19352         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
19353         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
19354         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19355         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
19356         return tag_ptr(ret_conv, true);
19357 }
19358
19359 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
19360         void* this_arg_ptr = untag_ptr(this_arg);
19361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19362         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
19363         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
19364         int64_tArray ret_arr = NULL;
19365         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19366         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19367         for (size_t z = 0; z < ret_var.datalen; z++) {
19368                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19369                 *ret_conv_25_conv = ret_var.data[z];
19370                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
19371         }
19372         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19373         FREE(ret_var.data);
19374         return ret_arr;
19375 }
19376
19377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
19378         void* this_arg_ptr = untag_ptr(this_arg);
19379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19380         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
19381         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
19382         int64_t ret_ref = 0;
19383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19385         return ret_ref;
19386 }
19387
19388 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) {
19389         void* this_arg_ptr = untag_ptr(this_arg);
19390         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19391         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
19392         LDKPublicKey their_node_id_ref;
19393         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19394         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19395         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
19396         int64_t ret_ref = 0;
19397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19399         return ret_ref;
19400 }
19401
19402 typedef struct LDKCustomOnionMessageHandler_JCalls {
19403         atomic_size_t refcnt;
19404         JavaVM *vm;
19405         jweak o;
19406         jmethodID handle_custom_message_meth;
19407         jmethodID read_custom_message_meth;
19408         jmethodID release_pending_custom_messages_meth;
19409 } LDKCustomOnionMessageHandler_JCalls;
19410 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
19411         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19412         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19413                 JNIEnv *env;
19414                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19415                 if (get_jenv_res == JNI_EDETACHED) {
19416                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19417                 } else {
19418                         DO_ASSERT(get_jenv_res == JNI_OK);
19419                 }
19420                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19421                 if (get_jenv_res == JNI_EDETACHED) {
19422                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19423                 }
19424                 FREE(j_calls);
19425         }
19426 }
19427 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
19428         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19429         JNIEnv *env;
19430         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19431         if (get_jenv_res == JNI_EDETACHED) {
19432                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19433         } else {
19434                 DO_ASSERT(get_jenv_res == JNI_OK);
19435         }
19436         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
19437         *msg_ret = msg;
19438         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19439         CHECK(obj != NULL);
19440         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
19441         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19442                 (*env)->ExceptionDescribe(env);
19443                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
19444         }
19445         void* ret_ptr = untag_ptr(ret);
19446         CHECK_ACCESS(ret_ptr);
19447         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
19448         FREE(untag_ptr(ret));
19449         if (get_jenv_res == JNI_EDETACHED) {
19450                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19451         }
19452         return ret_conv;
19453 }
19454 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
19455         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19456         JNIEnv *env;
19457         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19458         if (get_jenv_res == JNI_EDETACHED) {
19459                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19460         } else {
19461                 DO_ASSERT(get_jenv_res == JNI_OK);
19462         }
19463         int64_t message_type_conv = message_type;
19464         LDKu8slice buffer_var = buffer;
19465         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
19466         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
19467         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19468         CHECK(obj != NULL);
19469         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
19470         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19471                 (*env)->ExceptionDescribe(env);
19472                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
19473         }
19474         void* ret_ptr = untag_ptr(ret);
19475         CHECK_ACCESS(ret_ptr);
19476         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
19477         FREE(untag_ptr(ret));
19478         if (get_jenv_res == JNI_EDETACHED) {
19479                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19480         }
19481         return ret_conv;
19482 }
19483 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
19484         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
19485         JNIEnv *env;
19486         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19487         if (get_jenv_res == JNI_EDETACHED) {
19488                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19489         } else {
19490                 DO_ASSERT(get_jenv_res == JNI_OK);
19491         }
19492         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19493         CHECK(obj != NULL);
19494         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_custom_messages_meth);
19495         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19496                 (*env)->ExceptionDescribe(env);
19497                 (*env)->FatalError(env, "A call to release_pending_custom_messages in LDKCustomOnionMessageHandler from rust threw an exception.");
19498         }
19499         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
19500         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
19501         if (ret_constr.datalen > 0)
19502                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
19503         else
19504                 ret_constr.data = NULL;
19505         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
19506         for (size_t e = 0; e < ret_constr.datalen; e++) {
19507                 int64_t ret_conv_56 = ret_vals[e];
19508                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
19509                 CHECK_ACCESS(ret_conv_56_ptr);
19510                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
19511                 FREE(untag_ptr(ret_conv_56));
19512                 ret_constr.data[e] = ret_conv_56_conv;
19513         }
19514         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
19515         if (get_jenv_res == JNI_EDETACHED) {
19516                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19517         }
19518         return ret_constr;
19519 }
19520 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
19521         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
19522         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19523 }
19524 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
19525         jclass c = (*env)->GetObjectClass(env, o);
19526         CHECK(c != NULL);
19527         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
19528         atomic_init(&calls->refcnt, 1);
19529         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19530         calls->o = (*env)->NewWeakGlobalRef(env, o);
19531         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
19532         CHECK(calls->handle_custom_message_meth != NULL);
19533         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
19534         CHECK(calls->read_custom_message_meth != NULL);
19535         calls->release_pending_custom_messages_meth = (*env)->GetMethodID(env, c, "release_pending_custom_messages", "()[J");
19536         CHECK(calls->release_pending_custom_messages_meth != NULL);
19537
19538         LDKCustomOnionMessageHandler ret = {
19539                 .this_arg = (void*) calls,
19540                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
19541                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
19542                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
19543                 .free = LDKCustomOnionMessageHandler_JCalls_free,
19544         };
19545         return ret;
19546 }
19547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19548         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
19549         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
19550         return tag_ptr(res_ptr, true);
19551 }
19552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19553         void* this_arg_ptr = untag_ptr(this_arg);
19554         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19555         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19556         void* msg_ptr = untag_ptr(msg);
19557         CHECK_ACCESS(msg_ptr);
19558         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
19559         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
19560                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19561                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
19562         }
19563         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
19564         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
19565         int64_t ret_ref = tag_ptr(ret_copy, true);
19566         return ret_ref;
19567 }
19568
19569 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) {
19570         void* this_arg_ptr = untag_ptr(this_arg);
19571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19572         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19573         LDKu8slice buffer_ref;
19574         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
19575         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
19576         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
19577         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
19578         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
19579         return tag_ptr(ret_conv, true);
19580 }
19581
19582 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
19583         void* this_arg_ptr = untag_ptr(this_arg);
19584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19585         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
19586         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
19587         int64_tArray ret_arr = NULL;
19588         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19589         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19590         for (size_t e = 0; e < ret_var.datalen; e++) {
19591                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
19592                 *ret_conv_56_conv = ret_var.data[e];
19593                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
19594         }
19595         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19596         FREE(ret_var.data);
19597         return ret_arr;
19598 }
19599
19600 typedef struct LDKSocketDescriptor_JCalls {
19601         atomic_size_t refcnt;
19602         JavaVM *vm;
19603         jweak o;
19604         jmethodID send_data_meth;
19605         jmethodID disconnect_socket_meth;
19606         jmethodID eq_meth;
19607         jmethodID hash_meth;
19608 } LDKSocketDescriptor_JCalls;
19609 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
19610         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19611         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19612                 JNIEnv *env;
19613                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19614                 if (get_jenv_res == JNI_EDETACHED) {
19615                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19616                 } else {
19617                         DO_ASSERT(get_jenv_res == JNI_OK);
19618                 }
19619                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19620                 if (get_jenv_res == JNI_EDETACHED) {
19621                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19622                 }
19623                 FREE(j_calls);
19624         }
19625 }
19626 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
19627         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19628         JNIEnv *env;
19629         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19630         if (get_jenv_res == JNI_EDETACHED) {
19631                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19632         } else {
19633                 DO_ASSERT(get_jenv_res == JNI_OK);
19634         }
19635         LDKu8slice data_var = data;
19636         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
19637         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
19638         jboolean resume_read_conv = resume_read;
19639         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19640         CHECK(obj != NULL);
19641         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
19642         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19643                 (*env)->ExceptionDescribe(env);
19644                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
19645         }
19646         if (get_jenv_res == JNI_EDETACHED) {
19647                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19648         }
19649         return ret;
19650 }
19651 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
19652         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19653         JNIEnv *env;
19654         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19655         if (get_jenv_res == JNI_EDETACHED) {
19656                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19657         } else {
19658                 DO_ASSERT(get_jenv_res == JNI_OK);
19659         }
19660         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19661         CHECK(obj != NULL);
19662         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
19663         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19664                 (*env)->ExceptionDescribe(env);
19665                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
19666         }
19667         if (get_jenv_res == JNI_EDETACHED) {
19668                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19669         }
19670 }
19671 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
19672         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19673         JNIEnv *env;
19674         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19675         if (get_jenv_res == JNI_EDETACHED) {
19676                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19677         } else {
19678                 DO_ASSERT(get_jenv_res == JNI_OK);
19679         }
19680         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19681         *other_arg_clone = SocketDescriptor_clone(other_arg);
19682         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19683         CHECK(obj != NULL);
19684         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
19685         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19686                 (*env)->ExceptionDescribe(env);
19687                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
19688         }
19689         if (get_jenv_res == JNI_EDETACHED) {
19690                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19691         }
19692         return ret;
19693 }
19694 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
19695         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
19696         JNIEnv *env;
19697         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19698         if (get_jenv_res == JNI_EDETACHED) {
19699                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19700         } else {
19701                 DO_ASSERT(get_jenv_res == JNI_OK);
19702         }
19703         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19704         CHECK(obj != NULL);
19705         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
19706         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19707                 (*env)->ExceptionDescribe(env);
19708                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
19709         }
19710         if (get_jenv_res == JNI_EDETACHED) {
19711                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19712         }
19713         return ret;
19714 }
19715 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
19716         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
19717         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19718 }
19719 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
19720         jclass c = (*env)->GetObjectClass(env, o);
19721         CHECK(c != NULL);
19722         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
19723         atomic_init(&calls->refcnt, 1);
19724         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19725         calls->o = (*env)->NewWeakGlobalRef(env, o);
19726         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
19727         CHECK(calls->send_data_meth != NULL);
19728         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
19729         CHECK(calls->disconnect_socket_meth != NULL);
19730         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
19731         CHECK(calls->eq_meth != NULL);
19732         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
19733         CHECK(calls->hash_meth != NULL);
19734
19735         LDKSocketDescriptor ret = {
19736                 .this_arg = (void*) calls,
19737                 .send_data = send_data_LDKSocketDescriptor_jcall,
19738                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
19739                 .eq = eq_LDKSocketDescriptor_jcall,
19740                 .hash = hash_LDKSocketDescriptor_jcall,
19741                 .cloned = LDKSocketDescriptor_JCalls_cloned,
19742                 .free = LDKSocketDescriptor_JCalls_free,
19743         };
19744         return ret;
19745 }
19746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
19747         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
19748         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
19749         return tag_ptr(res_ptr, true);
19750 }
19751 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) {
19752         void* this_arg_ptr = untag_ptr(this_arg);
19753         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19754         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19755         LDKu8slice data_ref;
19756         data_ref.datalen = (*env)->GetArrayLength(env, data);
19757         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
19758         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
19759         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
19760         return ret_conv;
19761 }
19762
19763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
19764         void* this_arg_ptr = untag_ptr(this_arg);
19765         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19766         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19767         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
19768 }
19769
19770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
19771         void* this_arg_ptr = untag_ptr(this_arg);
19772         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19773         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
19774         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
19775         return ret_conv;
19776 }
19777
19778 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
19779 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
19780 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
19781 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
19782 static jclass LDKEffectiveCapacity_Total_class = NULL;
19783 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
19784 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
19785 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
19786 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
19787 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
19788 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
19789 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
19790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
19791         LDKEffectiveCapacity_ExactLiquidity_class =
19792                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
19793         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
19794         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
19795         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
19796         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
19797                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
19798         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
19799         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
19800         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
19801         LDKEffectiveCapacity_Total_class =
19802                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
19803         CHECK(LDKEffectiveCapacity_Total_class != NULL);
19804         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
19805         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
19806         LDKEffectiveCapacity_Infinite_class =
19807                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
19808         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
19809         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
19810         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
19811         LDKEffectiveCapacity_HintMaxHTLC_class =
19812                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
19813         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
19814         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
19815         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
19816         LDKEffectiveCapacity_Unknown_class =
19817                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
19818         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
19819         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
19820         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
19821 }
19822 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19823         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
19824         switch(obj->tag) {
19825                 case LDKEffectiveCapacity_ExactLiquidity: {
19826                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
19827                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
19828                 }
19829                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
19830                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
19831                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
19832                 }
19833                 case LDKEffectiveCapacity_Total: {
19834                         int64_t capacity_msat_conv = obj->total.capacity_msat;
19835                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
19836                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
19837                 }
19838                 case LDKEffectiveCapacity_Infinite: {
19839                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
19840                 }
19841                 case LDKEffectiveCapacity_HintMaxHTLC: {
19842                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
19843                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
19844                 }
19845                 case LDKEffectiveCapacity_Unknown: {
19846                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
19847                 }
19848                 default: abort();
19849         }
19850 }
19851 static jclass LDKPayee_Blinded_class = NULL;
19852 static jmethodID LDKPayee_Blinded_meth = NULL;
19853 static jclass LDKPayee_Clear_class = NULL;
19854 static jmethodID LDKPayee_Clear_meth = NULL;
19855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
19856         LDKPayee_Blinded_class =
19857                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
19858         CHECK(LDKPayee_Blinded_class != NULL);
19859         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
19860         CHECK(LDKPayee_Blinded_meth != NULL);
19861         LDKPayee_Clear_class =
19862                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
19863         CHECK(LDKPayee_Clear_class != NULL);
19864         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
19865         CHECK(LDKPayee_Clear_meth != NULL);
19866 }
19867 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19868         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
19869         switch(obj->tag) {
19870                 case LDKPayee_Blinded: {
19871                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
19872                         int64_tArray route_hints_arr = NULL;
19873                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
19874                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
19875                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
19876                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
19877                                 *route_hints_conv_37_conv = route_hints_var.data[l];
19878                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
19879                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
19880                         }
19881                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
19882                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
19883                         int64_t features_ref = 0;
19884                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
19885                         features_ref = tag_ptr(features_var.inner, false);
19886                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
19887                 }
19888                 case LDKPayee_Clear: {
19889                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
19890                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
19891                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
19892                         int64_tArray route_hints_arr = NULL;
19893                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
19894                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
19895                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
19896                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
19897                                 int64_t route_hints_conv_11_ref = 0;
19898                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
19899                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
19900                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
19901                         }
19902                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
19903                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
19904                         int64_t features_ref = 0;
19905                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
19906                         features_ref = tag_ptr(features_var.inner, false);
19907                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
19908                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
19909                 }
19910                 default: abort();
19911         }
19912 }
19913 typedef struct LDKScore_JCalls {
19914         atomic_size_t refcnt;
19915         JavaVM *vm;
19916         jweak o;
19917         LDKScoreLookUp_JCalls* ScoreLookUp;
19918         LDKScoreUpdate_JCalls* ScoreUpdate;
19919         jmethodID write_meth;
19920 } LDKScore_JCalls;
19921 static void LDKScore_JCalls_free(void* this_arg) {
19922         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
19923         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19924                 JNIEnv *env;
19925                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19926                 if (get_jenv_res == JNI_EDETACHED) {
19927                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19928                 } else {
19929                         DO_ASSERT(get_jenv_res == JNI_OK);
19930                 }
19931                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19932                 if (get_jenv_res == JNI_EDETACHED) {
19933                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19934                 }
19935                 FREE(j_calls);
19936         }
19937 }
19938 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
19939         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
19940         JNIEnv *env;
19941         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19942         if (get_jenv_res == JNI_EDETACHED) {
19943                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19944         } else {
19945                 DO_ASSERT(get_jenv_res == JNI_OK);
19946         }
19947         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19948         CHECK(obj != NULL);
19949         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
19950         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19951                 (*env)->ExceptionDescribe(env);
19952                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
19953         }
19954         LDKCVec_u8Z ret_ref;
19955         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
19956         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
19957         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
19958         if (get_jenv_res == JNI_EDETACHED) {
19959                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19960         }
19961         return ret_ref;
19962 }
19963 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
19964         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
19965         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19966         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
19967         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
19968 }
19969 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
19970         jclass c = (*env)->GetObjectClass(env, o);
19971         CHECK(c != NULL);
19972         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
19973         atomic_init(&calls->refcnt, 1);
19974         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19975         calls->o = (*env)->NewWeakGlobalRef(env, o);
19976         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
19977         CHECK(calls->write_meth != NULL);
19978
19979         LDKScore ret = {
19980                 .this_arg = (void*) calls,
19981                 .write = write_LDKScore_jcall,
19982                 .free = LDKScore_JCalls_free,
19983                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
19984                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
19985         };
19986         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
19987         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
19988         return ret;
19989 }
19990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
19991         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
19992         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
19993         return tag_ptr(res_ptr, true);
19994 }
19995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
19996         LDKScore *inp = (LDKScore *)untag_ptr(arg);
19997         return tag_ptr(&inp->ScoreLookUp, false);
19998 }
19999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
20000         LDKScore *inp = (LDKScore *)untag_ptr(arg);
20001         return tag_ptr(&inp->ScoreUpdate, false);
20002 }
20003 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
20004         void* this_arg_ptr = untag_ptr(this_arg);
20005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20006         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
20007         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
20008         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20009         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20010         CVec_u8Z_free(ret_var);
20011         return ret_arr;
20012 }
20013
20014 typedef struct LDKMessageRouter_JCalls {
20015         atomic_size_t refcnt;
20016         JavaVM *vm;
20017         jweak o;
20018         jmethodID find_path_meth;
20019 } LDKMessageRouter_JCalls;
20020 static void LDKMessageRouter_JCalls_free(void* this_arg) {
20021         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
20022         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20023                 JNIEnv *env;
20024                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20025                 if (get_jenv_res == JNI_EDETACHED) {
20026                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20027                 } else {
20028                         DO_ASSERT(get_jenv_res == JNI_OK);
20029                 }
20030                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20031                 if (get_jenv_res == JNI_EDETACHED) {
20032                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20033                 }
20034                 FREE(j_calls);
20035         }
20036 }
20037 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
20038         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
20039         JNIEnv *env;
20040         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20041         if (get_jenv_res == JNI_EDETACHED) {
20042                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20043         } else {
20044                 DO_ASSERT(get_jenv_res == JNI_OK);
20045         }
20046         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
20047         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
20048         LDKCVec_PublicKeyZ peers_var = peers;
20049         jobjectArray peers_arr = NULL;
20050         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
20051         ;
20052         for (size_t i = 0; i < peers_var.datalen; i++) {
20053                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
20054                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
20055                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
20056         }
20057         
20058         FREE(peers_var.data);
20059         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
20060         *destination_copy = destination;
20061         int64_t destination_ref = tag_ptr(destination_copy, true);
20062         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20063         CHECK(obj != NULL);
20064         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
20065         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20066                 (*env)->ExceptionDescribe(env);
20067                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
20068         }
20069         void* ret_ptr = untag_ptr(ret);
20070         CHECK_ACCESS(ret_ptr);
20071         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
20072         FREE(untag_ptr(ret));
20073         if (get_jenv_res == JNI_EDETACHED) {
20074                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20075         }
20076         return ret_conv;
20077 }
20078 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
20079         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
20080         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20081 }
20082 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
20083         jclass c = (*env)->GetObjectClass(env, o);
20084         CHECK(c != NULL);
20085         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
20086         atomic_init(&calls->refcnt, 1);
20087         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20088         calls->o = (*env)->NewWeakGlobalRef(env, o);
20089         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
20090         CHECK(calls->find_path_meth != NULL);
20091
20092         LDKMessageRouter ret = {
20093                 .this_arg = (void*) calls,
20094                 .find_path = find_path_LDKMessageRouter_jcall,
20095                 .free = LDKMessageRouter_JCalls_free,
20096         };
20097         return ret;
20098 }
20099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
20100         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
20101         *res_ptr = LDKMessageRouter_init(env, clz, o);
20102         return tag_ptr(res_ptr, true);
20103 }
20104 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) {
20105         void* this_arg_ptr = untag_ptr(this_arg);
20106         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20107         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
20108         LDKPublicKey sender_ref;
20109         CHECK((*env)->GetArrayLength(env, sender) == 33);
20110         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
20111         LDKCVec_PublicKeyZ peers_constr;
20112         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
20113         if (peers_constr.datalen > 0)
20114                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
20115         else
20116                 peers_constr.data = NULL;
20117         for (size_t i = 0; i < peers_constr.datalen; i++) {
20118                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
20119                 LDKPublicKey peers_conv_8_ref;
20120                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
20121                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
20122                 peers_constr.data[i] = peers_conv_8_ref;
20123         }
20124         void* destination_ptr = untag_ptr(destination);
20125         CHECK_ACCESS(destination_ptr);
20126         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
20127         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
20128         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20129         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
20130         return tag_ptr(ret_conv, true);
20131 }
20132
20133 typedef struct LDKCoinSelectionSource_JCalls {
20134         atomic_size_t refcnt;
20135         JavaVM *vm;
20136         jweak o;
20137         jmethodID select_confirmed_utxos_meth;
20138         jmethodID sign_tx_meth;
20139 } LDKCoinSelectionSource_JCalls;
20140 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
20141         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
20142         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20143                 JNIEnv *env;
20144                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20145                 if (get_jenv_res == JNI_EDETACHED) {
20146                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20147                 } else {
20148                         DO_ASSERT(get_jenv_res == JNI_OK);
20149                 }
20150                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20151                 if (get_jenv_res == JNI_EDETACHED) {
20152                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20153                 }
20154                 FREE(j_calls);
20155         }
20156 }
20157 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) {
20158         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
20159         JNIEnv *env;
20160         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20161         if (get_jenv_res == JNI_EDETACHED) {
20162                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20163         } else {
20164                 DO_ASSERT(get_jenv_res == JNI_OK);
20165         }
20166         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
20167         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
20168         LDKCVec_InputZ must_spend_var = must_spend;
20169         int64_tArray must_spend_arr = NULL;
20170         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
20171         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
20172         for (size_t h = 0; h < must_spend_var.datalen; h++) {
20173                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
20174                 int64_t must_spend_conv_7_ref = 0;
20175                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
20176                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
20177                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
20178         }
20179         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
20180         FREE(must_spend_var.data);
20181         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
20182         int64_tArray must_pay_to_arr = NULL;
20183         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
20184         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
20185         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
20186                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20187                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
20188                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
20189         }
20190         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
20191         FREE(must_pay_to_var.data);
20192         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
20193         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20194         CHECK(obj != NULL);
20195         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);
20196         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20197                 (*env)->ExceptionDescribe(env);
20198                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
20199         }
20200         void* ret_ptr = untag_ptr(ret);
20201         CHECK_ACCESS(ret_ptr);
20202         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
20203         FREE(untag_ptr(ret));
20204         if (get_jenv_res == JNI_EDETACHED) {
20205                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20206         }
20207         return ret_conv;
20208 }
20209 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
20210         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
20211         JNIEnv *env;
20212         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20213         if (get_jenv_res == JNI_EDETACHED) {
20214                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20215         } else {
20216                 DO_ASSERT(get_jenv_res == JNI_OK);
20217         }
20218         LDKTransaction tx_var = tx;
20219         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
20220         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
20221         Transaction_free(tx_var);
20222         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20223         CHECK(obj != NULL);
20224         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
20225         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20226                 (*env)->ExceptionDescribe(env);
20227                 (*env)->FatalError(env, "A call to sign_tx in LDKCoinSelectionSource from rust threw an exception.");
20228         }
20229         void* ret_ptr = untag_ptr(ret);
20230         CHECK_ACCESS(ret_ptr);
20231         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
20232         FREE(untag_ptr(ret));
20233         if (get_jenv_res == JNI_EDETACHED) {
20234                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20235         }
20236         return ret_conv;
20237 }
20238 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
20239         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
20240         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20241 }
20242 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
20243         jclass c = (*env)->GetObjectClass(env, o);
20244         CHECK(c != NULL);
20245         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
20246         atomic_init(&calls->refcnt, 1);
20247         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20248         calls->o = (*env)->NewWeakGlobalRef(env, o);
20249         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
20250         CHECK(calls->select_confirmed_utxos_meth != NULL);
20251         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
20252         CHECK(calls->sign_tx_meth != NULL);
20253
20254         LDKCoinSelectionSource ret = {
20255                 .this_arg = (void*) calls,
20256                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
20257                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
20258                 .free = LDKCoinSelectionSource_JCalls_free,
20259         };
20260         return ret;
20261 }
20262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
20263         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
20264         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
20265         return tag_ptr(res_ptr, true);
20266 }
20267 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) {
20268         void* this_arg_ptr = untag_ptr(this_arg);
20269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20270         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
20271         LDKThirtyTwoBytes claim_id_ref;
20272         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
20273         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
20274         LDKCVec_InputZ must_spend_constr;
20275         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
20276         if (must_spend_constr.datalen > 0)
20277                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
20278         else
20279                 must_spend_constr.data = NULL;
20280         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
20281         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
20282                 int64_t must_spend_conv_7 = must_spend_vals[h];
20283                 LDKInput must_spend_conv_7_conv;
20284                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
20285                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
20286                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
20287                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
20288                 must_spend_constr.data[h] = must_spend_conv_7_conv;
20289         }
20290         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
20291         LDKCVec_TxOutZ must_pay_to_constr;
20292         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
20293         if (must_pay_to_constr.datalen > 0)
20294                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20295         else
20296                 must_pay_to_constr.data = NULL;
20297         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
20298         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
20299                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
20300                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
20301                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
20302                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
20303                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
20304                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
20305         }
20306         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
20307         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20308         *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);
20309         return tag_ptr(ret_conv, true);
20310 }
20311
20312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
20313         void* this_arg_ptr = untag_ptr(this_arg);
20314         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20315         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
20316         LDKTransaction tx_ref;
20317         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
20318         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
20319         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
20320         tx_ref.data_is_owned = true;
20321         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20322         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
20323         return tag_ptr(ret_conv, true);
20324 }
20325
20326 typedef struct LDKWalletSource_JCalls {
20327         atomic_size_t refcnt;
20328         JavaVM *vm;
20329         jweak o;
20330         jmethodID list_confirmed_utxos_meth;
20331         jmethodID get_change_script_meth;
20332         jmethodID sign_tx_meth;
20333 } LDKWalletSource_JCalls;
20334 static void LDKWalletSource_JCalls_free(void* this_arg) {
20335         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20336         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20337                 JNIEnv *env;
20338                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20339                 if (get_jenv_res == JNI_EDETACHED) {
20340                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20341                 } else {
20342                         DO_ASSERT(get_jenv_res == JNI_OK);
20343                 }
20344                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20345                 if (get_jenv_res == JNI_EDETACHED) {
20346                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20347                 }
20348                 FREE(j_calls);
20349         }
20350 }
20351 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
20352         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20353         JNIEnv *env;
20354         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20355         if (get_jenv_res == JNI_EDETACHED) {
20356                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20357         } else {
20358                 DO_ASSERT(get_jenv_res == JNI_OK);
20359         }
20360         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20361         CHECK(obj != NULL);
20362         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
20363         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20364                 (*env)->ExceptionDescribe(env);
20365                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
20366         }
20367         void* ret_ptr = untag_ptr(ret);
20368         CHECK_ACCESS(ret_ptr);
20369         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
20370         FREE(untag_ptr(ret));
20371         if (get_jenv_res == JNI_EDETACHED) {
20372                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20373         }
20374         return ret_conv;
20375 }
20376 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
20377         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20378         JNIEnv *env;
20379         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20380         if (get_jenv_res == JNI_EDETACHED) {
20381                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20382         } else {
20383                 DO_ASSERT(get_jenv_res == JNI_OK);
20384         }
20385         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20386         CHECK(obj != NULL);
20387         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
20388         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20389                 (*env)->ExceptionDescribe(env);
20390                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
20391         }
20392         void* ret_ptr = untag_ptr(ret);
20393         CHECK_ACCESS(ret_ptr);
20394         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
20395         FREE(untag_ptr(ret));
20396         if (get_jenv_res == JNI_EDETACHED) {
20397                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20398         }
20399         return ret_conv;
20400 }
20401 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
20402         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
20403         JNIEnv *env;
20404         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20405         if (get_jenv_res == JNI_EDETACHED) {
20406                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20407         } else {
20408                 DO_ASSERT(get_jenv_res == JNI_OK);
20409         }
20410         LDKTransaction tx_var = tx;
20411         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
20412         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
20413         Transaction_free(tx_var);
20414         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20415         CHECK(obj != NULL);
20416         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
20417         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20418                 (*env)->ExceptionDescribe(env);
20419                 (*env)->FatalError(env, "A call to sign_tx in LDKWalletSource from rust threw an exception.");
20420         }
20421         void* ret_ptr = untag_ptr(ret);
20422         CHECK_ACCESS(ret_ptr);
20423         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
20424         FREE(untag_ptr(ret));
20425         if (get_jenv_res == JNI_EDETACHED) {
20426                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20427         }
20428         return ret_conv;
20429 }
20430 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
20431         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
20432         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20433 }
20434 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
20435         jclass c = (*env)->GetObjectClass(env, o);
20436         CHECK(c != NULL);
20437         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
20438         atomic_init(&calls->refcnt, 1);
20439         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20440         calls->o = (*env)->NewWeakGlobalRef(env, o);
20441         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
20442         CHECK(calls->list_confirmed_utxos_meth != NULL);
20443         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
20444         CHECK(calls->get_change_script_meth != NULL);
20445         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
20446         CHECK(calls->sign_tx_meth != NULL);
20447
20448         LDKWalletSource ret = {
20449                 .this_arg = (void*) calls,
20450                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
20451                 .get_change_script = get_change_script_LDKWalletSource_jcall,
20452                 .sign_tx = sign_tx_LDKWalletSource_jcall,
20453                 .free = LDKWalletSource_JCalls_free,
20454         };
20455         return ret;
20456 }
20457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
20458         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
20459         *res_ptr = LDKWalletSource_init(env, clz, o);
20460         return tag_ptr(res_ptr, true);
20461 }
20462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
20463         void* this_arg_ptr = untag_ptr(this_arg);
20464         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20465         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20466         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20467         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
20468         return tag_ptr(ret_conv, true);
20469 }
20470
20471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
20472         void* this_arg_ptr = untag_ptr(this_arg);
20473         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20474         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20475         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20476         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
20477         return tag_ptr(ret_conv, true);
20478 }
20479
20480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
20481         void* this_arg_ptr = untag_ptr(this_arg);
20482         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20483         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
20484         LDKTransaction tx_ref;
20485         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
20486         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
20487         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
20488         tx_ref.data_is_owned = true;
20489         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20490         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
20491         return tag_ptr(ret_conv, true);
20492 }
20493
20494 static jclass LDKGossipSync_P2P_class = NULL;
20495 static jmethodID LDKGossipSync_P2P_meth = NULL;
20496 static jclass LDKGossipSync_Rapid_class = NULL;
20497 static jmethodID LDKGossipSync_Rapid_meth = NULL;
20498 static jclass LDKGossipSync_None_class = NULL;
20499 static jmethodID LDKGossipSync_None_meth = NULL;
20500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
20501         LDKGossipSync_P2P_class =
20502                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
20503         CHECK(LDKGossipSync_P2P_class != NULL);
20504         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
20505         CHECK(LDKGossipSync_P2P_meth != NULL);
20506         LDKGossipSync_Rapid_class =
20507                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
20508         CHECK(LDKGossipSync_Rapid_class != NULL);
20509         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
20510         CHECK(LDKGossipSync_Rapid_meth != NULL);
20511         LDKGossipSync_None_class =
20512                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
20513         CHECK(LDKGossipSync_None_class != NULL);
20514         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
20515         CHECK(LDKGossipSync_None_meth != NULL);
20516 }
20517 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
20518         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
20519         switch(obj->tag) {
20520                 case LDKGossipSync_P2P: {
20521                         LDKP2PGossipSync p2p_var = obj->p2p;
20522                         int64_t p2p_ref = 0;
20523                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
20524                         p2p_ref = tag_ptr(p2p_var.inner, false);
20525                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
20526                 }
20527                 case LDKGossipSync_Rapid: {
20528                         LDKRapidGossipSync rapid_var = obj->rapid;
20529                         int64_t rapid_ref = 0;
20530                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
20531                         rapid_ref = tag_ptr(rapid_var.inner, false);
20532                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
20533                 }
20534                 case LDKGossipSync_None: {
20535                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
20536                 }
20537                 default: abort();
20538         }
20539 }
20540 static jclass LDKFallback_SegWitProgram_class = NULL;
20541 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
20542 static jclass LDKFallback_PubKeyHash_class = NULL;
20543 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
20544 static jclass LDKFallback_ScriptHash_class = NULL;
20545 static jmethodID LDKFallback_ScriptHash_meth = NULL;
20546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
20547         LDKFallback_SegWitProgram_class =
20548                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
20549         CHECK(LDKFallback_SegWitProgram_class != NULL);
20550         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
20551         CHECK(LDKFallback_SegWitProgram_meth != NULL);
20552         LDKFallback_PubKeyHash_class =
20553                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
20554         CHECK(LDKFallback_PubKeyHash_class != NULL);
20555         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
20556         CHECK(LDKFallback_PubKeyHash_meth != NULL);
20557         LDKFallback_ScriptHash_class =
20558                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
20559         CHECK(LDKFallback_ScriptHash_class != NULL);
20560         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
20561         CHECK(LDKFallback_ScriptHash_meth != NULL);
20562 }
20563 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
20564         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
20565         switch(obj->tag) {
20566                 case LDKFallback_SegWitProgram: {
20567                         uint8_t version_val = obj->seg_wit_program.version._0;
20568                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
20569                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
20570                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
20571                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
20572                 }
20573                 case LDKFallback_PubKeyHash: {
20574                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
20575                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
20576                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
20577                 }
20578                 case LDKFallback_ScriptHash: {
20579                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
20580                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
20581                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
20582                 }
20583                 default: abort();
20584         }
20585 }
20586 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
20587         LDKStr ret_str = _ldk_get_compiled_version();
20588         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20589         Str_free(ret_str);
20590         return ret_conv;
20591 }
20592
20593 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
20594         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
20595         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20596         Str_free(ret_str);
20597         return ret_conv;
20598 }
20599
20600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
20601         LDKU128 val_ref;
20602         CHECK((*env)->GetArrayLength(env, val) == 16);
20603         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
20604         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
20605         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
20606         return ret_arr;
20607 }
20608
20609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
20610         LDKSixteenBytes le_bytes_ref;
20611         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
20612         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
20613         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
20614         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
20615         return ret_arr;
20616 }
20617
20618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
20619         LDKThirtyTwoBytes big_endian_bytes_ref;
20620         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
20621         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
20622         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
20623         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
20624         return tag_ptr(ret_ref, true);
20625 }
20626
20627 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
20628         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
20629         *ret_copy = Bech32Error_clone(arg);
20630         int64_t ret_ref = tag_ptr(ret_copy, true);
20631         return ret_ref;
20632 }
20633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20634         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
20635         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
20636         return ret_conv;
20637 }
20638
20639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20640         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
20641         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
20642         *ret_copy = Bech32Error_clone(orig_conv);
20643         int64_t ret_ref = tag_ptr(ret_copy, true);
20644         return ret_ref;
20645 }
20646
20647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
20648         if (!ptr_is_owned(o)) return;
20649         void* o_ptr = untag_ptr(o);
20650         CHECK_ACCESS(o_ptr);
20651         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
20652         FREE(untag_ptr(o));
20653         Bech32Error_free(o_conv);
20654 }
20655
20656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20657         LDKTransaction _res_ref;
20658         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20659         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
20660         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20661         _res_ref.data_is_owned = true;
20662         Transaction_free(_res_ref);
20663 }
20664
20665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
20666         LDKWitness _res_ref;
20667         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
20668         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
20669         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
20670         _res_ref.data_is_owned = true;
20671         Witness_free(_res_ref);
20672 }
20673
20674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
20675         if (!ptr_is_owned(_res)) return;
20676         void* _res_ptr = untag_ptr(_res);
20677         CHECK_ACCESS(_res_ptr);
20678         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
20679         FREE(untag_ptr(_res));
20680         TxIn_free(_res_conv);
20681 }
20682
20683 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) {
20684         LDKWitness witness_ref;
20685         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
20686         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
20687         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
20688         witness_ref.data_is_owned = true;
20689         LDKCVec_u8Z script_sig_ref;
20690         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
20691         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
20692         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
20693         LDKThirtyTwoBytes previous_txid_ref;
20694         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
20695         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
20696         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
20697         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
20698         return tag_ptr(ret_ref, true);
20699 }
20700
20701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
20702         LDKCVec_u8Z script_pubkey_ref;
20703         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
20704         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
20705         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
20706         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20707         *ret_ref = TxOut_new(script_pubkey_ref, value);
20708         return tag_ptr(ret_ref, true);
20709 }
20710
20711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
20712         if (!ptr_is_owned(_res)) return;
20713         void* _res_ptr = untag_ptr(_res);
20714         CHECK_ACCESS(_res_ptr);
20715         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
20716         FREE(untag_ptr(_res));
20717         TxOut_free(_res_conv);
20718 }
20719
20720 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
20721         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20722         *ret_ref = TxOut_clone(arg);
20723         return tag_ptr(ret_ref, true);
20724 }
20725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20726         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
20727         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
20728         return ret_conv;
20729 }
20730
20731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20732         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
20733         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
20734         *ret_ref = TxOut_clone(orig_conv);
20735         return tag_ptr(ret_ref, true);
20736 }
20737
20738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
20739         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
20740         Str_free(dummy);
20741 }
20742
20743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
20744         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20745         *ret_copy = COption_u64Z_some(o);
20746         int64_t ret_ref = tag_ptr(ret_copy, true);
20747         return ret_ref;
20748 }
20749
20750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
20751         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20752         *ret_copy = COption_u64Z_none();
20753         int64_t ret_ref = tag_ptr(ret_copy, true);
20754         return ret_ref;
20755 }
20756
20757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
20758         if (!ptr_is_owned(_res)) return;
20759         void* _res_ptr = untag_ptr(_res);
20760         CHECK_ACCESS(_res_ptr);
20761         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
20762         FREE(untag_ptr(_res));
20763         COption_u64Z_free(_res_conv);
20764 }
20765
20766 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
20767         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20768         *ret_copy = COption_u64Z_clone(arg);
20769         int64_t ret_ref = tag_ptr(ret_copy, true);
20770         return ret_ref;
20771 }
20772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20773         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
20774         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
20775         return ret_conv;
20776 }
20777
20778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20779         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
20780         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20781         *ret_copy = COption_u64Z_clone(orig_conv);
20782         int64_t ret_ref = tag_ptr(ret_copy, true);
20783         return ret_ref;
20784 }
20785
20786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20787         LDKCVec_BlindedPathZ _res_constr;
20788         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20789         if (_res_constr.datalen > 0)
20790                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
20791         else
20792                 _res_constr.data = NULL;
20793         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20794         for (size_t n = 0; n < _res_constr.datalen; n++) {
20795                 int64_t _res_conv_13 = _res_vals[n];
20796                 LDKBlindedPath _res_conv_13_conv;
20797                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
20798                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
20799                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
20800                 _res_constr.data[n] = _res_conv_13_conv;
20801         }
20802         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20803         CVec_BlindedPathZ_free(_res_constr);
20804 }
20805
20806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20807         LDKRefund o_conv;
20808         o_conv.inner = untag_ptr(o);
20809         o_conv.is_owned = ptr_is_owned(o);
20810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20811         o_conv = Refund_clone(&o_conv);
20812         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20813         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
20814         return tag_ptr(ret_conv, true);
20815 }
20816
20817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20818         LDKBolt12ParseError e_conv;
20819         e_conv.inner = untag_ptr(e);
20820         e_conv.is_owned = ptr_is_owned(e);
20821         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20822         e_conv = Bolt12ParseError_clone(&e_conv);
20823         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20824         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
20825         return tag_ptr(ret_conv, true);
20826 }
20827
20828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20829         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
20830         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
20831         return ret_conv;
20832 }
20833
20834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20835         if (!ptr_is_owned(_res)) return;
20836         void* _res_ptr = untag_ptr(_res);
20837         CHECK_ACCESS(_res_ptr);
20838         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
20839         FREE(untag_ptr(_res));
20840         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
20841 }
20842
20843 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
20844         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20845         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
20846         return tag_ptr(ret_conv, true);
20847 }
20848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20849         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
20850         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
20851         return ret_conv;
20852 }
20853
20854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20855         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
20856         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
20857         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
20858         return tag_ptr(ret_conv, true);
20859 }
20860
20861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20862         void* o_ptr = untag_ptr(o);
20863         CHECK_ACCESS(o_ptr);
20864         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
20865         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
20866         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20867         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
20868         return tag_ptr(ret_conv, true);
20869 }
20870
20871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20872         void* e_ptr = untag_ptr(e);
20873         CHECK_ACCESS(e_ptr);
20874         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20875         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20876         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20877         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
20878         return tag_ptr(ret_conv, true);
20879 }
20880
20881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20882         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
20883         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
20884         return ret_conv;
20885 }
20886
20887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20888         if (!ptr_is_owned(_res)) return;
20889         void* _res_ptr = untag_ptr(_res);
20890         CHECK_ACCESS(_res_ptr);
20891         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
20892         FREE(untag_ptr(_res));
20893         CResult_RetryDecodeErrorZ_free(_res_conv);
20894 }
20895
20896 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
20897         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20898         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
20899         return tag_ptr(ret_conv, true);
20900 }
20901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20902         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
20903         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
20904         return ret_conv;
20905 }
20906
20907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20908         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
20909         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
20910         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
20911         return tag_ptr(ret_conv, true);
20912 }
20913
20914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
20915         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20916         *ret_conv = CResult_NoneAPIErrorZ_ok();
20917         return tag_ptr(ret_conv, true);
20918 }
20919
20920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20921         void* e_ptr = untag_ptr(e);
20922         CHECK_ACCESS(e_ptr);
20923         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20924         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20925         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20926         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
20927         return tag_ptr(ret_conv, true);
20928 }
20929
20930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20931         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
20932         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
20933         return ret_conv;
20934 }
20935
20936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20937         if (!ptr_is_owned(_res)) return;
20938         void* _res_ptr = untag_ptr(_res);
20939         CHECK_ACCESS(_res_ptr);
20940         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
20941         FREE(untag_ptr(_res));
20942         CResult_NoneAPIErrorZ_free(_res_conv);
20943 }
20944
20945 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
20946         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20947         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
20948         return tag_ptr(ret_conv, true);
20949 }
20950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20951         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
20952         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
20953         return ret_conv;
20954 }
20955
20956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20957         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
20958         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
20959         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
20960         return tag_ptr(ret_conv, true);
20961 }
20962
20963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20964         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
20965         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20966         if (_res_constr.datalen > 0)
20967                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
20968         else
20969                 _res_constr.data = NULL;
20970         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20971         for (size_t w = 0; w < _res_constr.datalen; w++) {
20972                 int64_t _res_conv_22 = _res_vals[w];
20973                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20974                 CHECK_ACCESS(_res_conv_22_ptr);
20975                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
20976                 FREE(untag_ptr(_res_conv_22));
20977                 _res_constr.data[w] = _res_conv_22_conv;
20978         }
20979         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20980         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
20981 }
20982
20983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20984         LDKCVec_APIErrorZ _res_constr;
20985         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20986         if (_res_constr.datalen > 0)
20987                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
20988         else
20989                 _res_constr.data = NULL;
20990         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20991         for (size_t k = 0; k < _res_constr.datalen; k++) {
20992                 int64_t _res_conv_10 = _res_vals[k];
20993                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
20994                 CHECK_ACCESS(_res_conv_10_ptr);
20995                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
20996                 FREE(untag_ptr(_res_conv_10));
20997                 _res_constr.data[k] = _res_conv_10_conv;
20998         }
20999         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21000         CVec_APIErrorZ_free(_res_constr);
21001 }
21002
21003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
21004         LDKThirtyTwoBytes o_ref;
21005         CHECK((*env)->GetArrayLength(env, o) == 32);
21006         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21007         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
21008         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
21009         int64_t ret_ref = tag_ptr(ret_copy, true);
21010         return ret_ref;
21011 }
21012
21013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
21014         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
21015         *ret_copy = COption_ThirtyTwoBytesZ_none();
21016         int64_t ret_ref = tag_ptr(ret_copy, true);
21017         return ret_ref;
21018 }
21019
21020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21021         if (!ptr_is_owned(_res)) return;
21022         void* _res_ptr = untag_ptr(_res);
21023         CHECK_ACCESS(_res_ptr);
21024         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
21025         FREE(untag_ptr(_res));
21026         COption_ThirtyTwoBytesZ_free(_res_conv);
21027 }
21028
21029 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
21030         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
21031         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
21032         int64_t ret_ref = tag_ptr(ret_copy, true);
21033         return ret_ref;
21034 }
21035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21036         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
21037         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
21038         return ret_conv;
21039 }
21040
21041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21042         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
21043         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
21044         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
21045         int64_t ret_ref = tag_ptr(ret_copy, true);
21046         return ret_ref;
21047 }
21048
21049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
21050         LDKCVec_u8Z _res_ref;
21051         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
21052         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
21053         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
21054         CVec_u8Z_free(_res_ref);
21055 }
21056
21057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
21058         LDKCVec_u8Z o_ref;
21059         o_ref.datalen = (*env)->GetArrayLength(env, o);
21060         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
21061         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
21062         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
21063         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
21064         int64_t ret_ref = tag_ptr(ret_copy, true);
21065         return ret_ref;
21066 }
21067
21068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
21069         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
21070         *ret_copy = COption_CVec_u8ZZ_none();
21071         int64_t ret_ref = tag_ptr(ret_copy, true);
21072         return ret_ref;
21073 }
21074
21075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21076         if (!ptr_is_owned(_res)) return;
21077         void* _res_ptr = untag_ptr(_res);
21078         CHECK_ACCESS(_res_ptr);
21079         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
21080         FREE(untag_ptr(_res));
21081         COption_CVec_u8ZZ_free(_res_conv);
21082 }
21083
21084 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
21085         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
21086         *ret_copy = COption_CVec_u8ZZ_clone(arg);
21087         int64_t ret_ref = tag_ptr(ret_copy, true);
21088         return ret_ref;
21089 }
21090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21091         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
21092         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
21093         return ret_conv;
21094 }
21095
21096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21097         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
21098         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
21099         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
21100         int64_t ret_ref = tag_ptr(ret_copy, true);
21101         return ret_ref;
21102 }
21103
21104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21105         LDKRecipientOnionFields o_conv;
21106         o_conv.inner = untag_ptr(o);
21107         o_conv.is_owned = ptr_is_owned(o);
21108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21109         o_conv = RecipientOnionFields_clone(&o_conv);
21110         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
21111         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
21112         return tag_ptr(ret_conv, true);
21113 }
21114
21115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21116         void* e_ptr = untag_ptr(e);
21117         CHECK_ACCESS(e_ptr);
21118         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21119         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21120         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
21121         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
21122         return tag_ptr(ret_conv, true);
21123 }
21124
21125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21126         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
21127         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
21128         return ret_conv;
21129 }
21130
21131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21132         if (!ptr_is_owned(_res)) return;
21133         void* _res_ptr = untag_ptr(_res);
21134         CHECK_ACCESS(_res_ptr);
21135         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
21136         FREE(untag_ptr(_res));
21137         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
21138 }
21139
21140 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
21141         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
21142         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
21143         return tag_ptr(ret_conv, true);
21144 }
21145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21146         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
21147         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
21148         return ret_conv;
21149 }
21150
21151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21152         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
21153         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
21154         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
21155         return tag_ptr(ret_conv, true);
21156 }
21157
21158 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
21159         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
21160         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
21161         return tag_ptr(ret_conv, true);
21162 }
21163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21164         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
21165         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
21166         return ret_conv;
21167 }
21168
21169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21170         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
21171         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
21172         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
21173         return tag_ptr(ret_conv, true);
21174 }
21175
21176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
21177         LDKCVec_u8Z b_ref;
21178         b_ref.datalen = (*env)->GetArrayLength(env, b);
21179         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21180         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21181         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
21182         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
21183         return tag_ptr(ret_conv, true);
21184 }
21185
21186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21187         if (!ptr_is_owned(_res)) return;
21188         void* _res_ptr = untag_ptr(_res);
21189         CHECK_ACCESS(_res_ptr);
21190         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
21191         FREE(untag_ptr(_res));
21192         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
21193 }
21194
21195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21196         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
21197         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21198         if (_res_constr.datalen > 0)
21199                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
21200         else
21201                 _res_constr.data = NULL;
21202         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21203         for (size_t x = 0; x < _res_constr.datalen; x++) {
21204                 int64_t _res_conv_23 = _res_vals[x];
21205                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
21206                 CHECK_ACCESS(_res_conv_23_ptr);
21207                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
21208                 FREE(untag_ptr(_res_conv_23));
21209                 _res_constr.data[x] = _res_conv_23_conv;
21210         }
21211         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21212         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
21213 }
21214
21215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21216         LDKRecipientOnionFields o_conv;
21217         o_conv.inner = untag_ptr(o);
21218         o_conv.is_owned = ptr_is_owned(o);
21219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21220         o_conv = RecipientOnionFields_clone(&o_conv);
21221         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
21222         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
21223         return tag_ptr(ret_conv, true);
21224 }
21225
21226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
21227         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
21228         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
21229         return tag_ptr(ret_conv, true);
21230 }
21231
21232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21233         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
21234         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
21235         return ret_conv;
21236 }
21237
21238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21239         if (!ptr_is_owned(_res)) return;
21240         void* _res_ptr = untag_ptr(_res);
21241         CHECK_ACCESS(_res_ptr);
21242         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
21243         FREE(untag_ptr(_res));
21244         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
21245 }
21246
21247 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
21248         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
21249         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
21250         return tag_ptr(ret_conv, true);
21251 }
21252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21253         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
21254         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
21255         return ret_conv;
21256 }
21257
21258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21259         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
21260         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
21261         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
21262         return tag_ptr(ret_conv, true);
21263 }
21264
21265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21266         LDKCVec_ThirtyTwoBytesZ _res_constr;
21267         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21268         if (_res_constr.datalen > 0)
21269                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
21270         else
21271                 _res_constr.data = NULL;
21272         for (size_t i = 0; i < _res_constr.datalen; i++) {
21273                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21274                 LDKThirtyTwoBytes _res_conv_8_ref;
21275                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
21276                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
21277                 _res_constr.data[i] = _res_conv_8_ref;
21278         }
21279         CVec_ThirtyTwoBytesZ_free(_res_constr);
21280 }
21281
21282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
21283         LDKCVec_ThirtyTwoBytesZ o_constr;
21284         o_constr.datalen = (*env)->GetArrayLength(env, o);
21285         if (o_constr.datalen > 0)
21286                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
21287         else
21288                 o_constr.data = NULL;
21289         for (size_t i = 0; i < o_constr.datalen; i++) {
21290                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
21291                 LDKThirtyTwoBytes o_conv_8_ref;
21292                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
21293                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
21294                 o_constr.data[i] = o_conv_8_ref;
21295         }
21296         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21297         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
21298         int64_t ret_ref = tag_ptr(ret_copy, true);
21299         return ret_ref;
21300 }
21301
21302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
21303         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21304         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
21305         int64_t ret_ref = tag_ptr(ret_copy, true);
21306         return ret_ref;
21307 }
21308
21309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21310         if (!ptr_is_owned(_res)) return;
21311         void* _res_ptr = untag_ptr(_res);
21312         CHECK_ACCESS(_res_ptr);
21313         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
21314         FREE(untag_ptr(_res));
21315         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
21316 }
21317
21318 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
21319         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21320         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
21321         int64_t ret_ref = tag_ptr(ret_copy, true);
21322         return ret_ref;
21323 }
21324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21325         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
21326         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
21327         return ret_conv;
21328 }
21329
21330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21331         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
21332         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
21333         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
21334         int64_t ret_ref = tag_ptr(ret_copy, true);
21335         return ret_ref;
21336 }
21337
21338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21339         LDKThirtyTwoBytes o_ref;
21340         CHECK((*env)->GetArrayLength(env, o) == 32);
21341         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21342         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21343         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
21344         return tag_ptr(ret_conv, true);
21345 }
21346
21347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
21348         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21349         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
21350         return tag_ptr(ret_conv, true);
21351 }
21352
21353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21354         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
21355         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
21356         return ret_conv;
21357 }
21358
21359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21360         if (!ptr_is_owned(_res)) return;
21361         void* _res_ptr = untag_ptr(_res);
21362         CHECK_ACCESS(_res_ptr);
21363         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
21364         FREE(untag_ptr(_res));
21365         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
21366 }
21367
21368 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
21369         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21370         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
21371         return tag_ptr(ret_conv, true);
21372 }
21373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21374         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
21375         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
21376         return ret_conv;
21377 }
21378
21379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21380         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
21381         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
21382         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
21383         return tag_ptr(ret_conv, true);
21384 }
21385
21386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21387         LDKBlindedPayInfo o_conv;
21388         o_conv.inner = untag_ptr(o);
21389         o_conv.is_owned = ptr_is_owned(o);
21390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21391         o_conv = BlindedPayInfo_clone(&o_conv);
21392         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21393         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
21394         return tag_ptr(ret_conv, true);
21395 }
21396
21397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21398         void* e_ptr = untag_ptr(e);
21399         CHECK_ACCESS(e_ptr);
21400         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21401         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21402         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21403         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
21404         return tag_ptr(ret_conv, true);
21405 }
21406
21407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21408         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
21409         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
21410         return ret_conv;
21411 }
21412
21413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21414         if (!ptr_is_owned(_res)) return;
21415         void* _res_ptr = untag_ptr(_res);
21416         CHECK_ACCESS(_res_ptr);
21417         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
21418         FREE(untag_ptr(_res));
21419         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
21420 }
21421
21422 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
21423         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21424         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
21425         return tag_ptr(ret_conv, true);
21426 }
21427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21428         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
21429         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
21430         return ret_conv;
21431 }
21432
21433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21434         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
21435         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
21436         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
21437         return tag_ptr(ret_conv, true);
21438 }
21439
21440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21441         LDKDelayedPaymentOutputDescriptor o_conv;
21442         o_conv.inner = untag_ptr(o);
21443         o_conv.is_owned = ptr_is_owned(o);
21444         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21445         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
21446         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21447         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
21448         return tag_ptr(ret_conv, true);
21449 }
21450
21451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21452         void* e_ptr = untag_ptr(e);
21453         CHECK_ACCESS(e_ptr);
21454         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21455         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21456         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21457         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
21458         return tag_ptr(ret_conv, true);
21459 }
21460
21461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21462         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21463         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21464         return ret_conv;
21465 }
21466
21467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21468         if (!ptr_is_owned(_res)) return;
21469         void* _res_ptr = untag_ptr(_res);
21470         CHECK_ACCESS(_res_ptr);
21471         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
21472         FREE(untag_ptr(_res));
21473         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
21474 }
21475
21476 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21477         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21478         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
21479         return tag_ptr(ret_conv, true);
21480 }
21481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21482         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21483         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21484         return ret_conv;
21485 }
21486
21487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21488         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21489         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
21490         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
21491         return tag_ptr(ret_conv, true);
21492 }
21493
21494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21495         LDKStaticPaymentOutputDescriptor o_conv;
21496         o_conv.inner = untag_ptr(o);
21497         o_conv.is_owned = ptr_is_owned(o);
21498         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21499         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
21500         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21501         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
21502         return tag_ptr(ret_conv, true);
21503 }
21504
21505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21506         void* e_ptr = untag_ptr(e);
21507         CHECK_ACCESS(e_ptr);
21508         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21509         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21510         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21511         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
21512         return tag_ptr(ret_conv, true);
21513 }
21514
21515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21516         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21517         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21518         return ret_conv;
21519 }
21520
21521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21522         if (!ptr_is_owned(_res)) return;
21523         void* _res_ptr = untag_ptr(_res);
21524         CHECK_ACCESS(_res_ptr);
21525         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
21526         FREE(untag_ptr(_res));
21527         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
21528 }
21529
21530 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21531         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21532         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
21533         return tag_ptr(ret_conv, true);
21534 }
21535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21536         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21537         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21538         return ret_conv;
21539 }
21540
21541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21542         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21543         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
21544         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
21545         return tag_ptr(ret_conv, true);
21546 }
21547
21548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21549         void* o_ptr = untag_ptr(o);
21550         CHECK_ACCESS(o_ptr);
21551         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
21552         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
21553         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21554         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
21555         return tag_ptr(ret_conv, true);
21556 }
21557
21558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21559         void* e_ptr = untag_ptr(e);
21560         CHECK_ACCESS(e_ptr);
21561         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21562         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21563         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21564         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
21565         return tag_ptr(ret_conv, true);
21566 }
21567
21568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21569         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
21570         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
21571         return ret_conv;
21572 }
21573
21574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21575         if (!ptr_is_owned(_res)) return;
21576         void* _res_ptr = untag_ptr(_res);
21577         CHECK_ACCESS(_res_ptr);
21578         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
21579         FREE(untag_ptr(_res));
21580         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
21581 }
21582
21583 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21584         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21585         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
21586         return tag_ptr(ret_conv, true);
21587 }
21588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21589         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
21590         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21591         return ret_conv;
21592 }
21593
21594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21595         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
21596         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
21597         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
21598         return tag_ptr(ret_conv, true);
21599 }
21600
21601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21602         LDKCVec_SpendableOutputDescriptorZ _res_constr;
21603         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21604         if (_res_constr.datalen > 0)
21605                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21606         else
21607                 _res_constr.data = NULL;
21608         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21609         for (size_t b = 0; b < _res_constr.datalen; b++) {
21610                 int64_t _res_conv_27 = _res_vals[b];
21611                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
21612                 CHECK_ACCESS(_res_conv_27_ptr);
21613                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
21614                 FREE(untag_ptr(_res_conv_27));
21615                 _res_constr.data[b] = _res_conv_27_conv;
21616         }
21617         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21618         CVec_SpendableOutputDescriptorZ_free(_res_constr);
21619 }
21620
21621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21622         LDKCVec_TxOutZ _res_constr;
21623         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21624         if (_res_constr.datalen > 0)
21625                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
21626         else
21627                 _res_constr.data = NULL;
21628         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21629         for (size_t h = 0; h < _res_constr.datalen; h++) {
21630                 int64_t _res_conv_7 = _res_vals[h];
21631                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
21632                 CHECK_ACCESS(_res_conv_7_ptr);
21633                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
21634                 FREE(untag_ptr(_res_conv_7));
21635                 _res_constr.data[h] = _res_conv_7_conv;
21636         }
21637         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21638         CVec_TxOutZ_free(_res_constr);
21639 }
21640
21641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
21642         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21643         *ret_copy = COption_u32Z_some(o);
21644         int64_t ret_ref = tag_ptr(ret_copy, true);
21645         return ret_ref;
21646 }
21647
21648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
21649         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21650         *ret_copy = COption_u32Z_none();
21651         int64_t ret_ref = tag_ptr(ret_copy, true);
21652         return ret_ref;
21653 }
21654
21655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21656         if (!ptr_is_owned(_res)) return;
21657         void* _res_ptr = untag_ptr(_res);
21658         CHECK_ACCESS(_res_ptr);
21659         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
21660         FREE(untag_ptr(_res));
21661         COption_u32Z_free(_res_conv);
21662 }
21663
21664 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
21665         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21666         *ret_copy = COption_u32Z_clone(arg);
21667         int64_t ret_ref = tag_ptr(ret_copy, true);
21668         return ret_ref;
21669 }
21670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21671         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
21672         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
21673         return ret_conv;
21674 }
21675
21676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21677         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
21678         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21679         *ret_copy = COption_u32Z_clone(orig_conv);
21680         int64_t ret_ref = tag_ptr(ret_copy, true);
21681         return ret_ref;
21682 }
21683
21684 static inline uint64_t C2Tuple_CVec_u8ZusizeZ_clone_ptr(LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR arg) {
21685         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21686         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(arg);
21687         return tag_ptr(ret_conv, true);
21688 }
21689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21690         LDKC2Tuple_CVec_u8ZusizeZ* arg_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(arg);
21691         int64_t ret_conv = C2Tuple_CVec_u8ZusizeZ_clone_ptr(arg_conv);
21692         return ret_conv;
21693 }
21694
21695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21696         LDKC2Tuple_CVec_u8ZusizeZ* orig_conv = (LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(orig);
21697         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21698         *ret_conv = C2Tuple_CVec_u8ZusizeZ_clone(orig_conv);
21699         return tag_ptr(ret_conv, true);
21700 }
21701
21702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
21703         LDKCVec_u8Z a_ref;
21704         a_ref.datalen = (*env)->GetArrayLength(env, a);
21705         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
21706         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
21707         LDKC2Tuple_CVec_u8ZusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8ZusizeZ), "LDKC2Tuple_CVec_u8ZusizeZ");
21708         *ret_conv = C2Tuple_CVec_u8ZusizeZ_new(a_ref, b);
21709         return tag_ptr(ret_conv, true);
21710 }
21711
21712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8ZusizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21713         if (!ptr_is_owned(_res)) return;
21714         void* _res_ptr = untag_ptr(_res);
21715         CHECK_ACCESS(_res_ptr);
21716         LDKC2Tuple_CVec_u8ZusizeZ _res_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(_res_ptr);
21717         FREE(untag_ptr(_res));
21718         C2Tuple_CVec_u8ZusizeZ_free(_res_conv);
21719 }
21720
21721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21722         void* o_ptr = untag_ptr(o);
21723         CHECK_ACCESS(o_ptr);
21724         LDKC2Tuple_CVec_u8ZusizeZ o_conv = *(LDKC2Tuple_CVec_u8ZusizeZ*)(o_ptr);
21725         o_conv = C2Tuple_CVec_u8ZusizeZ_clone((LDKC2Tuple_CVec_u8ZusizeZ*)untag_ptr(o));
21726         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21727         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(o_conv);
21728         return tag_ptr(ret_conv, true);
21729 }
21730
21731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1err(JNIEnv *env, jclass clz) {
21732         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21733         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err();
21734         return tag_ptr(ret_conv, true);
21735 }
21736
21737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21738         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(o);
21739         jboolean ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(o_conv);
21740         return ret_conv;
21741 }
21742
21743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21744         if (!ptr_is_owned(_res)) return;
21745         void* _res_ptr = untag_ptr(_res);
21746         CHECK_ACCESS(_res_ptr);
21747         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)(_res_ptr);
21748         FREE(untag_ptr(_res));
21749         CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(_res_conv);
21750 }
21751
21752 static inline uint64_t CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR arg) {
21753         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21754         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(arg);
21755         return tag_ptr(ret_conv, true);
21756 }
21757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21758         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(arg);
21759         int64_t ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(arg_conv);
21760         return ret_conv;
21761 }
21762
21763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21764         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ*)untag_ptr(orig);
21765         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
21766         *ret_conv = CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(orig_conv);
21767         return tag_ptr(ret_conv, true);
21768 }
21769
21770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21771         LDKChannelDerivationParameters o_conv;
21772         o_conv.inner = untag_ptr(o);
21773         o_conv.is_owned = ptr_is_owned(o);
21774         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21775         o_conv = ChannelDerivationParameters_clone(&o_conv);
21776         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
21777         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
21778         return tag_ptr(ret_conv, true);
21779 }
21780
21781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21782         void* e_ptr = untag_ptr(e);
21783         CHECK_ACCESS(e_ptr);
21784         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21785         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21786         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
21787         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
21788         return tag_ptr(ret_conv, true);
21789 }
21790
21791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21792         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
21793         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
21794         return ret_conv;
21795 }
21796
21797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21798         if (!ptr_is_owned(_res)) return;
21799         void* _res_ptr = untag_ptr(_res);
21800         CHECK_ACCESS(_res_ptr);
21801         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
21802         FREE(untag_ptr(_res));
21803         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
21804 }
21805
21806 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
21807         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
21808         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
21809         return tag_ptr(ret_conv, true);
21810 }
21811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21812         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
21813         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
21814         return ret_conv;
21815 }
21816
21817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21818         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
21819         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
21820         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
21821         return tag_ptr(ret_conv, true);
21822 }
21823
21824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21825         LDKHTLCDescriptor o_conv;
21826         o_conv.inner = untag_ptr(o);
21827         o_conv.is_owned = ptr_is_owned(o);
21828         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21829         o_conv = HTLCDescriptor_clone(&o_conv);
21830         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
21831         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
21832         return tag_ptr(ret_conv, true);
21833 }
21834
21835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21836         void* e_ptr = untag_ptr(e);
21837         CHECK_ACCESS(e_ptr);
21838         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21839         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21840         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
21841         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
21842         return tag_ptr(ret_conv, true);
21843 }
21844
21845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21846         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
21847         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
21848         return ret_conv;
21849 }
21850
21851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21852         if (!ptr_is_owned(_res)) return;
21853         void* _res_ptr = untag_ptr(_res);
21854         CHECK_ACCESS(_res_ptr);
21855         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
21856         FREE(untag_ptr(_res));
21857         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
21858 }
21859
21860 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
21861         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
21862         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
21863         return tag_ptr(ret_conv, true);
21864 }
21865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21866         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
21867         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
21868         return ret_conv;
21869 }
21870
21871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21872         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
21873         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
21874         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
21875         return tag_ptr(ret_conv, true);
21876 }
21877
21878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
21879         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21880         *ret_conv = CResult_NoneNoneZ_ok();
21881         return tag_ptr(ret_conv, true);
21882 }
21883
21884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
21885         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21886         *ret_conv = CResult_NoneNoneZ_err();
21887         return tag_ptr(ret_conv, true);
21888 }
21889
21890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21891         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
21892         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
21893         return ret_conv;
21894 }
21895
21896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21897         if (!ptr_is_owned(_res)) return;
21898         void* _res_ptr = untag_ptr(_res);
21899         CHECK_ACCESS(_res_ptr);
21900         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
21901         FREE(untag_ptr(_res));
21902         CResult_NoneNoneZ_free(_res_conv);
21903 }
21904
21905 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
21906         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21907         *ret_conv = CResult_NoneNoneZ_clone(arg);
21908         return tag_ptr(ret_conv, true);
21909 }
21910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21911         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
21912         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
21913         return ret_conv;
21914 }
21915
21916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21917         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
21918         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21919         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
21920         return tag_ptr(ret_conv, true);
21921 }
21922
21923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21924         LDKCVec_ECDSASignatureZ _res_constr;
21925         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21926         if (_res_constr.datalen > 0)
21927                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
21928         else
21929                 _res_constr.data = NULL;
21930         for (size_t i = 0; i < _res_constr.datalen; i++) {
21931                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21932                 LDKECDSASignature _res_conv_8_ref;
21933                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
21934                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
21935                 _res_constr.data[i] = _res_conv_8_ref;
21936         }
21937         CVec_ECDSASignatureZ_free(_res_constr);
21938 }
21939
21940 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
21941         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21942         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
21943         return tag_ptr(ret_conv, true);
21944 }
21945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21946         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
21947         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
21948         return ret_conv;
21949 }
21950
21951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21952         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
21953         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21954         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
21955         return tag_ptr(ret_conv, true);
21956 }
21957
21958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
21959         LDKECDSASignature a_ref;
21960         CHECK((*env)->GetArrayLength(env, a) == 64);
21961         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
21962         LDKCVec_ECDSASignatureZ b_constr;
21963         b_constr.datalen = (*env)->GetArrayLength(env, b);
21964         if (b_constr.datalen > 0)
21965                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
21966         else
21967                 b_constr.data = NULL;
21968         for (size_t i = 0; i < b_constr.datalen; i++) {
21969                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
21970                 LDKECDSASignature b_conv_8_ref;
21971                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
21972                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
21973                 b_constr.data[i] = b_conv_8_ref;
21974         }
21975         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
21976         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
21977         return tag_ptr(ret_conv, true);
21978 }
21979
21980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21981         if (!ptr_is_owned(_res)) return;
21982         void* _res_ptr = untag_ptr(_res);
21983         CHECK_ACCESS(_res_ptr);
21984         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
21985         FREE(untag_ptr(_res));
21986         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
21987 }
21988
21989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21990         void* o_ptr = untag_ptr(o);
21991         CHECK_ACCESS(o_ptr);
21992         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
21993         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
21994         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
21995         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
21996         return tag_ptr(ret_conv, true);
21997 }
21998
21999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
22000         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
22001         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
22002         return tag_ptr(ret_conv, true);
22003 }
22004
22005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22006         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
22007         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
22008         return ret_conv;
22009 }
22010
22011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22012         if (!ptr_is_owned(_res)) return;
22013         void* _res_ptr = untag_ptr(_res);
22014         CHECK_ACCESS(_res_ptr);
22015         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
22016         FREE(untag_ptr(_res));
22017         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
22018 }
22019
22020 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
22021         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
22022         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
22023         return tag_ptr(ret_conv, true);
22024 }
22025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22026         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
22027         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
22028         return ret_conv;
22029 }
22030
22031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22032         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
22033         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
22034         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
22035         return tag_ptr(ret_conv, true);
22036 }
22037
22038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22039         LDKECDSASignature o_ref;
22040         CHECK((*env)->GetArrayLength(env, o) == 64);
22041         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
22042         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
22043         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
22044         return tag_ptr(ret_conv, true);
22045 }
22046
22047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
22048         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
22049         *ret_conv = CResult_ECDSASignatureNoneZ_err();
22050         return tag_ptr(ret_conv, true);
22051 }
22052
22053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22054         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
22055         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
22056         return ret_conv;
22057 }
22058
22059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22060         if (!ptr_is_owned(_res)) return;
22061         void* _res_ptr = untag_ptr(_res);
22062         CHECK_ACCESS(_res_ptr);
22063         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
22064         FREE(untag_ptr(_res));
22065         CResult_ECDSASignatureNoneZ_free(_res_conv);
22066 }
22067
22068 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
22069         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
22070         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
22071         return tag_ptr(ret_conv, true);
22072 }
22073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22074         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
22075         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
22076         return ret_conv;
22077 }
22078
22079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22080         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
22081         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
22082         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
22083         return tag_ptr(ret_conv, true);
22084 }
22085
22086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22087         LDKPublicKey o_ref;
22088         CHECK((*env)->GetArrayLength(env, o) == 33);
22089         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
22090         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
22091         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
22092         return tag_ptr(ret_conv, true);
22093 }
22094
22095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
22096         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
22097         *ret_conv = CResult_PublicKeyNoneZ_err();
22098         return tag_ptr(ret_conv, true);
22099 }
22100
22101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22102         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
22103         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
22104         return ret_conv;
22105 }
22106
22107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22108         if (!ptr_is_owned(_res)) return;
22109         void* _res_ptr = untag_ptr(_res);
22110         CHECK_ACCESS(_res_ptr);
22111         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
22112         FREE(untag_ptr(_res));
22113         CResult_PublicKeyNoneZ_free(_res_conv);
22114 }
22115
22116 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
22117         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
22118         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
22119         return tag_ptr(ret_conv, true);
22120 }
22121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22122         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
22123         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
22124         return ret_conv;
22125 }
22126
22127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22128         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
22129         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
22130         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
22131         return tag_ptr(ret_conv, true);
22132 }
22133
22134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22135         void* o_ptr = untag_ptr(o);
22136         CHECK_ACCESS(o_ptr);
22137         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
22138         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
22139         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
22140         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
22141         int64_t ret_ref = tag_ptr(ret_copy, true);
22142         return ret_ref;
22143 }
22144
22145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
22146         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
22147         *ret_copy = COption_BigEndianScalarZ_none();
22148         int64_t ret_ref = tag_ptr(ret_copy, true);
22149         return ret_ref;
22150 }
22151
22152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22153         if (!ptr_is_owned(_res)) return;
22154         void* _res_ptr = untag_ptr(_res);
22155         CHECK_ACCESS(_res_ptr);
22156         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
22157         FREE(untag_ptr(_res));
22158         COption_BigEndianScalarZ_free(_res_conv);
22159 }
22160
22161 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
22162         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
22163         *ret_copy = COption_BigEndianScalarZ_clone(arg);
22164         int64_t ret_ref = tag_ptr(ret_copy, true);
22165         return ret_ref;
22166 }
22167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22168         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
22169         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
22170         return ret_conv;
22171 }
22172
22173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22174         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
22175         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
22176         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
22177         int64_t ret_ref = tag_ptr(ret_copy, true);
22178         return ret_ref;
22179 }
22180
22181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22182         LDKCVec_U5Z _res_constr;
22183         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22184         if (_res_constr.datalen > 0)
22185                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
22186         else
22187                 _res_constr.data = NULL;
22188         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
22189         for (size_t h = 0; h < _res_constr.datalen; h++) {
22190                 int8_t _res_conv_7 = _res_vals[h];
22191                 
22192                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
22193         }
22194         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
22195         CVec_U5Z_free(_res_constr);
22196 }
22197
22198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22199         LDKRecoverableSignature o_ref;
22200         CHECK((*env)->GetArrayLength(env, o) == 68);
22201         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
22202         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
22203         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
22204         return tag_ptr(ret_conv, true);
22205 }
22206
22207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
22208         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
22209         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
22210         return tag_ptr(ret_conv, true);
22211 }
22212
22213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22214         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
22215         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
22216         return ret_conv;
22217 }
22218
22219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22220         if (!ptr_is_owned(_res)) return;
22221         void* _res_ptr = untag_ptr(_res);
22222         CHECK_ACCESS(_res_ptr);
22223         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
22224         FREE(untag_ptr(_res));
22225         CResult_RecoverableSignatureNoneZ_free(_res_conv);
22226 }
22227
22228 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
22229         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
22230         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
22231         return tag_ptr(ret_conv, true);
22232 }
22233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22234         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
22235         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
22236         return ret_conv;
22237 }
22238
22239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22240         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
22241         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
22242         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
22243         return tag_ptr(ret_conv, true);
22244 }
22245
22246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22247         LDKSchnorrSignature o_ref;
22248         CHECK((*env)->GetArrayLength(env, o) == 64);
22249         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
22250         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22251         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
22252         return tag_ptr(ret_conv, true);
22253 }
22254
22255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
22256         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22257         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
22258         return tag_ptr(ret_conv, true);
22259 }
22260
22261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22262         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
22263         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
22264         return ret_conv;
22265 }
22266
22267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22268         if (!ptr_is_owned(_res)) return;
22269         void* _res_ptr = untag_ptr(_res);
22270         CHECK_ACCESS(_res_ptr);
22271         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
22272         FREE(untag_ptr(_res));
22273         CResult_SchnorrSignatureNoneZ_free(_res_conv);
22274 }
22275
22276 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
22277         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22278         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
22279         return tag_ptr(ret_conv, true);
22280 }
22281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22282         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
22283         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
22284         return ret_conv;
22285 }
22286
22287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22288         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
22289         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22290         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
22291         return tag_ptr(ret_conv, true);
22292 }
22293
22294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22295         void* o_ptr = untag_ptr(o);
22296         CHECK_ACCESS(o_ptr);
22297         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
22298         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
22299                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22300                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
22301         }
22302         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
22303         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
22304         return tag_ptr(ret_conv, true);
22305 }
22306
22307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22308         void* e_ptr = untag_ptr(e);
22309         CHECK_ACCESS(e_ptr);
22310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22312         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
22313         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
22314         return tag_ptr(ret_conv, true);
22315 }
22316
22317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22318         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
22319         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
22320         return ret_conv;
22321 }
22322
22323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22324         if (!ptr_is_owned(_res)) return;
22325         void* _res_ptr = untag_ptr(_res);
22326         CHECK_ACCESS(_res_ptr);
22327         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
22328         FREE(untag_ptr(_res));
22329         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
22330 }
22331
22332 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
22333         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
22334         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
22335         return tag_ptr(ret_conv, true);
22336 }
22337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22338         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
22339         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
22340         return ret_conv;
22341 }
22342
22343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22344         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
22345         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
22346         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
22347         return tag_ptr(ret_conv, true);
22348 }
22349
22350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22351         LDKCVec_u8Z o_ref;
22352         o_ref.datalen = (*env)->GetArrayLength(env, o);
22353         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22354         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22355         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
22356         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
22357         return tag_ptr(ret_conv, true);
22358 }
22359
22360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
22361         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
22362         *ret_conv = CResult_CVec_u8ZNoneZ_err();
22363         return tag_ptr(ret_conv, true);
22364 }
22365
22366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22367         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
22368         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
22369         return ret_conv;
22370 }
22371
22372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22373         if (!ptr_is_owned(_res)) return;
22374         void* _res_ptr = untag_ptr(_res);
22375         CHECK_ACCESS(_res_ptr);
22376         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
22377         FREE(untag_ptr(_res));
22378         CResult_CVec_u8ZNoneZ_free(_res_conv);
22379 }
22380
22381 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
22382         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
22383         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
22384         return tag_ptr(ret_conv, true);
22385 }
22386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22387         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
22388         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
22389         return ret_conv;
22390 }
22391
22392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22393         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
22394         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
22395         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
22396         return tag_ptr(ret_conv, true);
22397 }
22398
22399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22400         LDKShutdownScript o_conv;
22401         o_conv.inner = untag_ptr(o);
22402         o_conv.is_owned = ptr_is_owned(o);
22403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22404         o_conv = ShutdownScript_clone(&o_conv);
22405         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22406         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
22407         return tag_ptr(ret_conv, true);
22408 }
22409
22410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
22411         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22412         *ret_conv = CResult_ShutdownScriptNoneZ_err();
22413         return tag_ptr(ret_conv, true);
22414 }
22415
22416 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22417         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
22418         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
22419         return ret_conv;
22420 }
22421
22422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22423         if (!ptr_is_owned(_res)) return;
22424         void* _res_ptr = untag_ptr(_res);
22425         CHECK_ACCESS(_res_ptr);
22426         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
22427         FREE(untag_ptr(_res));
22428         CResult_ShutdownScriptNoneZ_free(_res_conv);
22429 }
22430
22431 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
22432         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22433         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
22434         return tag_ptr(ret_conv, true);
22435 }
22436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22437         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
22438         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
22439         return ret_conv;
22440 }
22441
22442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22443         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
22444         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
22445         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
22446         return tag_ptr(ret_conv, true);
22447 }
22448
22449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
22450         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22451         *ret_copy = COption_u16Z_some(o);
22452         int64_t ret_ref = tag_ptr(ret_copy, true);
22453         return ret_ref;
22454 }
22455
22456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
22457         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22458         *ret_copy = COption_u16Z_none();
22459         int64_t ret_ref = tag_ptr(ret_copy, true);
22460         return ret_ref;
22461 }
22462
22463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
22464         if (!ptr_is_owned(_res)) return;
22465         void* _res_ptr = untag_ptr(_res);
22466         CHECK_ACCESS(_res_ptr);
22467         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
22468         FREE(untag_ptr(_res));
22469         COption_u16Z_free(_res_conv);
22470 }
22471
22472 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
22473         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22474         *ret_copy = COption_u16Z_clone(arg);
22475         int64_t ret_ref = tag_ptr(ret_copy, true);
22476         return ret_ref;
22477 }
22478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22479         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
22480         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
22481         return ret_conv;
22482 }
22483
22484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22485         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
22486         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
22487         *ret_copy = COption_u16Z_clone(orig_conv);
22488         int64_t ret_ref = tag_ptr(ret_copy, true);
22489         return ret_ref;
22490 }
22491
22492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
22493         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22494         *ret_copy = COption_boolZ_some(o);
22495         int64_t ret_ref = tag_ptr(ret_copy, true);
22496         return ret_ref;
22497 }
22498
22499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
22500         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22501         *ret_copy = COption_boolZ_none();
22502         int64_t ret_ref = tag_ptr(ret_copy, true);
22503         return ret_ref;
22504 }
22505
22506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22507         if (!ptr_is_owned(_res)) return;
22508         void* _res_ptr = untag_ptr(_res);
22509         CHECK_ACCESS(_res_ptr);
22510         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
22511         FREE(untag_ptr(_res));
22512         COption_boolZ_free(_res_conv);
22513 }
22514
22515 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
22516         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22517         *ret_copy = COption_boolZ_clone(arg);
22518         int64_t ret_ref = tag_ptr(ret_copy, true);
22519         return ret_ref;
22520 }
22521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22522         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
22523         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
22524         return ret_conv;
22525 }
22526
22527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22528         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
22529         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
22530         *ret_copy = COption_boolZ_clone(orig_conv);
22531         int64_t ret_ref = tag_ptr(ret_copy, true);
22532         return ret_ref;
22533 }
22534
22535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22536         LDKCVec_CVec_u8ZZ _res_constr;
22537         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22538         if (_res_constr.datalen > 0)
22539                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
22540         else
22541                 _res_constr.data = NULL;
22542         for (size_t i = 0; i < _res_constr.datalen; i++) {
22543                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22544                 LDKCVec_u8Z _res_conv_8_ref;
22545                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
22546                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
22547                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
22548                 _res_constr.data[i] = _res_conv_8_ref;
22549         }
22550         CVec_CVec_u8ZZ_free(_res_constr);
22551 }
22552
22553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
22554         LDKCVec_CVec_u8ZZ o_constr;
22555         o_constr.datalen = (*env)->GetArrayLength(env, o);
22556         if (o_constr.datalen > 0)
22557                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
22558         else
22559                 o_constr.data = NULL;
22560         for (size_t i = 0; i < o_constr.datalen; i++) {
22561                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
22562                 LDKCVec_u8Z o_conv_8_ref;
22563                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
22564                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
22565                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
22566                 o_constr.data[i] = o_conv_8_ref;
22567         }
22568         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22569         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
22570         return tag_ptr(ret_conv, true);
22571 }
22572
22573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
22574         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22575         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
22576         return tag_ptr(ret_conv, true);
22577 }
22578
22579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22580         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
22581         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
22582         return ret_conv;
22583 }
22584
22585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22586         if (!ptr_is_owned(_res)) return;
22587         void* _res_ptr = untag_ptr(_res);
22588         CHECK_ACCESS(_res_ptr);
22589         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
22590         FREE(untag_ptr(_res));
22591         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
22592 }
22593
22594 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
22595         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22596         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
22597         return tag_ptr(ret_conv, true);
22598 }
22599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22600         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
22601         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
22602         return ret_conv;
22603 }
22604
22605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22606         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
22607         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
22608         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
22609         return tag_ptr(ret_conv, true);
22610 }
22611
22612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22613         LDKInMemorySigner o_conv;
22614         o_conv.inner = untag_ptr(o);
22615         o_conv.is_owned = ptr_is_owned(o);
22616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22617         o_conv = InMemorySigner_clone(&o_conv);
22618         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22619         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
22620         return tag_ptr(ret_conv, true);
22621 }
22622
22623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22624         void* e_ptr = untag_ptr(e);
22625         CHECK_ACCESS(e_ptr);
22626         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22627         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22628         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22629         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
22630         return tag_ptr(ret_conv, true);
22631 }
22632
22633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22634         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
22635         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
22636         return ret_conv;
22637 }
22638
22639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22640         if (!ptr_is_owned(_res)) return;
22641         void* _res_ptr = untag_ptr(_res);
22642         CHECK_ACCESS(_res_ptr);
22643         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
22644         FREE(untag_ptr(_res));
22645         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
22646 }
22647
22648 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
22649         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22650         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
22651         return tag_ptr(ret_conv, true);
22652 }
22653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22654         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
22655         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
22656         return ret_conv;
22657 }
22658
22659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22660         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
22661         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
22662         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
22663         return tag_ptr(ret_conv, true);
22664 }
22665
22666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22667         LDKTransaction o_ref;
22668         o_ref.datalen = (*env)->GetArrayLength(env, o);
22669         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
22670         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22671         o_ref.data_is_owned = true;
22672         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22673         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
22674         return tag_ptr(ret_conv, true);
22675 }
22676
22677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
22678         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22679         *ret_conv = CResult_TransactionNoneZ_err();
22680         return tag_ptr(ret_conv, true);
22681 }
22682
22683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22684         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
22685         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
22686         return ret_conv;
22687 }
22688
22689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22690         if (!ptr_is_owned(_res)) return;
22691         void* _res_ptr = untag_ptr(_res);
22692         CHECK_ACCESS(_res_ptr);
22693         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
22694         FREE(untag_ptr(_res));
22695         CResult_TransactionNoneZ_free(_res_conv);
22696 }
22697
22698 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
22699         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22700         *ret_conv = CResult_TransactionNoneZ_clone(arg);
22701         return tag_ptr(ret_conv, true);
22702 }
22703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22704         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
22705         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
22706         return ret_conv;
22707 }
22708
22709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22710         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
22711         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
22712         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
22713         return tag_ptr(ret_conv, true);
22714 }
22715
22716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22717         void* o_ptr = untag_ptr(o);
22718         CHECK_ACCESS(o_ptr);
22719         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
22720         if (o_conv.free == LDKWriteableScore_JCalls_free) {
22721                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22722                 LDKWriteableScore_JCalls_cloned(&o_conv);
22723         }
22724         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
22725         *ret_copy = COption_WriteableScoreZ_some(o_conv);
22726         int64_t ret_ref = tag_ptr(ret_copy, true);
22727         return ret_ref;
22728 }
22729
22730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
22731         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
22732         *ret_copy = COption_WriteableScoreZ_none();
22733         int64_t ret_ref = tag_ptr(ret_copy, true);
22734         return ret_ref;
22735 }
22736
22737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22738         if (!ptr_is_owned(_res)) return;
22739         void* _res_ptr = untag_ptr(_res);
22740         CHECK_ACCESS(_res_ptr);
22741         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
22742         FREE(untag_ptr(_res));
22743         COption_WriteableScoreZ_free(_res_conv);
22744 }
22745
22746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
22747         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22748         *ret_conv = CResult_NoneIOErrorZ_ok();
22749         return tag_ptr(ret_conv, true);
22750 }
22751
22752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
22753         LDKIOError e_conv = LDKIOError_from_java(env, e);
22754         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22755         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
22756         return tag_ptr(ret_conv, true);
22757 }
22758
22759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22760         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
22761         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
22762         return ret_conv;
22763 }
22764
22765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22766         if (!ptr_is_owned(_res)) return;
22767         void* _res_ptr = untag_ptr(_res);
22768         CHECK_ACCESS(_res_ptr);
22769         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
22770         FREE(untag_ptr(_res));
22771         CResult_NoneIOErrorZ_free(_res_conv);
22772 }
22773
22774 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
22775         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22776         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
22777         return tag_ptr(ret_conv, true);
22778 }
22779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22780         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
22781         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
22782         return ret_conv;
22783 }
22784
22785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22786         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
22787         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
22788         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
22789         return tag_ptr(ret_conv, true);
22790 }
22791
22792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22793         LDKCVec_ChannelDetailsZ _res_constr;
22794         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22795         if (_res_constr.datalen > 0)
22796                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
22797         else
22798                 _res_constr.data = NULL;
22799         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22800         for (size_t q = 0; q < _res_constr.datalen; q++) {
22801                 int64_t _res_conv_16 = _res_vals[q];
22802                 LDKChannelDetails _res_conv_16_conv;
22803                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
22804                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
22805                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22806                 _res_constr.data[q] = _res_conv_16_conv;
22807         }
22808         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22809         CVec_ChannelDetailsZ_free(_res_constr);
22810 }
22811
22812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22813         LDKRoute o_conv;
22814         o_conv.inner = untag_ptr(o);
22815         o_conv.is_owned = ptr_is_owned(o);
22816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22817         o_conv = Route_clone(&o_conv);
22818         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22819         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
22820         return tag_ptr(ret_conv, true);
22821 }
22822
22823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22824         LDKLightningError e_conv;
22825         e_conv.inner = untag_ptr(e);
22826         e_conv.is_owned = ptr_is_owned(e);
22827         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22828         e_conv = LightningError_clone(&e_conv);
22829         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22830         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
22831         return tag_ptr(ret_conv, true);
22832 }
22833
22834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22835         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
22836         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
22837         return ret_conv;
22838 }
22839
22840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22841         if (!ptr_is_owned(_res)) return;
22842         void* _res_ptr = untag_ptr(_res);
22843         CHECK_ACCESS(_res_ptr);
22844         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
22845         FREE(untag_ptr(_res));
22846         CResult_RouteLightningErrorZ_free(_res_conv);
22847 }
22848
22849 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
22850         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22851         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
22852         return tag_ptr(ret_conv, true);
22853 }
22854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22855         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
22856         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
22857         return ret_conv;
22858 }
22859
22860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22861         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
22862         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
22863         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
22864         return tag_ptr(ret_conv, true);
22865 }
22866
22867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22868         LDKInFlightHtlcs o_conv;
22869         o_conv.inner = untag_ptr(o);
22870         o_conv.is_owned = ptr_is_owned(o);
22871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22872         o_conv = InFlightHtlcs_clone(&o_conv);
22873         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22874         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
22875         return tag_ptr(ret_conv, true);
22876 }
22877
22878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22879         void* e_ptr = untag_ptr(e);
22880         CHECK_ACCESS(e_ptr);
22881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22883         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22884         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
22885         return tag_ptr(ret_conv, true);
22886 }
22887
22888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22889         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
22890         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
22891         return ret_conv;
22892 }
22893
22894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22895         if (!ptr_is_owned(_res)) return;
22896         void* _res_ptr = untag_ptr(_res);
22897         CHECK_ACCESS(_res_ptr);
22898         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
22899         FREE(untag_ptr(_res));
22900         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
22901 }
22902
22903 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
22904         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22905         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
22906         return tag_ptr(ret_conv, true);
22907 }
22908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22909         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
22910         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
22911         return ret_conv;
22912 }
22913
22914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22915         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
22916         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
22917         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
22918         return tag_ptr(ret_conv, true);
22919 }
22920
22921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22922         LDKRouteHop o_conv;
22923         o_conv.inner = untag_ptr(o);
22924         o_conv.is_owned = ptr_is_owned(o);
22925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22926         o_conv = RouteHop_clone(&o_conv);
22927         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22928         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
22929         return tag_ptr(ret_conv, true);
22930 }
22931
22932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22933         void* e_ptr = untag_ptr(e);
22934         CHECK_ACCESS(e_ptr);
22935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22937         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22938         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
22939         return tag_ptr(ret_conv, true);
22940 }
22941
22942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22943         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
22944         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
22945         return ret_conv;
22946 }
22947
22948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22949         if (!ptr_is_owned(_res)) return;
22950         void* _res_ptr = untag_ptr(_res);
22951         CHECK_ACCESS(_res_ptr);
22952         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
22953         FREE(untag_ptr(_res));
22954         CResult_RouteHopDecodeErrorZ_free(_res_conv);
22955 }
22956
22957 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
22958         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22959         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
22960         return tag_ptr(ret_conv, true);
22961 }
22962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22963         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
22964         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
22965         return ret_conv;
22966 }
22967
22968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22969         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
22970         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22971         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
22972         return tag_ptr(ret_conv, true);
22973 }
22974
22975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22976         LDKCVec_BlindedHopZ _res_constr;
22977         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22978         if (_res_constr.datalen > 0)
22979                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
22980         else
22981                 _res_constr.data = NULL;
22982         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22983         for (size_t m = 0; m < _res_constr.datalen; m++) {
22984                 int64_t _res_conv_12 = _res_vals[m];
22985                 LDKBlindedHop _res_conv_12_conv;
22986                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
22987                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
22988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
22989                 _res_constr.data[m] = _res_conv_12_conv;
22990         }
22991         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22992         CVec_BlindedHopZ_free(_res_constr);
22993 }
22994
22995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22996         LDKBlindedTail o_conv;
22997         o_conv.inner = untag_ptr(o);
22998         o_conv.is_owned = ptr_is_owned(o);
22999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23000         o_conv = BlindedTail_clone(&o_conv);
23001         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
23002         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
23003         return tag_ptr(ret_conv, true);
23004 }
23005
23006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23007         void* e_ptr = untag_ptr(e);
23008         CHECK_ACCESS(e_ptr);
23009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23011         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
23012         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
23013         return tag_ptr(ret_conv, true);
23014 }
23015
23016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23017         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
23018         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
23019         return ret_conv;
23020 }
23021
23022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23023         if (!ptr_is_owned(_res)) return;
23024         void* _res_ptr = untag_ptr(_res);
23025         CHECK_ACCESS(_res_ptr);
23026         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
23027         FREE(untag_ptr(_res));
23028         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
23029 }
23030
23031 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
23032         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
23033         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
23034         return tag_ptr(ret_conv, true);
23035 }
23036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23037         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
23038         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
23039         return ret_conv;
23040 }
23041
23042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23043         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
23044         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
23045         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
23046         return tag_ptr(ret_conv, true);
23047 }
23048
23049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23050         LDKCVec_RouteHopZ _res_constr;
23051         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23052         if (_res_constr.datalen > 0)
23053                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23054         else
23055                 _res_constr.data = NULL;
23056         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23057         for (size_t k = 0; k < _res_constr.datalen; k++) {
23058                 int64_t _res_conv_10 = _res_vals[k];
23059                 LDKRouteHop _res_conv_10_conv;
23060                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
23061                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
23062                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
23063                 _res_constr.data[k] = _res_conv_10_conv;
23064         }
23065         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23066         CVec_RouteHopZ_free(_res_constr);
23067 }
23068
23069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23070         LDKCVec_PathZ _res_constr;
23071         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23072         if (_res_constr.datalen > 0)
23073                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
23074         else
23075                 _res_constr.data = NULL;
23076         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23077         for (size_t g = 0; g < _res_constr.datalen; g++) {
23078                 int64_t _res_conv_6 = _res_vals[g];
23079                 LDKPath _res_conv_6_conv;
23080                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
23081                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
23082                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
23083                 _res_constr.data[g] = _res_conv_6_conv;
23084         }
23085         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23086         CVec_PathZ_free(_res_constr);
23087 }
23088
23089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23090         LDKRoute o_conv;
23091         o_conv.inner = untag_ptr(o);
23092         o_conv.is_owned = ptr_is_owned(o);
23093         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23094         o_conv = Route_clone(&o_conv);
23095         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23096         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
23097         return tag_ptr(ret_conv, true);
23098 }
23099
23100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23101         void* e_ptr = untag_ptr(e);
23102         CHECK_ACCESS(e_ptr);
23103         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23104         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23105         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23106         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
23107         return tag_ptr(ret_conv, true);
23108 }
23109
23110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23111         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
23112         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
23113         return ret_conv;
23114 }
23115
23116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23117         if (!ptr_is_owned(_res)) return;
23118         void* _res_ptr = untag_ptr(_res);
23119         CHECK_ACCESS(_res_ptr);
23120         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
23121         FREE(untag_ptr(_res));
23122         CResult_RouteDecodeErrorZ_free(_res_conv);
23123 }
23124
23125 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
23126         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23127         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
23128         return tag_ptr(ret_conv, true);
23129 }
23130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23131         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
23132         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
23133         return ret_conv;
23134 }
23135
23136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23137         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
23138         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23139         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
23140         return tag_ptr(ret_conv, true);
23141 }
23142
23143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23144         LDKRouteParameters o_conv;
23145         o_conv.inner = untag_ptr(o);
23146         o_conv.is_owned = ptr_is_owned(o);
23147         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23148         o_conv = RouteParameters_clone(&o_conv);
23149         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
23150         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
23151         return tag_ptr(ret_conv, true);
23152 }
23153
23154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23155         void* e_ptr = untag_ptr(e);
23156         CHECK_ACCESS(e_ptr);
23157         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23158         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23159         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
23160         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
23161         return tag_ptr(ret_conv, true);
23162 }
23163
23164 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23165         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
23166         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
23167         return ret_conv;
23168 }
23169
23170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23171         if (!ptr_is_owned(_res)) return;
23172         void* _res_ptr = untag_ptr(_res);
23173         CHECK_ACCESS(_res_ptr);
23174         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
23175         FREE(untag_ptr(_res));
23176         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
23177 }
23178
23179 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
23180         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
23181         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
23182         return tag_ptr(ret_conv, true);
23183 }
23184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23185         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
23186         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
23187         return ret_conv;
23188 }
23189
23190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23191         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
23192         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
23193         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
23194         return tag_ptr(ret_conv, true);
23195 }
23196
23197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23198         LDKCVec_u64Z _res_constr;
23199         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23200         if (_res_constr.datalen > 0)
23201                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
23202         else
23203                 _res_constr.data = NULL;
23204         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23205         for (size_t g = 0; g < _res_constr.datalen; g++) {
23206                 int64_t _res_conv_6 = _res_vals[g];
23207                 _res_constr.data[g] = _res_conv_6;
23208         }
23209         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23210         CVec_u64Z_free(_res_constr);
23211 }
23212
23213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23214         LDKPaymentParameters o_conv;
23215         o_conv.inner = untag_ptr(o);
23216         o_conv.is_owned = ptr_is_owned(o);
23217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23218         o_conv = PaymentParameters_clone(&o_conv);
23219         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
23220         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
23221         return tag_ptr(ret_conv, true);
23222 }
23223
23224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23225         void* e_ptr = untag_ptr(e);
23226         CHECK_ACCESS(e_ptr);
23227         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23228         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23229         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
23230         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
23231         return tag_ptr(ret_conv, true);
23232 }
23233
23234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23235         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
23236         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
23237         return ret_conv;
23238 }
23239
23240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23241         if (!ptr_is_owned(_res)) return;
23242         void* _res_ptr = untag_ptr(_res);
23243         CHECK_ACCESS(_res_ptr);
23244         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
23245         FREE(untag_ptr(_res));
23246         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
23247 }
23248
23249 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
23250         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
23251         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
23252         return tag_ptr(ret_conv, true);
23253 }
23254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23255         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
23256         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
23257         return ret_conv;
23258 }
23259
23260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23261         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
23262         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
23263         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
23264         return tag_ptr(ret_conv, true);
23265 }
23266
23267 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
23268         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
23269         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
23270         return tag_ptr(ret_conv, true);
23271 }
23272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23273         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
23274         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
23275         return ret_conv;
23276 }
23277
23278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23279         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
23280         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
23281         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
23282         return tag_ptr(ret_conv, true);
23283 }
23284
23285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23286         LDKBlindedPayInfo a_conv;
23287         a_conv.inner = untag_ptr(a);
23288         a_conv.is_owned = ptr_is_owned(a);
23289         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23290         a_conv = BlindedPayInfo_clone(&a_conv);
23291         LDKBlindedPath b_conv;
23292         b_conv.inner = untag_ptr(b);
23293         b_conv.is_owned = ptr_is_owned(b);
23294         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23295         b_conv = BlindedPath_clone(&b_conv);
23296         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
23297         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
23298         return tag_ptr(ret_conv, true);
23299 }
23300
23301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23302         if (!ptr_is_owned(_res)) return;
23303         void* _res_ptr = untag_ptr(_res);
23304         CHECK_ACCESS(_res_ptr);
23305         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
23306         FREE(untag_ptr(_res));
23307         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
23308 }
23309
23310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23311         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
23312         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23313         if (_res_constr.datalen > 0)
23314                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
23315         else
23316                 _res_constr.data = NULL;
23317         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23318         for (size_t l = 0; l < _res_constr.datalen; l++) {
23319                 int64_t _res_conv_37 = _res_vals[l];
23320                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
23321                 CHECK_ACCESS(_res_conv_37_ptr);
23322                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
23323                 FREE(untag_ptr(_res_conv_37));
23324                 _res_constr.data[l] = _res_conv_37_conv;
23325         }
23326         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23327         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
23328 }
23329
23330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23331         LDKCVec_RouteHintZ _res_constr;
23332         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23333         if (_res_constr.datalen > 0)
23334                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23335         else
23336                 _res_constr.data = NULL;
23337         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23338         for (size_t l = 0; l < _res_constr.datalen; l++) {
23339                 int64_t _res_conv_11 = _res_vals[l];
23340                 LDKRouteHint _res_conv_11_conv;
23341                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
23342                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
23343                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
23344                 _res_constr.data[l] = _res_conv_11_conv;
23345         }
23346         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23347         CVec_RouteHintZ_free(_res_constr);
23348 }
23349
23350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23351         LDKCVec_RouteHintHopZ _res_constr;
23352         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23353         if (_res_constr.datalen > 0)
23354                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
23355         else
23356                 _res_constr.data = NULL;
23357         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23358         for (size_t o = 0; o < _res_constr.datalen; o++) {
23359                 int64_t _res_conv_14 = _res_vals[o];
23360                 LDKRouteHintHop _res_conv_14_conv;
23361                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
23362                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
23363                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
23364                 _res_constr.data[o] = _res_conv_14_conv;
23365         }
23366         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23367         CVec_RouteHintHopZ_free(_res_constr);
23368 }
23369
23370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23371         LDKRouteHint o_conv;
23372         o_conv.inner = untag_ptr(o);
23373         o_conv.is_owned = ptr_is_owned(o);
23374         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23375         o_conv = RouteHint_clone(&o_conv);
23376         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23377         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
23378         return tag_ptr(ret_conv, true);
23379 }
23380
23381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23382         void* e_ptr = untag_ptr(e);
23383         CHECK_ACCESS(e_ptr);
23384         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23385         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23386         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23387         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
23388         return tag_ptr(ret_conv, true);
23389 }
23390
23391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23392         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
23393         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
23394         return ret_conv;
23395 }
23396
23397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23398         if (!ptr_is_owned(_res)) return;
23399         void* _res_ptr = untag_ptr(_res);
23400         CHECK_ACCESS(_res_ptr);
23401         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
23402         FREE(untag_ptr(_res));
23403         CResult_RouteHintDecodeErrorZ_free(_res_conv);
23404 }
23405
23406 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
23407         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23408         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
23409         return tag_ptr(ret_conv, true);
23410 }
23411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23412         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
23413         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
23414         return ret_conv;
23415 }
23416
23417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23418         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
23419         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
23420         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
23421         return tag_ptr(ret_conv, true);
23422 }
23423
23424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23425         LDKRouteHintHop o_conv;
23426         o_conv.inner = untag_ptr(o);
23427         o_conv.is_owned = ptr_is_owned(o);
23428         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23429         o_conv = RouteHintHop_clone(&o_conv);
23430         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23431         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
23432         return tag_ptr(ret_conv, true);
23433 }
23434
23435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23436         void* e_ptr = untag_ptr(e);
23437         CHECK_ACCESS(e_ptr);
23438         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23439         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23440         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23441         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
23442         return tag_ptr(ret_conv, true);
23443 }
23444
23445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23446         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
23447         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
23448         return ret_conv;
23449 }
23450
23451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23452         if (!ptr_is_owned(_res)) return;
23453         void* _res_ptr = untag_ptr(_res);
23454         CHECK_ACCESS(_res_ptr);
23455         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
23456         FREE(untag_ptr(_res));
23457         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
23458 }
23459
23460 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
23461         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23462         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
23463         return tag_ptr(ret_conv, true);
23464 }
23465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23466         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
23467         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
23468         return ret_conv;
23469 }
23470
23471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23472         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
23473         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
23474         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
23475         return tag_ptr(ret_conv, true);
23476 }
23477
23478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
23479         LDKCVec_PublicKeyZ _res_constr;
23480         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23481         if (_res_constr.datalen > 0)
23482                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
23483         else
23484                 _res_constr.data = NULL;
23485         for (size_t i = 0; i < _res_constr.datalen; i++) {
23486                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
23487                 LDKPublicKey _res_conv_8_ref;
23488                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
23489                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
23490                 _res_constr.data[i] = _res_conv_8_ref;
23491         }
23492         CVec_PublicKeyZ_free(_res_constr);
23493 }
23494
23495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23496         LDKFixedPenaltyScorer o_conv;
23497         o_conv.inner = untag_ptr(o);
23498         o_conv.is_owned = ptr_is_owned(o);
23499         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23500         o_conv = FixedPenaltyScorer_clone(&o_conv);
23501         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23502         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
23503         return tag_ptr(ret_conv, true);
23504 }
23505
23506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23507         void* e_ptr = untag_ptr(e);
23508         CHECK_ACCESS(e_ptr);
23509         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23510         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23511         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23512         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
23513         return tag_ptr(ret_conv, true);
23514 }
23515
23516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23517         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
23518         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
23519         return ret_conv;
23520 }
23521
23522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23523         if (!ptr_is_owned(_res)) return;
23524         void* _res_ptr = untag_ptr(_res);
23525         CHECK_ACCESS(_res_ptr);
23526         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
23527         FREE(untag_ptr(_res));
23528         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
23529 }
23530
23531 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
23532         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23533         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
23534         return tag_ptr(ret_conv, true);
23535 }
23536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23537         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
23538         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
23539         return ret_conv;
23540 }
23541
23542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23543         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
23544         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
23545         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
23546         return tag_ptr(ret_conv, true);
23547 }
23548
23549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23550         LDKCVec_NodeIdZ _res_constr;
23551         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23552         if (_res_constr.datalen > 0)
23553                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
23554         else
23555                 _res_constr.data = NULL;
23556         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23557         for (size_t i = 0; i < _res_constr.datalen; i++) {
23558                 int64_t _res_conv_8 = _res_vals[i];
23559                 LDKNodeId _res_conv_8_conv;
23560                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
23561                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
23562                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
23563                 _res_constr.data[i] = _res_conv_8_conv;
23564         }
23565         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23566         CVec_NodeIdZ_free(_res_constr);
23567 }
23568
23569 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
23570         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23571         *ret_conv = C2Tuple_u64u64Z_clone(arg);
23572         return tag_ptr(ret_conv, true);
23573 }
23574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23575         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
23576         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
23577         return ret_conv;
23578 }
23579
23580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23581         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
23582         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23583         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
23584         return tag_ptr(ret_conv, true);
23585 }
23586
23587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23588         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
23589         *ret_conv = C2Tuple_u64u64Z_new(a, b);
23590         return tag_ptr(ret_conv, true);
23591 }
23592
23593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23594         if (!ptr_is_owned(_res)) return;
23595         void* _res_ptr = untag_ptr(_res);
23596         CHECK_ACCESS(_res_ptr);
23597         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
23598         FREE(untag_ptr(_res));
23599         C2Tuple_u64u64Z_free(_res_conv);
23600 }
23601
23602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23603         void* o_ptr = untag_ptr(o);
23604         CHECK_ACCESS(o_ptr);
23605         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
23606         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
23607         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23608         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
23609         int64_t ret_ref = tag_ptr(ret_copy, true);
23610         return ret_ref;
23611 }
23612
23613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
23614         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23615         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
23616         int64_t ret_ref = tag_ptr(ret_copy, true);
23617         return ret_ref;
23618 }
23619
23620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23621         if (!ptr_is_owned(_res)) return;
23622         void* _res_ptr = untag_ptr(_res);
23623         CHECK_ACCESS(_res_ptr);
23624         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
23625         FREE(untag_ptr(_res));
23626         COption_C2Tuple_u64u64ZZ_free(_res_conv);
23627 }
23628
23629 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
23630         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23631         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
23632         int64_t ret_ref = tag_ptr(ret_copy, true);
23633         return ret_ref;
23634 }
23635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23636         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
23637         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
23638         return ret_conv;
23639 }
23640
23641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23642         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
23643         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
23644         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
23645         int64_t ret_ref = tag_ptr(ret_copy, true);
23646         return ret_ref;
23647 }
23648
23649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
23650         LDKThirtyTwoU16s a_ref;
23651         CHECK((*env)->GetArrayLength(env, a) == 32);
23652         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
23653         LDKThirtyTwoU16s b_ref;
23654         CHECK((*env)->GetArrayLength(env, b) == 32);
23655         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
23656         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
23657         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
23658         return tag_ptr(ret_conv, true);
23659 }
23660
23661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23662         if (!ptr_is_owned(_res)) return;
23663         void* _res_ptr = untag_ptr(_res);
23664         CHECK_ACCESS(_res_ptr);
23665         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
23666         FREE(untag_ptr(_res));
23667         C2Tuple_Z_free(_res_conv);
23668 }
23669
23670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
23671         LDKThirtyTwoU16s a_ref;
23672         CHECK((*env)->GetArrayLength(env, a) == 32);
23673         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
23674         LDKThirtyTwoU16s b_ref;
23675         CHECK((*env)->GetArrayLength(env, b) == 32);
23676         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
23677         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
23678         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
23679         return tag_ptr(ret_conv, true);
23680 }
23681
23682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23683         if (!ptr_is_owned(_res)) return;
23684         void* _res_ptr = untag_ptr(_res);
23685         CHECK_ACCESS(_res_ptr);
23686         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
23687         FREE(untag_ptr(_res));
23688         C2Tuple__u1632_u1632Z_free(_res_conv);
23689 }
23690
23691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23692         void* o_ptr = untag_ptr(o);
23693         CHECK_ACCESS(o_ptr);
23694         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
23695         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
23696         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
23697         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
23698         int64_t ret_ref = tag_ptr(ret_copy, true);
23699         return ret_ref;
23700 }
23701
23702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
23703         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
23704         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
23705         int64_t ret_ref = tag_ptr(ret_copy, true);
23706         return ret_ref;
23707 }
23708
23709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23710         if (!ptr_is_owned(_res)) return;
23711         void* _res_ptr = untag_ptr(_res);
23712         CHECK_ACCESS(_res_ptr);
23713         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
23714         FREE(untag_ptr(_res));
23715         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
23716 }
23717
23718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
23719         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23720         *ret_copy = COption_f64Z_some(o);
23721         int64_t ret_ref = tag_ptr(ret_copy, true);
23722         return ret_ref;
23723 }
23724
23725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
23726         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23727         *ret_copy = COption_f64Z_none();
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_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23733         if (!ptr_is_owned(_res)) return;
23734         void* _res_ptr = untag_ptr(_res);
23735         CHECK_ACCESS(_res_ptr);
23736         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
23737         FREE(untag_ptr(_res));
23738         COption_f64Z_free(_res_conv);
23739 }
23740
23741 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
23742         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23743         *ret_copy = COption_f64Z_clone(arg);
23744         int64_t ret_ref = tag_ptr(ret_copy, true);
23745         return ret_ref;
23746 }
23747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23748         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
23749         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
23750         return ret_conv;
23751 }
23752
23753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23754         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
23755         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
23756         *ret_copy = COption_f64Z_clone(orig_conv);
23757         int64_t ret_ref = tag_ptr(ret_copy, true);
23758         return ret_ref;
23759 }
23760
23761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23762         LDKProbabilisticScorer o_conv;
23763         o_conv.inner = untag_ptr(o);
23764         o_conv.is_owned = ptr_is_owned(o);
23765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23766         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
23767         
23768         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
23769         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
23770         return tag_ptr(ret_conv, true);
23771 }
23772
23773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23774         void* e_ptr = untag_ptr(e);
23775         CHECK_ACCESS(e_ptr);
23776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23778         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
23779         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
23780         return tag_ptr(ret_conv, true);
23781 }
23782
23783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23784         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
23785         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
23786         return ret_conv;
23787 }
23788
23789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23790         if (!ptr_is_owned(_res)) return;
23791         void* _res_ptr = untag_ptr(_res);
23792         CHECK_ACCESS(_res_ptr);
23793         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
23794         FREE(untag_ptr(_res));
23795         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
23796 }
23797
23798 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
23799         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23800         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
23801         return tag_ptr(ret_conv, true);
23802 }
23803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23804         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
23805         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
23806         return ret_conv;
23807 }
23808
23809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23810         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
23811         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23812         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
23813         return tag_ptr(ret_conv, true);
23814 }
23815
23816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
23817         LDKTransaction b_ref;
23818         b_ref.datalen = (*env)->GetArrayLength(env, b);
23819         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
23820         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
23821         b_ref.data_is_owned = true;
23822         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
23823         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
23824         return tag_ptr(ret_conv, true);
23825 }
23826
23827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23828         if (!ptr_is_owned(_res)) return;
23829         void* _res_ptr = untag_ptr(_res);
23830         CHECK_ACCESS(_res_ptr);
23831         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
23832         FREE(untag_ptr(_res));
23833         C2Tuple_usizeTransactionZ_free(_res_conv);
23834 }
23835
23836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23837         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
23838         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23839         if (_res_constr.datalen > 0)
23840                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
23841         else
23842                 _res_constr.data = NULL;
23843         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23844         for (size_t c = 0; c < _res_constr.datalen; c++) {
23845                 int64_t _res_conv_28 = _res_vals[c];
23846                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
23847                 CHECK_ACCESS(_res_conv_28_ptr);
23848                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
23849                 FREE(untag_ptr(_res_conv_28));
23850                 _res_constr.data[c] = _res_conv_28_conv;
23851         }
23852         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23853         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
23854 }
23855
23856 static inline uint64_t C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
23857         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23858         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(arg);
23859         return tag_ptr(ret_conv, true);
23860 }
23861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23862         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(arg);
23863         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
23864         return ret_conv;
23865 }
23866
23867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23868         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)untag_ptr(orig);
23869         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23870         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(orig_conv);
23871         return tag_ptr(ret_conv, true);
23872 }
23873
23874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
23875         LDKThirtyTwoBytes a_ref;
23876         CHECK((*env)->GetArrayLength(env, a) == 32);
23877         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23878         void* b_ptr = untag_ptr(b);
23879         CHECK_ACCESS(b_ptr);
23880         LDKCOption_ThirtyTwoBytesZ b_conv = *(LDKCOption_ThirtyTwoBytesZ*)(b_ptr);
23881         b_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(b));
23882         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
23883         *ret_conv = C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(a_ref, b_conv);
23884         return tag_ptr(ret_conv, true);
23885 }
23886
23887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23888         if (!ptr_is_owned(_res)) return;
23889         void* _res_ptr = untag_ptr(_res);
23890         CHECK_ACCESS(_res_ptr);
23891         LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_ptr);
23892         FREE(untag_ptr(_res));
23893         C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(_res_conv);
23894 }
23895
23896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCOption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23897         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res_constr;
23898         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23899         if (_res_constr.datalen > 0)
23900                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ Elements");
23901         else
23902                 _res_constr.data = NULL;
23903         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23904         for (size_t x = 0; x < _res_constr.datalen; x++) {
23905                 int64_t _res_conv_49 = _res_vals[x];
23906                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
23907                 CHECK_ACCESS(_res_conv_49_ptr);
23908                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ*)(_res_conv_49_ptr);
23909                 FREE(untag_ptr(_res_conv_49));
23910                 _res_constr.data[x] = _res_conv_49_conv;
23911         }
23912         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23913         CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(_res_constr);
23914 }
23915
23916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
23917         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
23918         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23919         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
23920         return tag_ptr(ret_conv, true);
23921 }
23922
23923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
23924         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23925         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
23926         return tag_ptr(ret_conv, true);
23927 }
23928
23929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23930         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
23931         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
23932         return ret_conv;
23933 }
23934
23935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23936         if (!ptr_is_owned(_res)) return;
23937         void* _res_ptr = untag_ptr(_res);
23938         CHECK_ACCESS(_res_ptr);
23939         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
23940         FREE(untag_ptr(_res));
23941         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
23942 }
23943
23944 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
23945         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23946         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
23947         return tag_ptr(ret_conv, true);
23948 }
23949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23950         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
23951         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
23952         return ret_conv;
23953 }
23954
23955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23956         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
23957         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
23958         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
23959         return tag_ptr(ret_conv, true);
23960 }
23961
23962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23963         LDKCVec_MonitorEventZ _res_constr;
23964         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23965         if (_res_constr.datalen > 0)
23966                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
23967         else
23968                 _res_constr.data = NULL;
23969         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23970         for (size_t o = 0; o < _res_constr.datalen; o++) {
23971                 int64_t _res_conv_14 = _res_vals[o];
23972                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
23973                 CHECK_ACCESS(_res_conv_14_ptr);
23974                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
23975                 FREE(untag_ptr(_res_conv_14));
23976                 _res_constr.data[o] = _res_conv_14_conv;
23977         }
23978         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23979         CVec_MonitorEventZ_free(_res_constr);
23980 }
23981
23982 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
23983         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23984         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
23985         return tag_ptr(ret_conv, true);
23986 }
23987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23988         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
23989         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
23990         return ret_conv;
23991 }
23992
23993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23994         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
23995         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
23996         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
23997         return tag_ptr(ret_conv, true);
23998 }
23999
24000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) {
24001         LDKOutPoint a_conv;
24002         a_conv.inner = untag_ptr(a);
24003         a_conv.is_owned = ptr_is_owned(a);
24004         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24005         a_conv = OutPoint_clone(&a_conv);
24006         LDKCVec_MonitorEventZ b_constr;
24007         b_constr.datalen = (*env)->GetArrayLength(env, b);
24008         if (b_constr.datalen > 0)
24009                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
24010         else
24011                 b_constr.data = NULL;
24012         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
24013         for (size_t o = 0; o < b_constr.datalen; o++) {
24014                 int64_t b_conv_14 = b_vals[o];
24015                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
24016                 CHECK_ACCESS(b_conv_14_ptr);
24017                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
24018                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
24019                 b_constr.data[o] = b_conv_14_conv;
24020         }
24021         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
24022         LDKPublicKey c_ref;
24023         CHECK((*env)->GetArrayLength(env, c) == 33);
24024         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
24025         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
24026         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
24027         return tag_ptr(ret_conv, true);
24028 }
24029
24030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24031         if (!ptr_is_owned(_res)) return;
24032         void* _res_ptr = untag_ptr(_res);
24033         CHECK_ACCESS(_res_ptr);
24034         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
24035         FREE(untag_ptr(_res));
24036         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
24037 }
24038
24039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24040         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
24041         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24042         if (_res_constr.datalen > 0)
24043                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
24044         else
24045                 _res_constr.data = NULL;
24046         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24047         for (size_t x = 0; x < _res_constr.datalen; x++) {
24048                 int64_t _res_conv_49 = _res_vals[x];
24049                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
24050                 CHECK_ACCESS(_res_conv_49_ptr);
24051                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
24052                 FREE(untag_ptr(_res_conv_49));
24053                 _res_constr.data[x] = _res_conv_49_conv;
24054         }
24055         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24056         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
24057 }
24058
24059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24060         LDKInitFeatures o_conv;
24061         o_conv.inner = untag_ptr(o);
24062         o_conv.is_owned = ptr_is_owned(o);
24063         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24064         o_conv = InitFeatures_clone(&o_conv);
24065         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24066         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
24067         return tag_ptr(ret_conv, true);
24068 }
24069
24070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24071         void* e_ptr = untag_ptr(e);
24072         CHECK_ACCESS(e_ptr);
24073         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24074         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24075         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24076         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
24077         return tag_ptr(ret_conv, true);
24078 }
24079
24080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24081         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
24082         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
24083         return ret_conv;
24084 }
24085
24086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24087         if (!ptr_is_owned(_res)) return;
24088         void* _res_ptr = untag_ptr(_res);
24089         CHECK_ACCESS(_res_ptr);
24090         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
24091         FREE(untag_ptr(_res));
24092         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
24093 }
24094
24095 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24096         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24097         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
24098         return tag_ptr(ret_conv, true);
24099 }
24100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24101         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
24102         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24103         return ret_conv;
24104 }
24105
24106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24107         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
24108         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24109         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
24110         return tag_ptr(ret_conv, true);
24111 }
24112
24113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24114         LDKChannelFeatures o_conv;
24115         o_conv.inner = untag_ptr(o);
24116         o_conv.is_owned = ptr_is_owned(o);
24117         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24118         o_conv = ChannelFeatures_clone(&o_conv);
24119         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24120         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
24121         return tag_ptr(ret_conv, true);
24122 }
24123
24124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24125         void* e_ptr = untag_ptr(e);
24126         CHECK_ACCESS(e_ptr);
24127         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24128         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24129         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24130         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
24131         return tag_ptr(ret_conv, true);
24132 }
24133
24134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24135         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
24136         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
24137         return ret_conv;
24138 }
24139
24140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24141         if (!ptr_is_owned(_res)) return;
24142         void* _res_ptr = untag_ptr(_res);
24143         CHECK_ACCESS(_res_ptr);
24144         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
24145         FREE(untag_ptr(_res));
24146         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
24147 }
24148
24149 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24150         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24151         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
24152         return tag_ptr(ret_conv, true);
24153 }
24154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24155         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
24156         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24157         return ret_conv;
24158 }
24159
24160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24161         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
24162         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24163         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
24164         return tag_ptr(ret_conv, true);
24165 }
24166
24167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24168         LDKNodeFeatures o_conv;
24169         o_conv.inner = untag_ptr(o);
24170         o_conv.is_owned = ptr_is_owned(o);
24171         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24172         o_conv = NodeFeatures_clone(&o_conv);
24173         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24174         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
24175         return tag_ptr(ret_conv, true);
24176 }
24177
24178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24179         void* e_ptr = untag_ptr(e);
24180         CHECK_ACCESS(e_ptr);
24181         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24182         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24183         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24184         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
24185         return tag_ptr(ret_conv, true);
24186 }
24187
24188 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24189         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
24190         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
24191         return ret_conv;
24192 }
24193
24194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24195         if (!ptr_is_owned(_res)) return;
24196         void* _res_ptr = untag_ptr(_res);
24197         CHECK_ACCESS(_res_ptr);
24198         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
24199         FREE(untag_ptr(_res));
24200         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
24201 }
24202
24203 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24204         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24205         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
24206         return tag_ptr(ret_conv, true);
24207 }
24208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24209         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
24210         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24211         return ret_conv;
24212 }
24213
24214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24215         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
24216         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24217         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
24218         return tag_ptr(ret_conv, true);
24219 }
24220
24221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24222         LDKBolt11InvoiceFeatures o_conv;
24223         o_conv.inner = untag_ptr(o);
24224         o_conv.is_owned = ptr_is_owned(o);
24225         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24226         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
24227         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
24228         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
24229         return tag_ptr(ret_conv, true);
24230 }
24231
24232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24233         void* e_ptr = untag_ptr(e);
24234         CHECK_ACCESS(e_ptr);
24235         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24236         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24237         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
24238         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
24239         return tag_ptr(ret_conv, true);
24240 }
24241
24242 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24243         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
24244         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
24245         return ret_conv;
24246 }
24247
24248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24249         if (!ptr_is_owned(_res)) return;
24250         void* _res_ptr = untag_ptr(_res);
24251         CHECK_ACCESS(_res_ptr);
24252         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
24253         FREE(untag_ptr(_res));
24254         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
24255 }
24256
24257 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24258         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
24259         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
24260         return tag_ptr(ret_conv, true);
24261 }
24262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24263         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
24264         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24265         return ret_conv;
24266 }
24267
24268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24269         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
24270         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
24271         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
24272         return tag_ptr(ret_conv, true);
24273 }
24274
24275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24276         LDKBolt12InvoiceFeatures o_conv;
24277         o_conv.inner = untag_ptr(o);
24278         o_conv.is_owned = ptr_is_owned(o);
24279         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24280         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
24281         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
24282         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
24283         return tag_ptr(ret_conv, true);
24284 }
24285
24286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24287         void* e_ptr = untag_ptr(e);
24288         CHECK_ACCESS(e_ptr);
24289         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24290         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24291         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
24292         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
24293         return tag_ptr(ret_conv, true);
24294 }
24295
24296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24297         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
24298         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
24299         return ret_conv;
24300 }
24301
24302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24303         if (!ptr_is_owned(_res)) return;
24304         void* _res_ptr = untag_ptr(_res);
24305         CHECK_ACCESS(_res_ptr);
24306         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
24307         FREE(untag_ptr(_res));
24308         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
24309 }
24310
24311 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24312         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
24313         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
24314         return tag_ptr(ret_conv, true);
24315 }
24316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24317         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
24318         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24319         return ret_conv;
24320 }
24321
24322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24323         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
24324         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
24325         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
24326         return tag_ptr(ret_conv, true);
24327 }
24328
24329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24330         LDKBlindedHopFeatures o_conv;
24331         o_conv.inner = untag_ptr(o);
24332         o_conv.is_owned = ptr_is_owned(o);
24333         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24334         o_conv = BlindedHopFeatures_clone(&o_conv);
24335         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
24336         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
24337         return tag_ptr(ret_conv, true);
24338 }
24339
24340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24341         void* e_ptr = untag_ptr(e);
24342         CHECK_ACCESS(e_ptr);
24343         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24344         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24345         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
24346         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
24347         return tag_ptr(ret_conv, true);
24348 }
24349
24350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24351         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
24352         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
24353         return ret_conv;
24354 }
24355
24356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24357         if (!ptr_is_owned(_res)) return;
24358         void* _res_ptr = untag_ptr(_res);
24359         CHECK_ACCESS(_res_ptr);
24360         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
24361         FREE(untag_ptr(_res));
24362         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
24363 }
24364
24365 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24366         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
24367         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
24368         return tag_ptr(ret_conv, true);
24369 }
24370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24371         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
24372         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24373         return ret_conv;
24374 }
24375
24376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24377         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
24378         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
24379         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
24380         return tag_ptr(ret_conv, true);
24381 }
24382
24383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24384         LDKChannelTypeFeatures o_conv;
24385         o_conv.inner = untag_ptr(o);
24386         o_conv.is_owned = ptr_is_owned(o);
24387         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24388         o_conv = ChannelTypeFeatures_clone(&o_conv);
24389         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24390         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
24391         return tag_ptr(ret_conv, true);
24392 }
24393
24394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24395         void* e_ptr = untag_ptr(e);
24396         CHECK_ACCESS(e_ptr);
24397         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24398         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24399         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24400         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
24401         return tag_ptr(ret_conv, true);
24402 }
24403
24404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24405         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
24406         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
24407         return ret_conv;
24408 }
24409
24410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24411         if (!ptr_is_owned(_res)) return;
24412         void* _res_ptr = untag_ptr(_res);
24413         CHECK_ACCESS(_res_ptr);
24414         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
24415         FREE(untag_ptr(_res));
24416         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
24417 }
24418
24419 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
24420         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24421         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
24422         return tag_ptr(ret_conv, true);
24423 }
24424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24425         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
24426         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
24427         return ret_conv;
24428 }
24429
24430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24431         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
24432         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
24433         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
24434         return tag_ptr(ret_conv, true);
24435 }
24436
24437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24438         LDKOffer o_conv;
24439         o_conv.inner = untag_ptr(o);
24440         o_conv.is_owned = ptr_is_owned(o);
24441         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24442         o_conv = Offer_clone(&o_conv);
24443         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24444         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
24445         return tag_ptr(ret_conv, true);
24446 }
24447
24448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24449         LDKBolt12ParseError e_conv;
24450         e_conv.inner = untag_ptr(e);
24451         e_conv.is_owned = ptr_is_owned(e);
24452         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24453         e_conv = Bolt12ParseError_clone(&e_conv);
24454         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24455         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
24456         return tag_ptr(ret_conv, true);
24457 }
24458
24459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24460         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
24461         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
24462         return ret_conv;
24463 }
24464
24465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24466         if (!ptr_is_owned(_res)) return;
24467         void* _res_ptr = untag_ptr(_res);
24468         CHECK_ACCESS(_res_ptr);
24469         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
24470         FREE(untag_ptr(_res));
24471         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
24472 }
24473
24474 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
24475         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24476         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
24477         return tag_ptr(ret_conv, true);
24478 }
24479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24480         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
24481         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
24482         return ret_conv;
24483 }
24484
24485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24486         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
24487         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
24488         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
24489         return tag_ptr(ret_conv, true);
24490 }
24491
24492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24493         LDKPublicKey o_ref;
24494         CHECK((*env)->GetArrayLength(env, o) == 33);
24495         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
24496         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24497         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
24498         return tag_ptr(ret_conv, true);
24499 }
24500
24501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24502         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
24503         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24504         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
24505         return tag_ptr(ret_conv, true);
24506 }
24507
24508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24509         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
24510         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
24511         return ret_conv;
24512 }
24513
24514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24515         if (!ptr_is_owned(_res)) return;
24516         void* _res_ptr = untag_ptr(_res);
24517         CHECK_ACCESS(_res_ptr);
24518         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
24519         FREE(untag_ptr(_res));
24520         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
24521 }
24522
24523 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
24524         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24525         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
24526         return tag_ptr(ret_conv, true);
24527 }
24528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24529         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
24530         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
24531         return ret_conv;
24532 }
24533
24534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24535         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
24536         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
24537         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
24538         return tag_ptr(ret_conv, true);
24539 }
24540
24541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24542         LDKNodeId o_conv;
24543         o_conv.inner = untag_ptr(o);
24544         o_conv.is_owned = ptr_is_owned(o);
24545         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24546         o_conv = NodeId_clone(&o_conv);
24547         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24548         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
24549         return tag_ptr(ret_conv, true);
24550 }
24551
24552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24553         void* e_ptr = untag_ptr(e);
24554         CHECK_ACCESS(e_ptr);
24555         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24556         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24557         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24558         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
24559         return tag_ptr(ret_conv, true);
24560 }
24561
24562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24563         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
24564         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
24565         return ret_conv;
24566 }
24567
24568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24569         if (!ptr_is_owned(_res)) return;
24570         void* _res_ptr = untag_ptr(_res);
24571         CHECK_ACCESS(_res_ptr);
24572         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
24573         FREE(untag_ptr(_res));
24574         CResult_NodeIdDecodeErrorZ_free(_res_conv);
24575 }
24576
24577 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
24578         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24579         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
24580         return tag_ptr(ret_conv, true);
24581 }
24582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24583         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
24584         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
24585         return ret_conv;
24586 }
24587
24588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24589         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
24590         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
24591         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
24592         return tag_ptr(ret_conv, true);
24593 }
24594
24595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24596         void* o_ptr = untag_ptr(o);
24597         CHECK_ACCESS(o_ptr);
24598         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
24599         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
24600         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24601         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
24602         int64_t ret_ref = tag_ptr(ret_copy, true);
24603         return ret_ref;
24604 }
24605
24606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
24607         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24608         *ret_copy = COption_NetworkUpdateZ_none();
24609         int64_t ret_ref = tag_ptr(ret_copy, true);
24610         return ret_ref;
24611 }
24612
24613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24614         if (!ptr_is_owned(_res)) return;
24615         void* _res_ptr = untag_ptr(_res);
24616         CHECK_ACCESS(_res_ptr);
24617         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
24618         FREE(untag_ptr(_res));
24619         COption_NetworkUpdateZ_free(_res_conv);
24620 }
24621
24622 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
24623         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24624         *ret_copy = COption_NetworkUpdateZ_clone(arg);
24625         int64_t ret_ref = tag_ptr(ret_copy, true);
24626         return ret_ref;
24627 }
24628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24629         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
24630         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
24631         return ret_conv;
24632 }
24633
24634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24635         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
24636         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
24637         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
24638         int64_t ret_ref = tag_ptr(ret_copy, true);
24639         return ret_ref;
24640 }
24641
24642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24643         void* o_ptr = untag_ptr(o);
24644         CHECK_ACCESS(o_ptr);
24645         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
24646         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
24647         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24648         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
24649         return tag_ptr(ret_conv, true);
24650 }
24651
24652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24653         void* e_ptr = untag_ptr(e);
24654         CHECK_ACCESS(e_ptr);
24655         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24656         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24657         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24658         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
24659         return tag_ptr(ret_conv, true);
24660 }
24661
24662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24663         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
24664         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
24665         return ret_conv;
24666 }
24667
24668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24669         if (!ptr_is_owned(_res)) return;
24670         void* _res_ptr = untag_ptr(_res);
24671         CHECK_ACCESS(_res_ptr);
24672         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
24673         FREE(untag_ptr(_res));
24674         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
24675 }
24676
24677 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
24678         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24679         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
24680         return tag_ptr(ret_conv, true);
24681 }
24682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24683         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
24684         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
24685         return ret_conv;
24686 }
24687
24688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24689         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
24690         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
24691         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
24692         return tag_ptr(ret_conv, true);
24693 }
24694
24695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24696         void* o_ptr = untag_ptr(o);
24697         CHECK_ACCESS(o_ptr);
24698         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
24699         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
24700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24701                 LDKUtxoLookup_JCalls_cloned(&o_conv);
24702         }
24703         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
24704         *ret_copy = COption_UtxoLookupZ_some(o_conv);
24705         int64_t ret_ref = tag_ptr(ret_copy, true);
24706         return ret_ref;
24707 }
24708
24709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
24710         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
24711         *ret_copy = COption_UtxoLookupZ_none();
24712         int64_t ret_ref = tag_ptr(ret_copy, true);
24713         return ret_ref;
24714 }
24715
24716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24717         if (!ptr_is_owned(_res)) return;
24718         void* _res_ptr = untag_ptr(_res);
24719         CHECK_ACCESS(_res_ptr);
24720         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
24721         FREE(untag_ptr(_res));
24722         COption_UtxoLookupZ_free(_res_conv);
24723 }
24724
24725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
24726         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24727         *ret_conv = CResult_NoneLightningErrorZ_ok();
24728         return tag_ptr(ret_conv, true);
24729 }
24730
24731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24732         LDKLightningError e_conv;
24733         e_conv.inner = untag_ptr(e);
24734         e_conv.is_owned = ptr_is_owned(e);
24735         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24736         e_conv = LightningError_clone(&e_conv);
24737         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24738         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
24739         return tag_ptr(ret_conv, true);
24740 }
24741
24742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24743         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
24744         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
24745         return ret_conv;
24746 }
24747
24748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24749         if (!ptr_is_owned(_res)) return;
24750         void* _res_ptr = untag_ptr(_res);
24751         CHECK_ACCESS(_res_ptr);
24752         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
24753         FREE(untag_ptr(_res));
24754         CResult_NoneLightningErrorZ_free(_res_conv);
24755 }
24756
24757 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
24758         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24759         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
24760         return tag_ptr(ret_conv, true);
24761 }
24762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24763         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
24764         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
24765         return ret_conv;
24766 }
24767
24768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24769         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
24770         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24771         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
24772         return tag_ptr(ret_conv, true);
24773 }
24774
24775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
24776         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24777         *ret_conv = CResult_boolLightningErrorZ_ok(o);
24778         return tag_ptr(ret_conv, true);
24779 }
24780
24781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24782         LDKLightningError e_conv;
24783         e_conv.inner = untag_ptr(e);
24784         e_conv.is_owned = ptr_is_owned(e);
24785         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24786         e_conv = LightningError_clone(&e_conv);
24787         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24788         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
24789         return tag_ptr(ret_conv, true);
24790 }
24791
24792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24793         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
24794         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
24795         return ret_conv;
24796 }
24797
24798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24799         if (!ptr_is_owned(_res)) return;
24800         void* _res_ptr = untag_ptr(_res);
24801         CHECK_ACCESS(_res_ptr);
24802         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
24803         FREE(untag_ptr(_res));
24804         CResult_boolLightningErrorZ_free(_res_conv);
24805 }
24806
24807 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
24808         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24809         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
24810         return tag_ptr(ret_conv, true);
24811 }
24812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24813         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
24814         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
24815         return ret_conv;
24816 }
24817
24818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24819         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
24820         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
24821         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
24822         return tag_ptr(ret_conv, true);
24823 }
24824
24825 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
24826         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24827         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
24828         return tag_ptr(ret_conv, true);
24829 }
24830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24831         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
24832         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
24833         return ret_conv;
24834 }
24835
24836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24837         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
24838         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24839         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
24840         return tag_ptr(ret_conv, true);
24841 }
24842
24843 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) {
24844         LDKChannelAnnouncement a_conv;
24845         a_conv.inner = untag_ptr(a);
24846         a_conv.is_owned = ptr_is_owned(a);
24847         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24848         a_conv = ChannelAnnouncement_clone(&a_conv);
24849         LDKChannelUpdate b_conv;
24850         b_conv.inner = untag_ptr(b);
24851         b_conv.is_owned = ptr_is_owned(b);
24852         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24853         b_conv = ChannelUpdate_clone(&b_conv);
24854         LDKChannelUpdate c_conv;
24855         c_conv.inner = untag_ptr(c);
24856         c_conv.is_owned = ptr_is_owned(c);
24857         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24858         c_conv = ChannelUpdate_clone(&c_conv);
24859         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
24860         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
24861         return tag_ptr(ret_conv, true);
24862 }
24863
24864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24865         if (!ptr_is_owned(_res)) return;
24866         void* _res_ptr = untag_ptr(_res);
24867         CHECK_ACCESS(_res_ptr);
24868         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
24869         FREE(untag_ptr(_res));
24870         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
24871 }
24872
24873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24874         void* o_ptr = untag_ptr(o);
24875         CHECK_ACCESS(o_ptr);
24876         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
24877         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
24878         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24879         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
24880         int64_t ret_ref = tag_ptr(ret_copy, true);
24881         return ret_ref;
24882 }
24883
24884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
24885         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24886         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
24887         int64_t ret_ref = tag_ptr(ret_copy, true);
24888         return ret_ref;
24889 }
24890
24891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24892         if (!ptr_is_owned(_res)) return;
24893         void* _res_ptr = untag_ptr(_res);
24894         CHECK_ACCESS(_res_ptr);
24895         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
24896         FREE(untag_ptr(_res));
24897         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
24898 }
24899
24900 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
24901         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24902         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
24903         int64_t ret_ref = tag_ptr(ret_copy, true);
24904         return ret_ref;
24905 }
24906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24907         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
24908         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
24909         return ret_conv;
24910 }
24911
24912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24913         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
24914         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
24915         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
24916         int64_t ret_ref = tag_ptr(ret_copy, true);
24917         return ret_ref;
24918 }
24919
24920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24921         LDKCVec_MessageSendEventZ _res_constr;
24922         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24923         if (_res_constr.datalen > 0)
24924                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
24925         else
24926                 _res_constr.data = NULL;
24927         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24928         for (size_t s = 0; s < _res_constr.datalen; s++) {
24929                 int64_t _res_conv_18 = _res_vals[s];
24930                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
24931                 CHECK_ACCESS(_res_conv_18_ptr);
24932                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
24933                 FREE(untag_ptr(_res_conv_18));
24934                 _res_constr.data[s] = _res_conv_18_conv;
24935         }
24936         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24937         CVec_MessageSendEventZ_free(_res_constr);
24938 }
24939
24940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24941         LDKChannelUpdateInfo o_conv;
24942         o_conv.inner = untag_ptr(o);
24943         o_conv.is_owned = ptr_is_owned(o);
24944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24945         o_conv = ChannelUpdateInfo_clone(&o_conv);
24946         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24947         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
24948         return tag_ptr(ret_conv, true);
24949 }
24950
24951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24952         void* e_ptr = untag_ptr(e);
24953         CHECK_ACCESS(e_ptr);
24954         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24955         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24956         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24957         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
24958         return tag_ptr(ret_conv, true);
24959 }
24960
24961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24962         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
24963         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
24964         return ret_conv;
24965 }
24966
24967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24968         if (!ptr_is_owned(_res)) return;
24969         void* _res_ptr = untag_ptr(_res);
24970         CHECK_ACCESS(_res_ptr);
24971         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
24972         FREE(untag_ptr(_res));
24973         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
24974 }
24975
24976 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
24977         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24978         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
24979         return tag_ptr(ret_conv, true);
24980 }
24981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24982         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
24983         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
24984         return ret_conv;
24985 }
24986
24987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24988         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
24989         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
24990         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
24991         return tag_ptr(ret_conv, true);
24992 }
24993
24994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24995         LDKChannelInfo o_conv;
24996         o_conv.inner = untag_ptr(o);
24997         o_conv.is_owned = ptr_is_owned(o);
24998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24999         o_conv = ChannelInfo_clone(&o_conv);
25000         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25001         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
25002         return tag_ptr(ret_conv, true);
25003 }
25004
25005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25006         void* e_ptr = untag_ptr(e);
25007         CHECK_ACCESS(e_ptr);
25008         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25009         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25010         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25011         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
25012         return tag_ptr(ret_conv, true);
25013 }
25014
25015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25016         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
25017         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
25018         return ret_conv;
25019 }
25020
25021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25022         if (!ptr_is_owned(_res)) return;
25023         void* _res_ptr = untag_ptr(_res);
25024         CHECK_ACCESS(_res_ptr);
25025         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
25026         FREE(untag_ptr(_res));
25027         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
25028 }
25029
25030 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
25031         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25032         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
25033         return tag_ptr(ret_conv, true);
25034 }
25035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25036         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
25037         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
25038         return ret_conv;
25039 }
25040
25041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25042         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
25043         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25044         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
25045         return tag_ptr(ret_conv, true);
25046 }
25047
25048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25049         LDKRoutingFees o_conv;
25050         o_conv.inner = untag_ptr(o);
25051         o_conv.is_owned = ptr_is_owned(o);
25052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25053         o_conv = RoutingFees_clone(&o_conv);
25054         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25055         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
25056         return tag_ptr(ret_conv, true);
25057 }
25058
25059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25060         void* e_ptr = untag_ptr(e);
25061         CHECK_ACCESS(e_ptr);
25062         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25063         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25064         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25065         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
25066         return tag_ptr(ret_conv, true);
25067 }
25068
25069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25070         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
25071         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
25072         return ret_conv;
25073 }
25074
25075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25076         if (!ptr_is_owned(_res)) return;
25077         void* _res_ptr = untag_ptr(_res);
25078         CHECK_ACCESS(_res_ptr);
25079         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
25080         FREE(untag_ptr(_res));
25081         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
25082 }
25083
25084 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
25085         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25086         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
25087         return tag_ptr(ret_conv, true);
25088 }
25089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25090         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
25091         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
25092         return ret_conv;
25093 }
25094
25095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25096         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
25097         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25098         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
25099         return tag_ptr(ret_conv, true);
25100 }
25101
25102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25103         LDKCVec_SocketAddressZ _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(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
25107         else
25108                 _res_constr.data = NULL;
25109         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25110         for (size_t p = 0; p < _res_constr.datalen; p++) {
25111                 int64_t _res_conv_15 = _res_vals[p];
25112                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
25113                 CHECK_ACCESS(_res_conv_15_ptr);
25114                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
25115                 FREE(untag_ptr(_res_conv_15));
25116                 _res_constr.data[p] = _res_conv_15_conv;
25117         }
25118         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25119         CVec_SocketAddressZ_free(_res_constr);
25120 }
25121
25122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25123         LDKNodeAnnouncementInfo o_conv;
25124         o_conv.inner = untag_ptr(o);
25125         o_conv.is_owned = ptr_is_owned(o);
25126         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25127         o_conv = NodeAnnouncementInfo_clone(&o_conv);
25128         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25129         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
25130         return tag_ptr(ret_conv, true);
25131 }
25132
25133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25134         void* e_ptr = untag_ptr(e);
25135         CHECK_ACCESS(e_ptr);
25136         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25137         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25138         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25139         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
25140         return tag_ptr(ret_conv, true);
25141 }
25142
25143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25144         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
25145         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
25146         return ret_conv;
25147 }
25148
25149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25150         if (!ptr_is_owned(_res)) return;
25151         void* _res_ptr = untag_ptr(_res);
25152         CHECK_ACCESS(_res_ptr);
25153         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
25154         FREE(untag_ptr(_res));
25155         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
25156 }
25157
25158 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
25159         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25160         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
25161         return tag_ptr(ret_conv, true);
25162 }
25163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25164         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
25165         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
25166         return ret_conv;
25167 }
25168
25169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25170         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
25171         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
25172         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
25173         return tag_ptr(ret_conv, true);
25174 }
25175
25176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25177         LDKNodeAlias o_conv;
25178         o_conv.inner = untag_ptr(o);
25179         o_conv.is_owned = ptr_is_owned(o);
25180         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25181         o_conv = NodeAlias_clone(&o_conv);
25182         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
25183         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
25184         return tag_ptr(ret_conv, true);
25185 }
25186
25187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25188         void* e_ptr = untag_ptr(e);
25189         CHECK_ACCESS(e_ptr);
25190         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25191         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25192         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
25193         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
25194         return tag_ptr(ret_conv, true);
25195 }
25196
25197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25198         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
25199         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
25200         return ret_conv;
25201 }
25202
25203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25204         if (!ptr_is_owned(_res)) return;
25205         void* _res_ptr = untag_ptr(_res);
25206         CHECK_ACCESS(_res_ptr);
25207         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
25208         FREE(untag_ptr(_res));
25209         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
25210 }
25211
25212 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
25213         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
25214         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
25215         return tag_ptr(ret_conv, true);
25216 }
25217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25218         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
25219         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
25220         return ret_conv;
25221 }
25222
25223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25224         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
25225         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
25226         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
25227         return tag_ptr(ret_conv, true);
25228 }
25229
25230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25231         LDKNodeInfo o_conv;
25232         o_conv.inner = untag_ptr(o);
25233         o_conv.is_owned = ptr_is_owned(o);
25234         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25235         o_conv = NodeInfo_clone(&o_conv);
25236         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25237         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
25238         return tag_ptr(ret_conv, true);
25239 }
25240
25241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25242         void* e_ptr = untag_ptr(e);
25243         CHECK_ACCESS(e_ptr);
25244         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25245         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25246         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25247         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
25248         return tag_ptr(ret_conv, true);
25249 }
25250
25251 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25252         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
25253         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
25254         return ret_conv;
25255 }
25256
25257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25258         if (!ptr_is_owned(_res)) return;
25259         void* _res_ptr = untag_ptr(_res);
25260         CHECK_ACCESS(_res_ptr);
25261         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
25262         FREE(untag_ptr(_res));
25263         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
25264 }
25265
25266 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
25267         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25268         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
25269         return tag_ptr(ret_conv, true);
25270 }
25271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25272         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
25273         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
25274         return ret_conv;
25275 }
25276
25277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25278         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
25279         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25280         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
25281         return tag_ptr(ret_conv, true);
25282 }
25283
25284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25285         LDKNetworkGraph o_conv;
25286         o_conv.inner = untag_ptr(o);
25287         o_conv.is_owned = ptr_is_owned(o);
25288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25289         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
25290         
25291         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25292         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
25293         return tag_ptr(ret_conv, true);
25294 }
25295
25296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25297         void* e_ptr = untag_ptr(e);
25298         CHECK_ACCESS(e_ptr);
25299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25301         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25302         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
25303         return tag_ptr(ret_conv, true);
25304 }
25305
25306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25307         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
25308         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
25309         return ret_conv;
25310 }
25311
25312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25313         if (!ptr_is_owned(_res)) return;
25314         void* _res_ptr = untag_ptr(_res);
25315         CHECK_ACCESS(_res_ptr);
25316         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
25317         FREE(untag_ptr(_res));
25318         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
25319 }
25320
25321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
25322         LDKCVec_SocketAddressZ o_constr;
25323         o_constr.datalen = (*env)->GetArrayLength(env, o);
25324         if (o_constr.datalen > 0)
25325                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
25326         else
25327                 o_constr.data = NULL;
25328         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
25329         for (size_t p = 0; p < o_constr.datalen; p++) {
25330                 int64_t o_conv_15 = o_vals[p];
25331                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
25332                 CHECK_ACCESS(o_conv_15_ptr);
25333                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
25334                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
25335                 o_constr.data[p] = o_conv_15_conv;
25336         }
25337         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
25338         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
25339         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
25340         int64_t ret_ref = tag_ptr(ret_copy, true);
25341         return ret_ref;
25342 }
25343
25344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
25345         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
25346         *ret_copy = COption_CVec_SocketAddressZZ_none();
25347         int64_t ret_ref = tag_ptr(ret_copy, true);
25348         return ret_ref;
25349 }
25350
25351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25352         if (!ptr_is_owned(_res)) return;
25353         void* _res_ptr = untag_ptr(_res);
25354         CHECK_ACCESS(_res_ptr);
25355         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
25356         FREE(untag_ptr(_res));
25357         COption_CVec_SocketAddressZZ_free(_res_conv);
25358 }
25359
25360 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
25361         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
25362         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
25363         int64_t ret_ref = tag_ptr(ret_copy, true);
25364         return ret_ref;
25365 }
25366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25367         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
25368         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
25369         return ret_conv;
25370 }
25371
25372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25373         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
25374         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
25375         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
25376         int64_t ret_ref = tag_ptr(ret_copy, true);
25377         return ret_ref;
25378 }
25379
25380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25381         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
25382         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25383         if (_res_constr.datalen > 0)
25384                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
25385         else
25386                 _res_constr.data = NULL;
25387         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25388         for (size_t y = 0; y < _res_constr.datalen; y++) {
25389                 int64_t _res_conv_24 = _res_vals[y];
25390                 LDKHTLCOutputInCommitment _res_conv_24_conv;
25391                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
25392                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
25393                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
25394                 _res_constr.data[y] = _res_conv_24_conv;
25395         }
25396         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25397         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
25398 }
25399
25400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25401         LDKCVec_HTLCDescriptorZ _res_constr;
25402         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25403         if (_res_constr.datalen > 0)
25404                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
25405         else
25406                 _res_constr.data = NULL;
25407         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25408         for (size_t q = 0; q < _res_constr.datalen; q++) {
25409                 int64_t _res_conv_16 = _res_vals[q];
25410                 LDKHTLCDescriptor _res_conv_16_conv;
25411                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25412                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25413                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25414                 _res_constr.data[q] = _res_conv_16_conv;
25415         }
25416         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25417         CVec_HTLCDescriptorZ_free(_res_constr);
25418 }
25419
25420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25421         LDKCVec_UtxoZ _res_constr;
25422         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25423         if (_res_constr.datalen > 0)
25424                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
25425         else
25426                 _res_constr.data = NULL;
25427         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25428         for (size_t g = 0; g < _res_constr.datalen; g++) {
25429                 int64_t _res_conv_6 = _res_vals[g];
25430                 LDKUtxo _res_conv_6_conv;
25431                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
25432                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
25433                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
25434                 _res_constr.data[g] = _res_conv_6_conv;
25435         }
25436         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25437         CVec_UtxoZ_free(_res_constr);
25438 }
25439
25440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25441         void* o_ptr = untag_ptr(o);
25442         CHECK_ACCESS(o_ptr);
25443         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
25444         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
25445         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25446         *ret_copy = COption_TxOutZ_some(o_conv);
25447         int64_t ret_ref = tag_ptr(ret_copy, true);
25448         return ret_ref;
25449 }
25450
25451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
25452         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25453         *ret_copy = COption_TxOutZ_none();
25454         int64_t ret_ref = tag_ptr(ret_copy, true);
25455         return ret_ref;
25456 }
25457
25458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25459         if (!ptr_is_owned(_res)) return;
25460         void* _res_ptr = untag_ptr(_res);
25461         CHECK_ACCESS(_res_ptr);
25462         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
25463         FREE(untag_ptr(_res));
25464         COption_TxOutZ_free(_res_conv);
25465 }
25466
25467 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
25468         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25469         *ret_copy = COption_TxOutZ_clone(arg);
25470         int64_t ret_ref = tag_ptr(ret_copy, true);
25471         return ret_ref;
25472 }
25473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25474         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
25475         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
25476         return ret_conv;
25477 }
25478
25479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25480         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
25481         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
25482         *ret_copy = COption_TxOutZ_clone(orig_conv);
25483         int64_t ret_ref = tag_ptr(ret_copy, true);
25484         return ret_ref;
25485 }
25486
25487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25488         LDKCVec_InputZ _res_constr;
25489         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25490         if (_res_constr.datalen > 0)
25491                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
25492         else
25493                 _res_constr.data = NULL;
25494         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25495         for (size_t h = 0; h < _res_constr.datalen; h++) {
25496                 int64_t _res_conv_7 = _res_vals[h];
25497                 LDKInput _res_conv_7_conv;
25498                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
25499                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
25500                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
25501                 _res_constr.data[h] = _res_conv_7_conv;
25502         }
25503         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25504         CVec_InputZ_free(_res_constr);
25505 }
25506
25507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25508         LDKCoinSelection o_conv;
25509         o_conv.inner = untag_ptr(o);
25510         o_conv.is_owned = ptr_is_owned(o);
25511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25512         o_conv = CoinSelection_clone(&o_conv);
25513         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25514         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
25515         return tag_ptr(ret_conv, true);
25516 }
25517
25518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
25519         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25520         *ret_conv = CResult_CoinSelectionNoneZ_err();
25521         return tag_ptr(ret_conv, true);
25522 }
25523
25524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25525         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
25526         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
25527         return ret_conv;
25528 }
25529
25530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25531         if (!ptr_is_owned(_res)) return;
25532         void* _res_ptr = untag_ptr(_res);
25533         CHECK_ACCESS(_res_ptr);
25534         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
25535         FREE(untag_ptr(_res));
25536         CResult_CoinSelectionNoneZ_free(_res_conv);
25537 }
25538
25539 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
25540         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25541         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
25542         return tag_ptr(ret_conv, true);
25543 }
25544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25545         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
25546         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
25547         return ret_conv;
25548 }
25549
25550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25551         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
25552         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
25553         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
25554         return tag_ptr(ret_conv, true);
25555 }
25556
25557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
25558         LDKCVec_UtxoZ o_constr;
25559         o_constr.datalen = (*env)->GetArrayLength(env, o);
25560         if (o_constr.datalen > 0)
25561                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
25562         else
25563                 o_constr.data = NULL;
25564         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
25565         for (size_t g = 0; g < o_constr.datalen; g++) {
25566                 int64_t o_conv_6 = o_vals[g];
25567                 LDKUtxo o_conv_6_conv;
25568                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
25569                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
25570                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
25571                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
25572                 o_constr.data[g] = o_conv_6_conv;
25573         }
25574         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
25575         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25576         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
25577         return tag_ptr(ret_conv, true);
25578 }
25579
25580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
25581         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25582         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
25583         return tag_ptr(ret_conv, true);
25584 }
25585
25586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25587         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
25588         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
25589         return ret_conv;
25590 }
25591
25592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25593         if (!ptr_is_owned(_res)) return;
25594         void* _res_ptr = untag_ptr(_res);
25595         CHECK_ACCESS(_res_ptr);
25596         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
25597         FREE(untag_ptr(_res));
25598         CResult_CVec_UtxoZNoneZ_free(_res_conv);
25599 }
25600
25601 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
25602         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25603         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
25604         return tag_ptr(ret_conv, true);
25605 }
25606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25607         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
25608         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
25609         return ret_conv;
25610 }
25611
25612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25613         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
25614         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
25615         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
25616         return tag_ptr(ret_conv, true);
25617 }
25618
25619 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
25620         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25621         *ret_conv = C2Tuple_u64u16Z_clone(arg);
25622         return tag_ptr(ret_conv, true);
25623 }
25624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25625         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
25626         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
25627         return ret_conv;
25628 }
25629
25630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25631         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
25632         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25633         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
25634         return tag_ptr(ret_conv, true);
25635 }
25636
25637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
25638         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
25639         *ret_conv = C2Tuple_u64u16Z_new(a, b);
25640         return tag_ptr(ret_conv, true);
25641 }
25642
25643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25644         if (!ptr_is_owned(_res)) return;
25645         void* _res_ptr = untag_ptr(_res);
25646         CHECK_ACCESS(_res_ptr);
25647         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
25648         FREE(untag_ptr(_res));
25649         C2Tuple_u64u16Z_free(_res_conv);
25650 }
25651
25652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25653         void* o_ptr = untag_ptr(o);
25654         CHECK_ACCESS(o_ptr);
25655         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
25656         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
25657         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25658         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
25659         int64_t ret_ref = tag_ptr(ret_copy, true);
25660         return ret_ref;
25661 }
25662
25663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
25664         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25665         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
25666         int64_t ret_ref = tag_ptr(ret_copy, true);
25667         return ret_ref;
25668 }
25669
25670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25671         if (!ptr_is_owned(_res)) return;
25672         void* _res_ptr = untag_ptr(_res);
25673         CHECK_ACCESS(_res_ptr);
25674         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
25675         FREE(untag_ptr(_res));
25676         COption_C2Tuple_u64u16ZZ_free(_res_conv);
25677 }
25678
25679 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
25680         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25681         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
25682         int64_t ret_ref = tag_ptr(ret_copy, true);
25683         return ret_ref;
25684 }
25685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25686         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
25687         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
25688         return ret_conv;
25689 }
25690
25691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25692         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
25693         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
25694         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
25695         int64_t ret_ref = tag_ptr(ret_copy, true);
25696         return ret_ref;
25697 }
25698
25699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
25700         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
25701         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25702         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
25703         int64_t ret_ref = tag_ptr(ret_copy, true);
25704         return ret_ref;
25705 }
25706
25707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
25708         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25709         *ret_copy = COption_ChannelShutdownStateZ_none();
25710         int64_t ret_ref = tag_ptr(ret_copy, true);
25711         return ret_ref;
25712 }
25713
25714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25715         if (!ptr_is_owned(_res)) return;
25716         void* _res_ptr = untag_ptr(_res);
25717         CHECK_ACCESS(_res_ptr);
25718         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
25719         FREE(untag_ptr(_res));
25720         COption_ChannelShutdownStateZ_free(_res_conv);
25721 }
25722
25723 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
25724         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25725         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
25726         int64_t ret_ref = tag_ptr(ret_copy, true);
25727         return ret_ref;
25728 }
25729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25730         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
25731         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
25732         return ret_conv;
25733 }
25734
25735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25736         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
25737         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
25738         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
25739         int64_t ret_ref = tag_ptr(ret_copy, true);
25740         return ret_ref;
25741 }
25742
25743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25744         LDKThirtyTwoBytes o_ref;
25745         CHECK((*env)->GetArrayLength(env, o) == 32);
25746         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25747         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25748         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
25749         return tag_ptr(ret_conv, true);
25750 }
25751
25752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25753         void* e_ptr = untag_ptr(e);
25754         CHECK_ACCESS(e_ptr);
25755         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
25756         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
25757         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25758         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
25759         return tag_ptr(ret_conv, true);
25760 }
25761
25762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25763         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
25764         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
25765         return ret_conv;
25766 }
25767
25768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25769         if (!ptr_is_owned(_res)) return;
25770         void* _res_ptr = untag_ptr(_res);
25771         CHECK_ACCESS(_res_ptr);
25772         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
25773         FREE(untag_ptr(_res));
25774         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
25775 }
25776
25777 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
25778         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25779         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
25780         return tag_ptr(ret_conv, true);
25781 }
25782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25783         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
25784         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
25785         return ret_conv;
25786 }
25787
25788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25789         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
25790         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25791         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
25792         return tag_ptr(ret_conv, true);
25793 }
25794
25795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25796         LDKCVec_RecentPaymentDetailsZ _res_constr;
25797         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25798         if (_res_constr.datalen > 0)
25799                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
25800         else
25801                 _res_constr.data = NULL;
25802         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25803         for (size_t w = 0; w < _res_constr.datalen; w++) {
25804                 int64_t _res_conv_22 = _res_vals[w];
25805                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
25806                 CHECK_ACCESS(_res_conv_22_ptr);
25807                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
25808                 FREE(untag_ptr(_res_conv_22));
25809                 _res_constr.data[w] = _res_conv_22_conv;
25810         }
25811         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25812         CVec_RecentPaymentDetailsZ_free(_res_constr);
25813 }
25814
25815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
25816         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25817         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
25818         return tag_ptr(ret_conv, true);
25819 }
25820
25821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25822         void* e_ptr = untag_ptr(e);
25823         CHECK_ACCESS(e_ptr);
25824         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25825         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25826         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25827         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
25828         return tag_ptr(ret_conv, true);
25829 }
25830
25831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25832         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
25833         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
25834         return ret_conv;
25835 }
25836
25837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25838         if (!ptr_is_owned(_res)) return;
25839         void* _res_ptr = untag_ptr(_res);
25840         CHECK_ACCESS(_res_ptr);
25841         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
25842         FREE(untag_ptr(_res));
25843         CResult_NonePaymentSendFailureZ_free(_res_conv);
25844 }
25845
25846 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
25847         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25848         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
25849         return tag_ptr(ret_conv, true);
25850 }
25851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25852         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
25853         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
25854         return ret_conv;
25855 }
25856
25857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25858         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
25859         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25860         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
25861         return tag_ptr(ret_conv, true);
25862 }
25863
25864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
25865         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25866         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
25867         return tag_ptr(ret_conv, true);
25868 }
25869
25870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
25871         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
25872         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25873         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
25874         return tag_ptr(ret_conv, true);
25875 }
25876
25877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25878         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
25879         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
25880         return ret_conv;
25881 }
25882
25883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25884         if (!ptr_is_owned(_res)) return;
25885         void* _res_ptr = untag_ptr(_res);
25886         CHECK_ACCESS(_res_ptr);
25887         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
25888         FREE(untag_ptr(_res));
25889         CResult_NoneRetryableSendFailureZ_free(_res_conv);
25890 }
25891
25892 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
25893         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25894         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
25895         return tag_ptr(ret_conv, true);
25896 }
25897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25898         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
25899         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
25900         return ret_conv;
25901 }
25902
25903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25904         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
25905         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
25906         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
25907         return tag_ptr(ret_conv, true);
25908 }
25909
25910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25911         LDKThirtyTwoBytes o_ref;
25912         CHECK((*env)->GetArrayLength(env, o) == 32);
25913         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25914         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25915         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
25916         return tag_ptr(ret_conv, true);
25917 }
25918
25919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25920         void* e_ptr = untag_ptr(e);
25921         CHECK_ACCESS(e_ptr);
25922         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
25923         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
25924         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25925         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
25926         return tag_ptr(ret_conv, true);
25927 }
25928
25929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25930         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
25931         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
25932         return ret_conv;
25933 }
25934
25935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25936         if (!ptr_is_owned(_res)) return;
25937         void* _res_ptr = untag_ptr(_res);
25938         CHECK_ACCESS(_res_ptr);
25939         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
25940         FREE(untag_ptr(_res));
25941         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
25942 }
25943
25944 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
25945         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25946         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
25947         return tag_ptr(ret_conv, true);
25948 }
25949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25950         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
25951         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
25952         return ret_conv;
25953 }
25954
25955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25956         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
25957         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
25958         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
25959         return tag_ptr(ret_conv, true);
25960 }
25961
25962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25963         LDKThirtyTwoBytes o_ref;
25964         CHECK((*env)->GetArrayLength(env, o) == 32);
25965         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
25966         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25967         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
25968         return tag_ptr(ret_conv, true);
25969 }
25970
25971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
25972         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
25973         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25974         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
25975         return tag_ptr(ret_conv, true);
25976 }
25977
25978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25979         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
25980         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
25981         return ret_conv;
25982 }
25983
25984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25985         if (!ptr_is_owned(_res)) return;
25986         void* _res_ptr = untag_ptr(_res);
25987         CHECK_ACCESS(_res_ptr);
25988         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
25989         FREE(untag_ptr(_res));
25990         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
25991 }
25992
25993 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
25994         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
25995         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
25996         return tag_ptr(ret_conv, true);
25997 }
25998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25999         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
26000         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
26001         return ret_conv;
26002 }
26003
26004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26005         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
26006         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
26007         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
26008         return tag_ptr(ret_conv, true);
26009 }
26010
26011 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
26012         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
26013         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
26014         return tag_ptr(ret_conv, true);
26015 }
26016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26017         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
26018         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
26019         return ret_conv;
26020 }
26021
26022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26023         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
26024         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
26025         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
26026         return tag_ptr(ret_conv, true);
26027 }
26028
26029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
26030         LDKThirtyTwoBytes a_ref;
26031         CHECK((*env)->GetArrayLength(env, a) == 32);
26032         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26033         LDKThirtyTwoBytes b_ref;
26034         CHECK((*env)->GetArrayLength(env, b) == 32);
26035         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
26036         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
26037         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
26038         return tag_ptr(ret_conv, true);
26039 }
26040
26041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_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         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
26046         FREE(untag_ptr(_res));
26047         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
26048 }
26049
26050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26051         void* o_ptr = untag_ptr(o);
26052         CHECK_ACCESS(o_ptr);
26053         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
26054         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
26055         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
26056         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
26057         return tag_ptr(ret_conv, true);
26058 }
26059
26060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26061         void* e_ptr = untag_ptr(e);
26062         CHECK_ACCESS(e_ptr);
26063         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
26064         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
26065         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
26066         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
26067         return tag_ptr(ret_conv, true);
26068 }
26069
26070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26071         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
26072         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
26073         return ret_conv;
26074 }
26075
26076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26077         if (!ptr_is_owned(_res)) return;
26078         void* _res_ptr = untag_ptr(_res);
26079         CHECK_ACCESS(_res_ptr);
26080         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
26081         FREE(untag_ptr(_res));
26082         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
26083 }
26084
26085 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
26086         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
26087         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
26088         return tag_ptr(ret_conv, true);
26089 }
26090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26091         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
26092         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
26093         return ret_conv;
26094 }
26095
26096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26097         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
26098         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
26099         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
26100         return tag_ptr(ret_conv, true);
26101 }
26102
26103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26104         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
26105         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26106         if (_res_constr.datalen > 0)
26107                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
26108         else
26109                 _res_constr.data = NULL;
26110         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26111         for (size_t o = 0; o < _res_constr.datalen; o++) {
26112                 int64_t _res_conv_40 = _res_vals[o];
26113                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26114                 CHECK_ACCESS(_res_conv_40_ptr);
26115                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
26116                 FREE(untag_ptr(_res_conv_40));
26117                 _res_constr.data[o] = _res_conv_40_conv;
26118         }
26119         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26120         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
26121 }
26122
26123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
26124         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
26125         o_constr.datalen = (*env)->GetArrayLength(env, o);
26126         if (o_constr.datalen > 0)
26127                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
26128         else
26129                 o_constr.data = NULL;
26130         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26131         for (size_t o = 0; o < o_constr.datalen; o++) {
26132                 int64_t o_conv_40 = o_vals[o];
26133                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
26134                 CHECK_ACCESS(o_conv_40_ptr);
26135                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
26136                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
26137                 o_constr.data[o] = o_conv_40_conv;
26138         }
26139         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26140         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
26141         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
26142         return tag_ptr(ret_conv, true);
26143 }
26144
26145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26146         void* e_ptr = untag_ptr(e);
26147         CHECK_ACCESS(e_ptr);
26148         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
26149         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
26150         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
26151         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
26152         return tag_ptr(ret_conv, true);
26153 }
26154
26155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26156         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
26157         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
26158         return ret_conv;
26159 }
26160
26161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26162         if (!ptr_is_owned(_res)) return;
26163         void* _res_ptr = untag_ptr(_res);
26164         CHECK_ACCESS(_res_ptr);
26165         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
26166         FREE(untag_ptr(_res));
26167         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
26168 }
26169
26170 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
26171         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
26172         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
26173         return tag_ptr(ret_conv, true);
26174 }
26175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26176         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
26177         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
26178         return ret_conv;
26179 }
26180
26181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26182         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
26183         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
26184         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
26185         return tag_ptr(ret_conv, true);
26186 }
26187
26188 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
26189         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
26190         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
26191         return tag_ptr(ret_conv, true);
26192 }
26193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26194         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
26195         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
26196         return ret_conv;
26197 }
26198
26199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26200         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
26201         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
26202         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
26203         return tag_ptr(ret_conv, true);
26204 }
26205
26206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
26207         LDKThirtyTwoBytes a_ref;
26208         CHECK((*env)->GetArrayLength(env, a) == 32);
26209         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26210         LDKPublicKey b_ref;
26211         CHECK((*env)->GetArrayLength(env, b) == 33);
26212         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
26213         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
26214         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
26215         return tag_ptr(ret_conv, true);
26216 }
26217
26218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26219         if (!ptr_is_owned(_res)) return;
26220         void* _res_ptr = untag_ptr(_res);
26221         CHECK_ACCESS(_res_ptr);
26222         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
26223         FREE(untag_ptr(_res));
26224         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
26225 }
26226
26227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26228         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
26229         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26230         if (_res_constr.datalen > 0)
26231                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
26232         else
26233                 _res_constr.data = NULL;
26234         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26235         for (size_t j = 0; j < _res_constr.datalen; j++) {
26236                 int64_t _res_conv_35 = _res_vals[j];
26237                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
26238                 CHECK_ACCESS(_res_conv_35_ptr);
26239                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
26240                 FREE(untag_ptr(_res_conv_35));
26241                 _res_constr.data[j] = _res_conv_35_conv;
26242         }
26243         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26244         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
26245 }
26246
26247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some(JNIEnv *env, jclass clz, jstring o) {
26248         LDKStr o_conv = java_to_owned_str(env, o);
26249         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
26250         *ret_copy = COption_StrZ_some(o_conv);
26251         int64_t ret_ref = tag_ptr(ret_copy, true);
26252         return ret_ref;
26253 }
26254
26255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none(JNIEnv *env, jclass clz) {
26256         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
26257         *ret_copy = COption_StrZ_none();
26258         int64_t ret_ref = tag_ptr(ret_copy, true);
26259         return ret_ref;
26260 }
26261
26262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26263         if (!ptr_is_owned(_res)) return;
26264         void* _res_ptr = untag_ptr(_res);
26265         CHECK_ACCESS(_res_ptr);
26266         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
26267         FREE(untag_ptr(_res));
26268         COption_StrZ_free(_res_conv);
26269 }
26270
26271 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
26272         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
26273         *ret_copy = COption_StrZ_clone(arg);
26274         int64_t ret_ref = tag_ptr(ret_copy, true);
26275         return ret_ref;
26276 }
26277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26278         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
26279         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
26280         return ret_conv;
26281 }
26282
26283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26284         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
26285         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
26286         *ret_copy = COption_StrZ_clone(orig_conv);
26287         int64_t ret_ref = tag_ptr(ret_copy, true);
26288         return ret_ref;
26289 }
26290
26291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
26292         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
26293         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
26294         return tag_ptr(ret_conv, true);
26295 }
26296
26297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
26298         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
26299         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
26300         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
26301         return tag_ptr(ret_conv, true);
26302 }
26303
26304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26305         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
26306         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
26307         return ret_conv;
26308 }
26309
26310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26311         if (!ptr_is_owned(_res)) return;
26312         void* _res_ptr = untag_ptr(_res);
26313         CHECK_ACCESS(_res_ptr);
26314         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
26315         FREE(untag_ptr(_res));
26316         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
26317 }
26318
26319 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
26320         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
26321         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
26322         return tag_ptr(ret_conv, true);
26323 }
26324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26325         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
26326         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
26327         return ret_conv;
26328 }
26329
26330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26331         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
26332         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
26333         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
26334         return tag_ptr(ret_conv, true);
26335 }
26336
26337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26338         void* o_ptr = untag_ptr(o);
26339         CHECK_ACCESS(o_ptr);
26340         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
26341         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
26342         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
26343         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
26344         return tag_ptr(ret_conv, true);
26345 }
26346
26347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
26348         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
26349         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
26350         return tag_ptr(ret_conv, true);
26351 }
26352
26353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26354         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
26355         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
26356         return ret_conv;
26357 }
26358
26359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26360         if (!ptr_is_owned(_res)) return;
26361         void* _res_ptr = untag_ptr(_res);
26362         CHECK_ACCESS(_res_ptr);
26363         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
26364         FREE(untag_ptr(_res));
26365         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
26366 }
26367
26368 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
26369         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
26370         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
26371         return tag_ptr(ret_conv, true);
26372 }
26373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26374         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
26375         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
26376         return ret_conv;
26377 }
26378
26379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26380         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
26381         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
26382         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
26383         return tag_ptr(ret_conv, true);
26384 }
26385
26386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26387         void* o_ptr = untag_ptr(o);
26388         CHECK_ACCESS(o_ptr);
26389         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
26390         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
26391         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26392         *ret_copy = COption_OffersMessageZ_some(o_conv);
26393         int64_t ret_ref = tag_ptr(ret_copy, true);
26394         return ret_ref;
26395 }
26396
26397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
26398         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26399         *ret_copy = COption_OffersMessageZ_none();
26400         int64_t ret_ref = tag_ptr(ret_copy, true);
26401         return ret_ref;
26402 }
26403
26404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26405         if (!ptr_is_owned(_res)) return;
26406         void* _res_ptr = untag_ptr(_res);
26407         CHECK_ACCESS(_res_ptr);
26408         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
26409         FREE(untag_ptr(_res));
26410         COption_OffersMessageZ_free(_res_conv);
26411 }
26412
26413 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
26414         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26415         *ret_copy = COption_OffersMessageZ_clone(arg);
26416         int64_t ret_ref = tag_ptr(ret_copy, true);
26417         return ret_ref;
26418 }
26419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26420         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
26421         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
26422         return ret_conv;
26423 }
26424
26425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26426         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
26427         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26428         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
26429         int64_t ret_ref = tag_ptr(ret_copy, true);
26430         return ret_ref;
26431 }
26432
26433 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
26434         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
26435         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
26436         return tag_ptr(ret_conv, true);
26437 }
26438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26439         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
26440         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
26441         return ret_conv;
26442 }
26443
26444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26445         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
26446         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
26447         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
26448         return tag_ptr(ret_conv, true);
26449 }
26450
26451 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) {
26452         void* a_ptr = untag_ptr(a);
26453         CHECK_ACCESS(a_ptr);
26454         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
26455         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
26456         void* b_ptr = untag_ptr(b);
26457         CHECK_ACCESS(b_ptr);
26458         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
26459         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
26460         LDKBlindedPath c_conv;
26461         c_conv.inner = untag_ptr(c);
26462         c_conv.is_owned = ptr_is_owned(c);
26463         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26464         c_conv = BlindedPath_clone(&c_conv);
26465         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
26466         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
26467         return tag_ptr(ret_conv, true);
26468 }
26469
26470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26471         if (!ptr_is_owned(_res)) return;
26472         void* _res_ptr = untag_ptr(_res);
26473         CHECK_ACCESS(_res_ptr);
26474         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
26475         FREE(untag_ptr(_res));
26476         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
26477 }
26478
26479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26480         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
26481         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26482         if (_res_constr.datalen > 0)
26483                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
26484         else
26485                 _res_constr.data = NULL;
26486         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26487         for (size_t x = 0; x < _res_constr.datalen; x++) {
26488                 int64_t _res_conv_49 = _res_vals[x];
26489                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
26490                 CHECK_ACCESS(_res_conv_49_ptr);
26491                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
26492                 FREE(untag_ptr(_res_conv_49));
26493                 _res_constr.data[x] = _res_conv_49_conv;
26494         }
26495         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26496         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
26497 }
26498
26499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26500         LDKCounterpartyForwardingInfo o_conv;
26501         o_conv.inner = untag_ptr(o);
26502         o_conv.is_owned = ptr_is_owned(o);
26503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26504         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
26505         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26506         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
26507         return tag_ptr(ret_conv, true);
26508 }
26509
26510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26511         void* e_ptr = untag_ptr(e);
26512         CHECK_ACCESS(e_ptr);
26513         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26514         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26515         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26516         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
26517         return tag_ptr(ret_conv, true);
26518 }
26519
26520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26521         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
26522         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
26523         return ret_conv;
26524 }
26525
26526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26527         if (!ptr_is_owned(_res)) return;
26528         void* _res_ptr = untag_ptr(_res);
26529         CHECK_ACCESS(_res_ptr);
26530         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
26531         FREE(untag_ptr(_res));
26532         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
26533 }
26534
26535 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
26536         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26537         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
26538         return tag_ptr(ret_conv, true);
26539 }
26540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26541         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
26542         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
26543         return ret_conv;
26544 }
26545
26546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26547         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
26548         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
26549         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
26550         return tag_ptr(ret_conv, true);
26551 }
26552
26553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26554         LDKChannelCounterparty o_conv;
26555         o_conv.inner = untag_ptr(o);
26556         o_conv.is_owned = ptr_is_owned(o);
26557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26558         o_conv = ChannelCounterparty_clone(&o_conv);
26559         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26560         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
26561         return tag_ptr(ret_conv, true);
26562 }
26563
26564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26565         void* e_ptr = untag_ptr(e);
26566         CHECK_ACCESS(e_ptr);
26567         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26568         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26569         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26570         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
26571         return tag_ptr(ret_conv, true);
26572 }
26573
26574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26575         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
26576         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
26577         return ret_conv;
26578 }
26579
26580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26581         if (!ptr_is_owned(_res)) return;
26582         void* _res_ptr = untag_ptr(_res);
26583         CHECK_ACCESS(_res_ptr);
26584         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
26585         FREE(untag_ptr(_res));
26586         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
26587 }
26588
26589 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
26590         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26591         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
26592         return tag_ptr(ret_conv, true);
26593 }
26594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26595         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
26596         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
26597         return ret_conv;
26598 }
26599
26600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26601         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
26602         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
26603         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
26604         return tag_ptr(ret_conv, true);
26605 }
26606
26607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26608         LDKChannelDetails o_conv;
26609         o_conv.inner = untag_ptr(o);
26610         o_conv.is_owned = ptr_is_owned(o);
26611         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26612         o_conv = ChannelDetails_clone(&o_conv);
26613         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26614         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
26615         return tag_ptr(ret_conv, true);
26616 }
26617
26618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26619         void* e_ptr = untag_ptr(e);
26620         CHECK_ACCESS(e_ptr);
26621         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26622         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26623         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26624         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
26625         return tag_ptr(ret_conv, true);
26626 }
26627
26628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26629         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
26630         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
26631         return ret_conv;
26632 }
26633
26634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26635         if (!ptr_is_owned(_res)) return;
26636         void* _res_ptr = untag_ptr(_res);
26637         CHECK_ACCESS(_res_ptr);
26638         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
26639         FREE(untag_ptr(_res));
26640         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
26641 }
26642
26643 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
26644         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26645         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
26646         return tag_ptr(ret_conv, true);
26647 }
26648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26649         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
26650         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
26651         return ret_conv;
26652 }
26653
26654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26655         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
26656         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
26657         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
26658         return tag_ptr(ret_conv, true);
26659 }
26660
26661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26662         LDKPhantomRouteHints o_conv;
26663         o_conv.inner = untag_ptr(o);
26664         o_conv.is_owned = ptr_is_owned(o);
26665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26666         o_conv = PhantomRouteHints_clone(&o_conv);
26667         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26668         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
26669         return tag_ptr(ret_conv, true);
26670 }
26671
26672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26673         void* e_ptr = untag_ptr(e);
26674         CHECK_ACCESS(e_ptr);
26675         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26676         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26677         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26678         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
26679         return tag_ptr(ret_conv, true);
26680 }
26681
26682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26683         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
26684         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
26685         return ret_conv;
26686 }
26687
26688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26689         if (!ptr_is_owned(_res)) return;
26690         void* _res_ptr = untag_ptr(_res);
26691         CHECK_ACCESS(_res_ptr);
26692         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
26693         FREE(untag_ptr(_res));
26694         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
26695 }
26696
26697 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
26698         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26699         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
26700         return tag_ptr(ret_conv, true);
26701 }
26702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26703         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
26704         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
26705         return ret_conv;
26706 }
26707
26708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26709         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
26710         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
26711         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
26712         return tag_ptr(ret_conv, true);
26713 }
26714
26715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
26716         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
26717         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26718         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
26719         return tag_ptr(ret_conv, true);
26720 }
26721
26722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26723         void* e_ptr = untag_ptr(e);
26724         CHECK_ACCESS(e_ptr);
26725         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26726         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26727         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26728         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
26729         return tag_ptr(ret_conv, true);
26730 }
26731
26732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26733         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
26734         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
26735         return ret_conv;
26736 }
26737
26738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26739         if (!ptr_is_owned(_res)) return;
26740         void* _res_ptr = untag_ptr(_res);
26741         CHECK_ACCESS(_res_ptr);
26742         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
26743         FREE(untag_ptr(_res));
26744         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
26745 }
26746
26747 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
26748         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26749         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
26750         return tag_ptr(ret_conv, true);
26751 }
26752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26753         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
26754         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
26755         return ret_conv;
26756 }
26757
26758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26759         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
26760         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
26761         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
26762         return tag_ptr(ret_conv, true);
26763 }
26764
26765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26766         LDKCVec_ChannelMonitorZ _res_constr;
26767         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26768         if (_res_constr.datalen > 0)
26769                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
26770         else
26771                 _res_constr.data = NULL;
26772         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26773         for (size_t q = 0; q < _res_constr.datalen; q++) {
26774                 int64_t _res_conv_16 = _res_vals[q];
26775                 LDKChannelMonitor _res_conv_16_conv;
26776                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26777                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26778                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26779                 _res_constr.data[q] = _res_conv_16_conv;
26780         }
26781         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26782         CVec_ChannelMonitorZ_free(_res_constr);
26783 }
26784
26785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
26786         LDKThirtyTwoBytes a_ref;
26787         CHECK((*env)->GetArrayLength(env, a) == 32);
26788         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
26789         LDKChannelManager b_conv;
26790         b_conv.inner = untag_ptr(b);
26791         b_conv.is_owned = ptr_is_owned(b);
26792         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26793         // WARNING: we need a move here but no clone is available for LDKChannelManager
26794         
26795         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
26796         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
26797         return tag_ptr(ret_conv, true);
26798 }
26799
26800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26801         if (!ptr_is_owned(_res)) return;
26802         void* _res_ptr = untag_ptr(_res);
26803         CHECK_ACCESS(_res_ptr);
26804         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
26805         FREE(untag_ptr(_res));
26806         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
26807 }
26808
26809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26810         void* o_ptr = untag_ptr(o);
26811         CHECK_ACCESS(o_ptr);
26812         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
26813         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
26814         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
26815         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
26816         return tag_ptr(ret_conv, true);
26817 }
26818
26819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26820         void* e_ptr = untag_ptr(e);
26821         CHECK_ACCESS(e_ptr);
26822         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26823         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26824         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
26825         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
26826         return tag_ptr(ret_conv, true);
26827 }
26828
26829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26830         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
26831         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
26832         return ret_conv;
26833 }
26834
26835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26836         if (!ptr_is_owned(_res)) return;
26837         void* _res_ptr = untag_ptr(_res);
26838         CHECK_ACCESS(_res_ptr);
26839         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
26840         FREE(untag_ptr(_res));
26841         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
26842 }
26843
26844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26845         void* o_ptr = untag_ptr(o);
26846         CHECK_ACCESS(o_ptr);
26847         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
26848         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
26849         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26850         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
26851         return tag_ptr(ret_conv, true);
26852 }
26853
26854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26855         void* e_ptr = untag_ptr(e);
26856         CHECK_ACCESS(e_ptr);
26857         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26858         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26859         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26860         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
26861         return tag_ptr(ret_conv, true);
26862 }
26863
26864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26865         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
26866         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
26867         return ret_conv;
26868 }
26869
26870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26871         if (!ptr_is_owned(_res)) return;
26872         void* _res_ptr = untag_ptr(_res);
26873         CHECK_ACCESS(_res_ptr);
26874         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
26875         FREE(untag_ptr(_res));
26876         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
26877 }
26878
26879 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
26880         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26881         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
26882         return tag_ptr(ret_conv, true);
26883 }
26884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26885         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
26886         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
26887         return ret_conv;
26888 }
26889
26890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26891         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
26892         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
26893         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
26894         return tag_ptr(ret_conv, true);
26895 }
26896
26897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26898         LDKChannelConfig o_conv;
26899         o_conv.inner = untag_ptr(o);
26900         o_conv.is_owned = ptr_is_owned(o);
26901         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26902         o_conv = ChannelConfig_clone(&o_conv);
26903         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26904         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
26905         return tag_ptr(ret_conv, true);
26906 }
26907
26908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26909         void* e_ptr = untag_ptr(e);
26910         CHECK_ACCESS(e_ptr);
26911         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26912         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26913         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26914         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
26915         return tag_ptr(ret_conv, true);
26916 }
26917
26918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26919         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
26920         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
26921         return ret_conv;
26922 }
26923
26924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26925         if (!ptr_is_owned(_res)) return;
26926         void* _res_ptr = untag_ptr(_res);
26927         CHECK_ACCESS(_res_ptr);
26928         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
26929         FREE(untag_ptr(_res));
26930         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
26931 }
26932
26933 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
26934         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26935         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
26936         return tag_ptr(ret_conv, true);
26937 }
26938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26939         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
26940         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
26941         return ret_conv;
26942 }
26943
26944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26945         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
26946         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26947         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
26948         return tag_ptr(ret_conv, true);
26949 }
26950
26951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26952         void* o_ptr = untag_ptr(o);
26953         CHECK_ACCESS(o_ptr);
26954         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
26955         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
26956         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26957         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
26958         int64_t ret_ref = tag_ptr(ret_copy, true);
26959         return ret_ref;
26960 }
26961
26962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
26963         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26964         *ret_copy = COption_MaxDustHTLCExposureZ_none();
26965         int64_t ret_ref = tag_ptr(ret_copy, true);
26966         return ret_ref;
26967 }
26968
26969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26970         if (!ptr_is_owned(_res)) return;
26971         void* _res_ptr = untag_ptr(_res);
26972         CHECK_ACCESS(_res_ptr);
26973         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
26974         FREE(untag_ptr(_res));
26975         COption_MaxDustHTLCExposureZ_free(_res_conv);
26976 }
26977
26978 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
26979         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26980         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
26981         int64_t ret_ref = tag_ptr(ret_copy, true);
26982         return ret_ref;
26983 }
26984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26985         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
26986         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
26987         return ret_conv;
26988 }
26989
26990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26991         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
26992         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
26993         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
26994         int64_t ret_ref = tag_ptr(ret_copy, true);
26995         return ret_ref;
26996 }
26997
26998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26999         void* o_ptr = untag_ptr(o);
27000         CHECK_ACCESS(o_ptr);
27001         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
27002         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
27003         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
27004         *ret_copy = COption_APIErrorZ_some(o_conv);
27005         int64_t ret_ref = tag_ptr(ret_copy, true);
27006         return ret_ref;
27007 }
27008
27009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
27010         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
27011         *ret_copy = COption_APIErrorZ_none();
27012         int64_t ret_ref = tag_ptr(ret_copy, true);
27013         return ret_ref;
27014 }
27015
27016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27017         if (!ptr_is_owned(_res)) return;
27018         void* _res_ptr = untag_ptr(_res);
27019         CHECK_ACCESS(_res_ptr);
27020         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
27021         FREE(untag_ptr(_res));
27022         COption_APIErrorZ_free(_res_conv);
27023 }
27024
27025 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
27026         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
27027         *ret_copy = COption_APIErrorZ_clone(arg);
27028         int64_t ret_ref = tag_ptr(ret_copy, true);
27029         return ret_ref;
27030 }
27031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27032         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
27033         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
27034         return ret_conv;
27035 }
27036
27037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27038         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
27039         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
27040         *ret_copy = COption_APIErrorZ_clone(orig_conv);
27041         int64_t ret_ref = tag_ptr(ret_copy, true);
27042         return ret_ref;
27043 }
27044
27045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27046         void* o_ptr = untag_ptr(o);
27047         CHECK_ACCESS(o_ptr);
27048         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
27049         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
27050         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27051         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
27052         return tag_ptr(ret_conv, true);
27053 }
27054
27055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27056         void* e_ptr = untag_ptr(e);
27057         CHECK_ACCESS(e_ptr);
27058         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27059         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27060         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27061         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
27062         return tag_ptr(ret_conv, true);
27063 }
27064
27065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27066         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
27067         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
27068         return ret_conv;
27069 }
27070
27071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27072         if (!ptr_is_owned(_res)) return;
27073         void* _res_ptr = untag_ptr(_res);
27074         CHECK_ACCESS(_res_ptr);
27075         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
27076         FREE(untag_ptr(_res));
27077         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
27078 }
27079
27080 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
27081         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27082         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
27083         return tag_ptr(ret_conv, true);
27084 }
27085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27086         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
27087         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
27088         return ret_conv;
27089 }
27090
27091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27092         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
27093         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27094         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
27095         return tag_ptr(ret_conv, true);
27096 }
27097
27098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27099         LDKChannelMonitorUpdate o_conv;
27100         o_conv.inner = untag_ptr(o);
27101         o_conv.is_owned = ptr_is_owned(o);
27102         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27103         o_conv = ChannelMonitorUpdate_clone(&o_conv);
27104         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27105         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
27106         return tag_ptr(ret_conv, true);
27107 }
27108
27109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27110         void* e_ptr = untag_ptr(e);
27111         CHECK_ACCESS(e_ptr);
27112         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27113         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27114         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27115         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
27116         return tag_ptr(ret_conv, true);
27117 }
27118
27119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27120         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
27121         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
27122         return ret_conv;
27123 }
27124
27125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27126         if (!ptr_is_owned(_res)) return;
27127         void* _res_ptr = untag_ptr(_res);
27128         CHECK_ACCESS(_res_ptr);
27129         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
27130         FREE(untag_ptr(_res));
27131         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
27132 }
27133
27134 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
27135         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27136         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
27137         return tag_ptr(ret_conv, true);
27138 }
27139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27140         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
27141         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
27142         return ret_conv;
27143 }
27144
27145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27146         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
27147         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27148         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
27149         return tag_ptr(ret_conv, true);
27150 }
27151
27152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27153         void* o_ptr = untag_ptr(o);
27154         CHECK_ACCESS(o_ptr);
27155         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
27156         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
27157         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
27158         *ret_copy = COption_MonitorEventZ_some(o_conv);
27159         int64_t ret_ref = tag_ptr(ret_copy, true);
27160         return ret_ref;
27161 }
27162
27163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
27164         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
27165         *ret_copy = COption_MonitorEventZ_none();
27166         int64_t ret_ref = tag_ptr(ret_copy, true);
27167         return ret_ref;
27168 }
27169
27170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27171         if (!ptr_is_owned(_res)) return;
27172         void* _res_ptr = untag_ptr(_res);
27173         CHECK_ACCESS(_res_ptr);
27174         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
27175         FREE(untag_ptr(_res));
27176         COption_MonitorEventZ_free(_res_conv);
27177 }
27178
27179 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
27180         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
27181         *ret_copy = COption_MonitorEventZ_clone(arg);
27182         int64_t ret_ref = tag_ptr(ret_copy, true);
27183         return ret_ref;
27184 }
27185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27186         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
27187         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
27188         return ret_conv;
27189 }
27190
27191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27192         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
27193         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
27194         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
27195         int64_t ret_ref = tag_ptr(ret_copy, true);
27196         return ret_ref;
27197 }
27198
27199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27200         void* o_ptr = untag_ptr(o);
27201         CHECK_ACCESS(o_ptr);
27202         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
27203         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
27204         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27205         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
27206         return tag_ptr(ret_conv, true);
27207 }
27208
27209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27210         void* e_ptr = untag_ptr(e);
27211         CHECK_ACCESS(e_ptr);
27212         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27213         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27214         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27215         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
27216         return tag_ptr(ret_conv, true);
27217 }
27218
27219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27220         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
27221         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
27222         return ret_conv;
27223 }
27224
27225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27226         if (!ptr_is_owned(_res)) return;
27227         void* _res_ptr = untag_ptr(_res);
27228         CHECK_ACCESS(_res_ptr);
27229         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
27230         FREE(untag_ptr(_res));
27231         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
27232 }
27233
27234 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
27235         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27236         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
27237         return tag_ptr(ret_conv, true);
27238 }
27239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27240         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
27241         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
27242         return ret_conv;
27243 }
27244
27245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27246         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
27247         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27248         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
27249         return tag_ptr(ret_conv, true);
27250 }
27251
27252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27253         LDKHTLCUpdate o_conv;
27254         o_conv.inner = untag_ptr(o);
27255         o_conv.is_owned = ptr_is_owned(o);
27256         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27257         o_conv = HTLCUpdate_clone(&o_conv);
27258         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27259         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
27260         return tag_ptr(ret_conv, true);
27261 }
27262
27263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27264         void* e_ptr = untag_ptr(e);
27265         CHECK_ACCESS(e_ptr);
27266         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27267         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27268         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27269         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
27270         return tag_ptr(ret_conv, true);
27271 }
27272
27273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27274         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
27275         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
27276         return ret_conv;
27277 }
27278
27279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27280         if (!ptr_is_owned(_res)) return;
27281         void* _res_ptr = untag_ptr(_res);
27282         CHECK_ACCESS(_res_ptr);
27283         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
27284         FREE(untag_ptr(_res));
27285         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
27286 }
27287
27288 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
27289         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27290         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
27291         return tag_ptr(ret_conv, true);
27292 }
27293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27294         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
27295         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
27296         return ret_conv;
27297 }
27298
27299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27300         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
27301         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27302         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
27303         return tag_ptr(ret_conv, true);
27304 }
27305
27306 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
27307         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
27308         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
27309         return tag_ptr(ret_conv, true);
27310 }
27311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27312         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
27313         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
27314         return ret_conv;
27315 }
27316
27317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27318         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
27319         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
27320         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
27321         return tag_ptr(ret_conv, true);
27322 }
27323
27324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
27325         LDKOutPoint a_conv;
27326         a_conv.inner = untag_ptr(a);
27327         a_conv.is_owned = ptr_is_owned(a);
27328         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27329         a_conv = OutPoint_clone(&a_conv);
27330         LDKCVec_u8Z b_ref;
27331         b_ref.datalen = (*env)->GetArrayLength(env, b);
27332         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
27333         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
27334         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
27335         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
27336         return tag_ptr(ret_conv, true);
27337 }
27338
27339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27340         if (!ptr_is_owned(_res)) return;
27341         void* _res_ptr = untag_ptr(_res);
27342         CHECK_ACCESS(_res_ptr);
27343         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
27344         FREE(untag_ptr(_res));
27345         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
27346 }
27347
27348 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
27349         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
27350         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
27351         return tag_ptr(ret_conv, true);
27352 }
27353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27354         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
27355         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
27356         return ret_conv;
27357 }
27358
27359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27360         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
27361         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
27362         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
27363         return tag_ptr(ret_conv, true);
27364 }
27365
27366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
27367         LDKCVec_u8Z b_ref;
27368         b_ref.datalen = (*env)->GetArrayLength(env, b);
27369         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
27370         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
27371         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
27372         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
27373         return tag_ptr(ret_conv, true);
27374 }
27375
27376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27377         if (!ptr_is_owned(_res)) return;
27378         void* _res_ptr = untag_ptr(_res);
27379         CHECK_ACCESS(_res_ptr);
27380         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
27381         FREE(untag_ptr(_res));
27382         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
27383 }
27384
27385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27386         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
27387         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27388         if (_res_constr.datalen > 0)
27389                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
27390         else
27391                 _res_constr.data = NULL;
27392         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27393         for (size_t x = 0; x < _res_constr.datalen; x++) {
27394                 int64_t _res_conv_23 = _res_vals[x];
27395                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
27396                 CHECK_ACCESS(_res_conv_23_ptr);
27397                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
27398                 FREE(untag_ptr(_res_conv_23));
27399                 _res_constr.data[x] = _res_conv_23_conv;
27400         }
27401         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27402         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
27403 }
27404
27405 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
27406         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
27407         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
27408         return tag_ptr(ret_conv, true);
27409 }
27410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27411         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
27412         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
27413         return ret_conv;
27414 }
27415
27416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27417         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
27418         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
27419         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
27420         return tag_ptr(ret_conv, true);
27421 }
27422
27423 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) {
27424         LDKThirtyTwoBytes a_ref;
27425         CHECK((*env)->GetArrayLength(env, a) == 32);
27426         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27427         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
27428         b_constr.datalen = (*env)->GetArrayLength(env, b);
27429         if (b_constr.datalen > 0)
27430                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
27431         else
27432                 b_constr.data = NULL;
27433         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
27434         for (size_t x = 0; x < b_constr.datalen; x++) {
27435                 int64_t b_conv_23 = b_vals[x];
27436                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
27437                 CHECK_ACCESS(b_conv_23_ptr);
27438                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
27439                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
27440                 b_constr.data[x] = b_conv_23_conv;
27441         }
27442         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
27443         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
27444         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
27445         return tag_ptr(ret_conv, true);
27446 }
27447
27448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27449         if (!ptr_is_owned(_res)) return;
27450         void* _res_ptr = untag_ptr(_res);
27451         CHECK_ACCESS(_res_ptr);
27452         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
27453         FREE(untag_ptr(_res));
27454         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
27455 }
27456
27457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27458         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
27459         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27460         if (_res_constr.datalen > 0)
27461                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
27462         else
27463                 _res_constr.data = NULL;
27464         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27465         for (size_t a = 0; a < _res_constr.datalen; a++) {
27466                 int64_t _res_conv_52 = _res_vals[a];
27467                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
27468                 CHECK_ACCESS(_res_conv_52_ptr);
27469                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
27470                 FREE(untag_ptr(_res_conv_52));
27471                 _res_constr.data[a] = _res_conv_52_conv;
27472         }
27473         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27474         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
27475 }
27476
27477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27478         LDKCVec_CommitmentTransactionZ _res_constr;
27479         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27480         if (_res_constr.datalen > 0)
27481                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
27482         else
27483                 _res_constr.data = NULL;
27484         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27485         for (size_t x = 0; x < _res_constr.datalen; x++) {
27486                 int64_t _res_conv_23 = _res_vals[x];
27487                 LDKCommitmentTransaction _res_conv_23_conv;
27488                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
27489                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
27490                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
27491                 _res_constr.data[x] = _res_conv_23_conv;
27492         }
27493         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27494         CVec_CommitmentTransactionZ_free(_res_constr);
27495 }
27496
27497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
27498         LDKCVec_TransactionZ _res_constr;
27499         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27500         if (_res_constr.datalen > 0)
27501                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
27502         else
27503                 _res_constr.data = NULL;
27504         for (size_t i = 0; i < _res_constr.datalen; i++) {
27505                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
27506                 LDKTransaction _res_conv_8_ref;
27507                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
27508                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
27509                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
27510                 _res_conv_8_ref.data_is_owned = true;
27511                 _res_constr.data[i] = _res_conv_8_ref;
27512         }
27513         CVec_TransactionZ_free(_res_constr);
27514 }
27515
27516 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
27517         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27518         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
27519         return tag_ptr(ret_conv, true);
27520 }
27521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27522         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
27523         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
27524         return ret_conv;
27525 }
27526
27527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27528         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
27529         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27530         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
27531         return tag_ptr(ret_conv, true);
27532 }
27533
27534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
27535         void* b_ptr = untag_ptr(b);
27536         CHECK_ACCESS(b_ptr);
27537         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
27538         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
27539         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
27540         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
27541         return tag_ptr(ret_conv, true);
27542 }
27543
27544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27545         if (!ptr_is_owned(_res)) return;
27546         void* _res_ptr = untag_ptr(_res);
27547         CHECK_ACCESS(_res_ptr);
27548         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
27549         FREE(untag_ptr(_res));
27550         C2Tuple_u32TxOutZ_free(_res_conv);
27551 }
27552
27553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27554         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
27555         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27556         if (_res_constr.datalen > 0)
27557                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
27558         else
27559                 _res_constr.data = NULL;
27560         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27561         for (size_t u = 0; u < _res_constr.datalen; u++) {
27562                 int64_t _res_conv_20 = _res_vals[u];
27563                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
27564                 CHECK_ACCESS(_res_conv_20_ptr);
27565                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
27566                 FREE(untag_ptr(_res_conv_20));
27567                 _res_constr.data[u] = _res_conv_20_conv;
27568         }
27569         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27570         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
27571 }
27572
27573 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
27574         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27575         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
27576         return tag_ptr(ret_conv, true);
27577 }
27578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27579         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
27580         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
27581         return ret_conv;
27582 }
27583
27584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27585         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
27586         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27587         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
27588         return tag_ptr(ret_conv, true);
27589 }
27590
27591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
27592         LDKThirtyTwoBytes a_ref;
27593         CHECK((*env)->GetArrayLength(env, a) == 32);
27594         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27595         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
27596         b_constr.datalen = (*env)->GetArrayLength(env, b);
27597         if (b_constr.datalen > 0)
27598                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
27599         else
27600                 b_constr.data = NULL;
27601         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
27602         for (size_t u = 0; u < b_constr.datalen; u++) {
27603                 int64_t b_conv_20 = b_vals[u];
27604                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
27605                 CHECK_ACCESS(b_conv_20_ptr);
27606                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
27607                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
27608                 b_constr.data[u] = b_conv_20_conv;
27609         }
27610         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
27611         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
27612         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
27613         return tag_ptr(ret_conv, true);
27614 }
27615
27616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27617         if (!ptr_is_owned(_res)) return;
27618         void* _res_ptr = untag_ptr(_res);
27619         CHECK_ACCESS(_res_ptr);
27620         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
27621         FREE(untag_ptr(_res));
27622         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
27623 }
27624
27625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27626         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
27627         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27628         if (_res_constr.datalen > 0)
27629                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
27630         else
27631                 _res_constr.data = NULL;
27632         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27633         for (size_t x = 0; x < _res_constr.datalen; x++) {
27634                 int64_t _res_conv_49 = _res_vals[x];
27635                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
27636                 CHECK_ACCESS(_res_conv_49_ptr);
27637                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
27638                 FREE(untag_ptr(_res_conv_49));
27639                 _res_constr.data[x] = _res_conv_49_conv;
27640         }
27641         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27642         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
27643 }
27644
27645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27646         LDKCVec_BalanceZ _res_constr;
27647         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27648         if (_res_constr.datalen > 0)
27649                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
27650         else
27651                 _res_constr.data = NULL;
27652         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27653         for (size_t j = 0; j < _res_constr.datalen; j++) {
27654                 int64_t _res_conv_9 = _res_vals[j];
27655                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
27656                 CHECK_ACCESS(_res_conv_9_ptr);
27657                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
27658                 FREE(untag_ptr(_res_conv_9));
27659                 _res_constr.data[j] = _res_conv_9_conv;
27660         }
27661         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27662         CVec_BalanceZ_free(_res_constr);
27663 }
27664
27665 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
27666         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27667         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
27668         return tag_ptr(ret_conv, true);
27669 }
27670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27671         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
27672         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
27673         return ret_conv;
27674 }
27675
27676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27677         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
27678         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27679         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
27680         return tag_ptr(ret_conv, true);
27681 }
27682
27683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27684         LDKThirtyTwoBytes a_ref;
27685         CHECK((*env)->GetArrayLength(env, a) == 32);
27686         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27687         LDKChannelMonitor b_conv;
27688         b_conv.inner = untag_ptr(b);
27689         b_conv.is_owned = ptr_is_owned(b);
27690         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27691         b_conv = ChannelMonitor_clone(&b_conv);
27692         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
27693         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
27694         return tag_ptr(ret_conv, true);
27695 }
27696
27697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27698         if (!ptr_is_owned(_res)) return;
27699         void* _res_ptr = untag_ptr(_res);
27700         CHECK_ACCESS(_res_ptr);
27701         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
27702         FREE(untag_ptr(_res));
27703         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
27704 }
27705
27706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27707         void* o_ptr = untag_ptr(o);
27708         CHECK_ACCESS(o_ptr);
27709         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27710         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27711         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27712         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
27713         return tag_ptr(ret_conv, true);
27714 }
27715
27716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27717         void* e_ptr = untag_ptr(e);
27718         CHECK_ACCESS(e_ptr);
27719         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27720         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27721         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27722         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
27723         return tag_ptr(ret_conv, true);
27724 }
27725
27726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27727         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
27728         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
27729         return ret_conv;
27730 }
27731
27732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27733         if (!ptr_is_owned(_res)) return;
27734         void* _res_ptr = untag_ptr(_res);
27735         CHECK_ACCESS(_res_ptr);
27736         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
27737         FREE(untag_ptr(_res));
27738         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
27739 }
27740
27741 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
27742         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27743         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
27744         return tag_ptr(ret_conv, true);
27745 }
27746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27747         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
27748         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
27749         return ret_conv;
27750 }
27751
27752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27753         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
27754         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
27755         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
27756         return tag_ptr(ret_conv, true);
27757 }
27758
27759 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
27760         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27761         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
27762         return tag_ptr(ret_conv, true);
27763 }
27764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27765         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
27766         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
27767         return ret_conv;
27768 }
27769
27770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27771         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
27772         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27773         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
27774         return tag_ptr(ret_conv, true);
27775 }
27776
27777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
27778         LDKPublicKey a_ref;
27779         CHECK((*env)->GetArrayLength(env, a) == 33);
27780         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
27781         void* b_ptr = untag_ptr(b);
27782         CHECK_ACCESS(b_ptr);
27783         LDKType b_conv = *(LDKType*)(b_ptr);
27784         if (b_conv.free == LDKType_JCalls_free) {
27785                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27786                 LDKType_JCalls_cloned(&b_conv);
27787         }
27788         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
27789         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
27790         return tag_ptr(ret_conv, true);
27791 }
27792
27793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27794         if (!ptr_is_owned(_res)) return;
27795         void* _res_ptr = untag_ptr(_res);
27796         CHECK_ACCESS(_res_ptr);
27797         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
27798         FREE(untag_ptr(_res));
27799         C2Tuple_PublicKeyTypeZ_free(_res_conv);
27800 }
27801
27802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27803         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
27804         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27805         if (_res_constr.datalen > 0)
27806                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
27807         else
27808                 _res_constr.data = NULL;
27809         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27810         for (size_t z = 0; z < _res_constr.datalen; z++) {
27811                 int64_t _res_conv_25 = _res_vals[z];
27812                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
27813                 CHECK_ACCESS(_res_conv_25_ptr);
27814                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
27815                 FREE(untag_ptr(_res_conv_25));
27816                 _res_constr.data[z] = _res_conv_25_conv;
27817         }
27818         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27819         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
27820 }
27821
27822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27823         void* o_ptr = untag_ptr(o);
27824         CHECK_ACCESS(o_ptr);
27825         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
27826         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
27827                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27828                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
27829         }
27830         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
27831         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
27832         int64_t ret_ref = tag_ptr(ret_copy, true);
27833         return ret_ref;
27834 }
27835
27836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
27837         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
27838         *ret_copy = COption_OnionMessageContentsZ_none();
27839         int64_t ret_ref = tag_ptr(ret_copy, true);
27840         return ret_ref;
27841 }
27842
27843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27844         if (!ptr_is_owned(_res)) return;
27845         void* _res_ptr = untag_ptr(_res);
27846         CHECK_ACCESS(_res_ptr);
27847         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
27848         FREE(untag_ptr(_res));
27849         COption_OnionMessageContentsZ_free(_res_conv);
27850 }
27851
27852 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
27853         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
27854         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
27855         int64_t ret_ref = tag_ptr(ret_copy, true);
27856         return ret_ref;
27857 }
27858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27859         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
27860         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
27861         return ret_conv;
27862 }
27863
27864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27865         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
27866         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
27867         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
27868         int64_t ret_ref = tag_ptr(ret_copy, true);
27869         return ret_ref;
27870 }
27871
27872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27873         void* o_ptr = untag_ptr(o);
27874         CHECK_ACCESS(o_ptr);
27875         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
27876         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
27877         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
27878         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
27879         return tag_ptr(ret_conv, true);
27880 }
27881
27882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27883         void* e_ptr = untag_ptr(e);
27884         CHECK_ACCESS(e_ptr);
27885         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27886         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27887         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
27888         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
27889         return tag_ptr(ret_conv, true);
27890 }
27891
27892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27893         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
27894         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
27895         return ret_conv;
27896 }
27897
27898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27899         if (!ptr_is_owned(_res)) return;
27900         void* _res_ptr = untag_ptr(_res);
27901         CHECK_ACCESS(_res_ptr);
27902         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
27903         FREE(untag_ptr(_res));
27904         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
27905 }
27906
27907 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
27908         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
27909         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
27910         return tag_ptr(ret_conv, true);
27911 }
27912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27913         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
27914         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
27915         return ret_conv;
27916 }
27917
27918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27919         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
27920         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
27921         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
27922         return tag_ptr(ret_conv, true);
27923 }
27924
27925 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
27926         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
27927         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
27928         return tag_ptr(ret_conv, true);
27929 }
27930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27931         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
27932         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
27933         return ret_conv;
27934 }
27935
27936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27937         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
27938         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
27939         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
27940         return tag_ptr(ret_conv, true);
27941 }
27942
27943 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) {
27944         void* a_ptr = untag_ptr(a);
27945         CHECK_ACCESS(a_ptr);
27946         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
27947         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
27948                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27949                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
27950         }
27951         void* b_ptr = untag_ptr(b);
27952         CHECK_ACCESS(b_ptr);
27953         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
27954         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
27955         LDKBlindedPath c_conv;
27956         c_conv.inner = untag_ptr(c);
27957         c_conv.is_owned = ptr_is_owned(c);
27958         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27959         c_conv = BlindedPath_clone(&c_conv);
27960         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
27961         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
27962         return tag_ptr(ret_conv, true);
27963 }
27964
27965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27966         if (!ptr_is_owned(_res)) return;
27967         void* _res_ptr = untag_ptr(_res);
27968         CHECK_ACCESS(_res_ptr);
27969         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
27970         FREE(untag_ptr(_res));
27971         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
27972 }
27973
27974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27975         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
27976         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27977         if (_res_constr.datalen > 0)
27978                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
27979         else
27980                 _res_constr.data = NULL;
27981         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27982         for (size_t e = 0; e < _res_constr.datalen; e++) {
27983                 int64_t _res_conv_56 = _res_vals[e];
27984                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
27985                 CHECK_ACCESS(_res_conv_56_ptr);
27986                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
27987                 FREE(untag_ptr(_res_conv_56));
27988                 _res_constr.data[e] = _res_conv_56_conv;
27989         }
27990         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27991         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
27992 }
27993
27994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27995         void* o_ptr = untag_ptr(o);
27996         CHECK_ACCESS(o_ptr);
27997         LDKType o_conv = *(LDKType*)(o_ptr);
27998         if (o_conv.free == LDKType_JCalls_free) {
27999                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28000                 LDKType_JCalls_cloned(&o_conv);
28001         }
28002         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
28003         *ret_copy = COption_TypeZ_some(o_conv);
28004         int64_t ret_ref = tag_ptr(ret_copy, true);
28005         return ret_ref;
28006 }
28007
28008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
28009         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
28010         *ret_copy = COption_TypeZ_none();
28011         int64_t ret_ref = tag_ptr(ret_copy, true);
28012         return ret_ref;
28013 }
28014
28015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28016         if (!ptr_is_owned(_res)) return;
28017         void* _res_ptr = untag_ptr(_res);
28018         CHECK_ACCESS(_res_ptr);
28019         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
28020         FREE(untag_ptr(_res));
28021         COption_TypeZ_free(_res_conv);
28022 }
28023
28024 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
28025         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
28026         *ret_copy = COption_TypeZ_clone(arg);
28027         int64_t ret_ref = tag_ptr(ret_copy, true);
28028         return ret_ref;
28029 }
28030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28031         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
28032         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
28033         return ret_conv;
28034 }
28035
28036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28037         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
28038         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
28039         *ret_copy = COption_TypeZ_clone(orig_conv);
28040         int64_t ret_ref = tag_ptr(ret_copy, true);
28041         return ret_ref;
28042 }
28043
28044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28045         void* o_ptr = untag_ptr(o);
28046         CHECK_ACCESS(o_ptr);
28047         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
28048         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
28049         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
28050         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
28051         return tag_ptr(ret_conv, true);
28052 }
28053
28054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28055         void* e_ptr = untag_ptr(e);
28056         CHECK_ACCESS(e_ptr);
28057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28059         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
28060         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
28061         return tag_ptr(ret_conv, true);
28062 }
28063
28064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28065         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
28066         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
28067         return ret_conv;
28068 }
28069
28070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28071         if (!ptr_is_owned(_res)) return;
28072         void* _res_ptr = untag_ptr(_res);
28073         CHECK_ACCESS(_res_ptr);
28074         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
28075         FREE(untag_ptr(_res));
28076         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
28077 }
28078
28079 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
28080         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
28081         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
28082         return tag_ptr(ret_conv, true);
28083 }
28084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28085         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
28086         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
28087         return ret_conv;
28088 }
28089
28090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28091         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
28092         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
28093         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
28094         return tag_ptr(ret_conv, true);
28095 }
28096
28097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28098         void* o_ptr = untag_ptr(o);
28099         CHECK_ACCESS(o_ptr);
28100         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28101         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28102         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
28103         *ret_copy = COption_SocketAddressZ_some(o_conv);
28104         int64_t ret_ref = tag_ptr(ret_copy, true);
28105         return ret_ref;
28106 }
28107
28108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
28109         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
28110         *ret_copy = COption_SocketAddressZ_none();
28111         int64_t ret_ref = tag_ptr(ret_copy, true);
28112         return ret_ref;
28113 }
28114
28115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28116         if (!ptr_is_owned(_res)) return;
28117         void* _res_ptr = untag_ptr(_res);
28118         CHECK_ACCESS(_res_ptr);
28119         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
28120         FREE(untag_ptr(_res));
28121         COption_SocketAddressZ_free(_res_conv);
28122 }
28123
28124 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
28125         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
28126         *ret_copy = COption_SocketAddressZ_clone(arg);
28127         int64_t ret_ref = tag_ptr(ret_copy, true);
28128         return ret_ref;
28129 }
28130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28131         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
28132         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
28133         return ret_conv;
28134 }
28135
28136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28137         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
28138         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
28139         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
28140         int64_t ret_ref = tag_ptr(ret_copy, true);
28141         return ret_ref;
28142 }
28143
28144 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
28145         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
28146         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
28147         return tag_ptr(ret_conv, true);
28148 }
28149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28150         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
28151         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
28152         return ret_conv;
28153 }
28154
28155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28156         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
28157         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
28158         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
28159         return tag_ptr(ret_conv, true);
28160 }
28161
28162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
28163         LDKPublicKey a_ref;
28164         CHECK((*env)->GetArrayLength(env, a) == 33);
28165         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
28166         void* b_ptr = untag_ptr(b);
28167         CHECK_ACCESS(b_ptr);
28168         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
28169         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
28170         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
28171         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
28172         return tag_ptr(ret_conv, true);
28173 }
28174
28175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28176         if (!ptr_is_owned(_res)) return;
28177         void* _res_ptr = untag_ptr(_res);
28178         CHECK_ACCESS(_res_ptr);
28179         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
28180         FREE(untag_ptr(_res));
28181         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
28182 }
28183
28184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28185         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
28186         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28187         if (_res_constr.datalen > 0)
28188                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
28189         else
28190                 _res_constr.data = NULL;
28191         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28192         for (size_t r = 0; r < _res_constr.datalen; r++) {
28193                 int64_t _res_conv_43 = _res_vals[r];
28194                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
28195                 CHECK_ACCESS(_res_conv_43_ptr);
28196                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
28197                 FREE(untag_ptr(_res_conv_43));
28198                 _res_constr.data[r] = _res_conv_43_conv;
28199         }
28200         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28201         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
28202 }
28203
28204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
28205         LDKCVec_u8Z o_ref;
28206         o_ref.datalen = (*env)->GetArrayLength(env, o);
28207         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
28208         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
28209         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28210         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
28211         return tag_ptr(ret_conv, true);
28212 }
28213
28214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28215         LDKPeerHandleError e_conv;
28216         e_conv.inner = untag_ptr(e);
28217         e_conv.is_owned = ptr_is_owned(e);
28218         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28219         e_conv = PeerHandleError_clone(&e_conv);
28220         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28221         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
28222         return tag_ptr(ret_conv, true);
28223 }
28224
28225 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28226         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
28227         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
28228         return ret_conv;
28229 }
28230
28231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28232         if (!ptr_is_owned(_res)) return;
28233         void* _res_ptr = untag_ptr(_res);
28234         CHECK_ACCESS(_res_ptr);
28235         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
28236         FREE(untag_ptr(_res));
28237         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
28238 }
28239
28240 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
28241         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28242         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
28243         return tag_ptr(ret_conv, true);
28244 }
28245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28246         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
28247         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
28248         return ret_conv;
28249 }
28250
28251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28252         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
28253         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28254         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
28255         return tag_ptr(ret_conv, true);
28256 }
28257
28258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
28259         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28260         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
28261         return tag_ptr(ret_conv, true);
28262 }
28263
28264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28265         LDKPeerHandleError e_conv;
28266         e_conv.inner = untag_ptr(e);
28267         e_conv.is_owned = ptr_is_owned(e);
28268         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28269         e_conv = PeerHandleError_clone(&e_conv);
28270         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28271         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
28272         return tag_ptr(ret_conv, true);
28273 }
28274
28275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28276         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
28277         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
28278         return ret_conv;
28279 }
28280
28281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28282         if (!ptr_is_owned(_res)) return;
28283         void* _res_ptr = untag_ptr(_res);
28284         CHECK_ACCESS(_res_ptr);
28285         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
28286         FREE(untag_ptr(_res));
28287         CResult_NonePeerHandleErrorZ_free(_res_conv);
28288 }
28289
28290 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
28291         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28292         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
28293         return tag_ptr(ret_conv, true);
28294 }
28295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28296         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
28297         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
28298         return ret_conv;
28299 }
28300
28301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28302         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
28303         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28304         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
28305         return tag_ptr(ret_conv, true);
28306 }
28307
28308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
28309         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28310         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
28311         return tag_ptr(ret_conv, true);
28312 }
28313
28314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28315         LDKPeerHandleError e_conv;
28316         e_conv.inner = untag_ptr(e);
28317         e_conv.is_owned = ptr_is_owned(e);
28318         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28319         e_conv = PeerHandleError_clone(&e_conv);
28320         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28321         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
28322         return tag_ptr(ret_conv, true);
28323 }
28324
28325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28326         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
28327         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
28328         return ret_conv;
28329 }
28330
28331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28332         if (!ptr_is_owned(_res)) return;
28333         void* _res_ptr = untag_ptr(_res);
28334         CHECK_ACCESS(_res_ptr);
28335         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
28336         FREE(untag_ptr(_res));
28337         CResult_boolPeerHandleErrorZ_free(_res_conv);
28338 }
28339
28340 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
28341         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28342         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
28343         return tag_ptr(ret_conv, true);
28344 }
28345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28346         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
28347         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
28348         return ret_conv;
28349 }
28350
28351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28352         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
28353         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28354         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
28355         return tag_ptr(ret_conv, true);
28356 }
28357
28358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
28359         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
28360         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
28361         return tag_ptr(ret_conv, true);
28362 }
28363
28364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28365         void* e_ptr = untag_ptr(e);
28366         CHECK_ACCESS(e_ptr);
28367         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
28368         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
28369         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
28370         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
28371         return tag_ptr(ret_conv, true);
28372 }
28373
28374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28375         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
28376         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
28377         return ret_conv;
28378 }
28379
28380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28381         if (!ptr_is_owned(_res)) return;
28382         void* _res_ptr = untag_ptr(_res);
28383         CHECK_ACCESS(_res_ptr);
28384         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
28385         FREE(untag_ptr(_res));
28386         CResult_u32GraphSyncErrorZ_free(_res_conv);
28387 }
28388
28389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
28390         LDKCVec_u8Z o_ref;
28391         o_ref.datalen = (*env)->GetArrayLength(env, o);
28392         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
28393         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
28394         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
28395         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
28396         return tag_ptr(ret_conv, true);
28397 }
28398
28399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28400         LDKIOError e_conv = LDKIOError_from_java(env, e);
28401         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
28402         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
28403         return tag_ptr(ret_conv, true);
28404 }
28405
28406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28407         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
28408         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
28409         return ret_conv;
28410 }
28411
28412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28413         if (!ptr_is_owned(_res)) return;
28414         void* _res_ptr = untag_ptr(_res);
28415         CHECK_ACCESS(_res_ptr);
28416         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
28417         FREE(untag_ptr(_res));
28418         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
28419 }
28420
28421 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
28422         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
28423         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
28424         return tag_ptr(ret_conv, true);
28425 }
28426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28427         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
28428         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
28429         return ret_conv;
28430 }
28431
28432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28433         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
28434         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
28435         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
28436         return tag_ptr(ret_conv, true);
28437 }
28438
28439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
28440         LDKCVec_StrZ _res_constr;
28441         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28442         if (_res_constr.datalen > 0)
28443                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
28444         else
28445                 _res_constr.data = NULL;
28446         for (size_t i = 0; i < _res_constr.datalen; i++) {
28447                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
28448                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
28449                 _res_constr.data[i] = dummy;
28450         }
28451         CVec_StrZ_free(_res_constr);
28452 }
28453
28454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
28455         LDKCVec_StrZ o_constr;
28456         o_constr.datalen = (*env)->GetArrayLength(env, o);
28457         if (o_constr.datalen > 0)
28458                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
28459         else
28460                 o_constr.data = NULL;
28461         for (size_t i = 0; i < o_constr.datalen; i++) {
28462                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
28463                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
28464                 o_constr.data[i] = o_conv_8_conv;
28465         }
28466         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
28467         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
28468         return tag_ptr(ret_conv, true);
28469 }
28470
28471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28472         LDKIOError e_conv = LDKIOError_from_java(env, e);
28473         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
28474         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
28475         return tag_ptr(ret_conv, true);
28476 }
28477
28478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28479         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
28480         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
28481         return ret_conv;
28482 }
28483
28484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28485         if (!ptr_is_owned(_res)) return;
28486         void* _res_ptr = untag_ptr(_res);
28487         CHECK_ACCESS(_res_ptr);
28488         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
28489         FREE(untag_ptr(_res));
28490         CResult_CVec_StrZIOErrorZ_free(_res_conv);
28491 }
28492
28493 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
28494         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
28495         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
28496         return tag_ptr(ret_conv, true);
28497 }
28498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28499         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
28500         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
28501         return ret_conv;
28502 }
28503
28504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28505         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
28506         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
28507         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
28508         return tag_ptr(ret_conv, true);
28509 }
28510
28511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28512         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
28513         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28514         if (_res_constr.datalen > 0)
28515                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
28516         else
28517                 _res_constr.data = NULL;
28518         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28519         for (size_t o = 0; o < _res_constr.datalen; o++) {
28520                 int64_t _res_conv_40 = _res_vals[o];
28521                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
28522                 CHECK_ACCESS(_res_conv_40_ptr);
28523                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
28524                 FREE(untag_ptr(_res_conv_40));
28525                 _res_constr.data[o] = _res_conv_40_conv;
28526         }
28527         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28528         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
28529 }
28530
28531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
28532         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
28533         o_constr.datalen = (*env)->GetArrayLength(env, o);
28534         if (o_constr.datalen > 0)
28535                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
28536         else
28537                 o_constr.data = NULL;
28538         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
28539         for (size_t o = 0; o < o_constr.datalen; o++) {
28540                 int64_t o_conv_40 = o_vals[o];
28541                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
28542                 CHECK_ACCESS(o_conv_40_ptr);
28543                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
28544                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
28545                 o_constr.data[o] = o_conv_40_conv;
28546         }
28547         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
28548         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28549         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
28550         return tag_ptr(ret_conv, true);
28551 }
28552
28553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28554         LDKIOError e_conv = LDKIOError_from_java(env, e);
28555         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28556         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
28557         return tag_ptr(ret_conv, true);
28558 }
28559
28560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28561         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
28562         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
28563         return ret_conv;
28564 }
28565
28566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28567         if (!ptr_is_owned(_res)) return;
28568         void* _res_ptr = untag_ptr(_res);
28569         CHECK_ACCESS(_res_ptr);
28570         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
28571         FREE(untag_ptr(_res));
28572         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
28573 }
28574
28575 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
28576         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28577         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
28578         return tag_ptr(ret_conv, true);
28579 }
28580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28581         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
28582         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
28583         return ret_conv;
28584 }
28585
28586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28587         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
28588         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
28589         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
28590         return tag_ptr(ret_conv, true);
28591 }
28592
28593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28594         void* o_ptr = untag_ptr(o);
28595         CHECK_ACCESS(o_ptr);
28596         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
28597         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
28598         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28599         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
28600         return tag_ptr(ret_conv, true);
28601 }
28602
28603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28604         LDKIOError e_conv = LDKIOError_from_java(env, e);
28605         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28606         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
28607         return tag_ptr(ret_conv, true);
28608 }
28609
28610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28611         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
28612         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
28613         return ret_conv;
28614 }
28615
28616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28617         if (!ptr_is_owned(_res)) return;
28618         void* _res_ptr = untag_ptr(_res);
28619         CHECK_ACCESS(_res_ptr);
28620         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
28621         FREE(untag_ptr(_res));
28622         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
28623 }
28624
28625 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
28626         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28627         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
28628         return tag_ptr(ret_conv, true);
28629 }
28630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28631         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
28632         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
28633         return ret_conv;
28634 }
28635
28636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28637         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
28638         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
28639         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
28640         return tag_ptr(ret_conv, true);
28641 }
28642
28643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
28644         LDKSecretKey o_ref;
28645         CHECK((*env)->GetArrayLength(env, o) == 32);
28646         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
28647         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28648         *ret_copy = COption_SecretKeyZ_some(o_ref);
28649         int64_t ret_ref = tag_ptr(ret_copy, true);
28650         return ret_ref;
28651 }
28652
28653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
28654         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28655         *ret_copy = COption_SecretKeyZ_none();
28656         int64_t ret_ref = tag_ptr(ret_copy, true);
28657         return ret_ref;
28658 }
28659
28660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28661         if (!ptr_is_owned(_res)) return;
28662         void* _res_ptr = untag_ptr(_res);
28663         CHECK_ACCESS(_res_ptr);
28664         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
28665         FREE(untag_ptr(_res));
28666         COption_SecretKeyZ_free(_res_conv);
28667 }
28668
28669 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
28670         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28671         *ret_copy = COption_SecretKeyZ_clone(arg);
28672         int64_t ret_ref = tag_ptr(ret_copy, true);
28673         return ret_ref;
28674 }
28675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28676         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
28677         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
28678         return ret_conv;
28679 }
28680
28681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28682         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
28683         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
28684         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
28685         int64_t ret_ref = tag_ptr(ret_copy, true);
28686         return ret_ref;
28687 }
28688
28689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28690         LDKVerifiedInvoiceRequest o_conv;
28691         o_conv.inner = untag_ptr(o);
28692         o_conv.is_owned = ptr_is_owned(o);
28693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28694         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
28695         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28696         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
28697         return tag_ptr(ret_conv, true);
28698 }
28699
28700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
28701         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28702         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
28703         return tag_ptr(ret_conv, true);
28704 }
28705
28706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28707         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
28708         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
28709         return ret_conv;
28710 }
28711
28712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28713         if (!ptr_is_owned(_res)) return;
28714         void* _res_ptr = untag_ptr(_res);
28715         CHECK_ACCESS(_res_ptr);
28716         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
28717         FREE(untag_ptr(_res));
28718         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
28719 }
28720
28721 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
28722         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28723         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
28724         return tag_ptr(ret_conv, true);
28725 }
28726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28727         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
28728         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
28729         return ret_conv;
28730 }
28731
28732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28733         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
28734         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
28735         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
28736         return tag_ptr(ret_conv, true);
28737 }
28738
28739 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
28740         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
28741         return ret_conv;
28742 }
28743
28744 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
28745         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
28746         return ret_conv;
28747 }
28748
28749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
28750         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
28751         COption_NoneZ_free(_res_conv);
28752 }
28753
28754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
28755         LDKCVec_WitnessZ _res_constr;
28756         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28757         if (_res_constr.datalen > 0)
28758                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
28759         else
28760                 _res_constr.data = NULL;
28761         for (size_t i = 0; i < _res_constr.datalen; i++) {
28762                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
28763                 LDKWitness _res_conv_8_ref;
28764                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
28765                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
28766                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
28767                 _res_conv_8_ref.data_is_owned = true;
28768                 _res_constr.data[i] = _res_conv_8_ref;
28769         }
28770         CVec_WitnessZ_free(_res_constr);
28771 }
28772
28773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
28774         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28775         *ret_copy = COption_i64Z_some(o);
28776         int64_t ret_ref = tag_ptr(ret_copy, true);
28777         return ret_ref;
28778 }
28779
28780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
28781         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28782         *ret_copy = COption_i64Z_none();
28783         int64_t ret_ref = tag_ptr(ret_copy, true);
28784         return ret_ref;
28785 }
28786
28787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
28788         if (!ptr_is_owned(_res)) return;
28789         void* _res_ptr = untag_ptr(_res);
28790         CHECK_ACCESS(_res_ptr);
28791         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
28792         FREE(untag_ptr(_res));
28793         COption_i64Z_free(_res_conv);
28794 }
28795
28796 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
28797         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28798         *ret_copy = COption_i64Z_clone(arg);
28799         int64_t ret_ref = tag_ptr(ret_copy, true);
28800         return ret_ref;
28801 }
28802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28803         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
28804         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
28805         return ret_conv;
28806 }
28807
28808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28809         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
28810         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
28811         *ret_copy = COption_i64Z_clone(orig_conv);
28812         int64_t ret_ref = tag_ptr(ret_copy, true);
28813         return ret_ref;
28814 }
28815
28816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28817         void* o_ptr = untag_ptr(o);
28818         CHECK_ACCESS(o_ptr);
28819         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28820         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28821         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28822         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
28823         return tag_ptr(ret_conv, true);
28824 }
28825
28826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28827         void* e_ptr = untag_ptr(e);
28828         CHECK_ACCESS(e_ptr);
28829         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28830         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28831         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28832         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
28833         return tag_ptr(ret_conv, true);
28834 }
28835
28836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28837         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
28838         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
28839         return ret_conv;
28840 }
28841
28842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28843         if (!ptr_is_owned(_res)) return;
28844         void* _res_ptr = untag_ptr(_res);
28845         CHECK_ACCESS(_res_ptr);
28846         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
28847         FREE(untag_ptr(_res));
28848         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
28849 }
28850
28851 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
28852         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28853         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
28854         return tag_ptr(ret_conv, true);
28855 }
28856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28857         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
28858         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
28859         return ret_conv;
28860 }
28861
28862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28863         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
28864         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
28865         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
28866         return tag_ptr(ret_conv, true);
28867 }
28868
28869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28870         void* o_ptr = untag_ptr(o);
28871         CHECK_ACCESS(o_ptr);
28872         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
28873         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
28874         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28875         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
28876         return tag_ptr(ret_conv, true);
28877 }
28878
28879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28880         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
28881         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28882         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
28883         return tag_ptr(ret_conv, true);
28884 }
28885
28886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28887         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
28888         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
28889         return ret_conv;
28890 }
28891
28892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28893         if (!ptr_is_owned(_res)) return;
28894         void* _res_ptr = untag_ptr(_res);
28895         CHECK_ACCESS(_res_ptr);
28896         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
28897         FREE(untag_ptr(_res));
28898         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
28899 }
28900
28901 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
28902         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28903         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
28904         return tag_ptr(ret_conv, true);
28905 }
28906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28907         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
28908         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
28909         return ret_conv;
28910 }
28911
28912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28913         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
28914         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
28915         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
28916         return tag_ptr(ret_conv, true);
28917 }
28918
28919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28920         LDKCVec_UpdateAddHTLCZ _res_constr;
28921         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28922         if (_res_constr.datalen > 0)
28923                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
28924         else
28925                 _res_constr.data = NULL;
28926         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28927         for (size_t p = 0; p < _res_constr.datalen; p++) {
28928                 int64_t _res_conv_15 = _res_vals[p];
28929                 LDKUpdateAddHTLC _res_conv_15_conv;
28930                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
28931                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
28932                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
28933                 _res_constr.data[p] = _res_conv_15_conv;
28934         }
28935         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28936         CVec_UpdateAddHTLCZ_free(_res_constr);
28937 }
28938
28939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28940         LDKCVec_UpdateFulfillHTLCZ _res_constr;
28941         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28942         if (_res_constr.datalen > 0)
28943                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
28944         else
28945                 _res_constr.data = NULL;
28946         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28947         for (size_t t = 0; t < _res_constr.datalen; t++) {
28948                 int64_t _res_conv_19 = _res_vals[t];
28949                 LDKUpdateFulfillHTLC _res_conv_19_conv;
28950                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
28951                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
28952                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
28953                 _res_constr.data[t] = _res_conv_19_conv;
28954         }
28955         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28956         CVec_UpdateFulfillHTLCZ_free(_res_constr);
28957 }
28958
28959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28960         LDKCVec_UpdateFailHTLCZ _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(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
28964         else
28965                 _res_constr.data = NULL;
28966         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28967         for (size_t q = 0; q < _res_constr.datalen; q++) {
28968                 int64_t _res_conv_16 = _res_vals[q];
28969                 LDKUpdateFailHTLC _res_conv_16_conv;
28970                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
28971                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
28972                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
28973                 _res_constr.data[q] = _res_conv_16_conv;
28974         }
28975         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28976         CVec_UpdateFailHTLCZ_free(_res_constr);
28977 }
28978
28979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28980         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
28981         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28982         if (_res_constr.datalen > 0)
28983                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
28984         else
28985                 _res_constr.data = NULL;
28986         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28987         for (size_t z = 0; z < _res_constr.datalen; z++) {
28988                 int64_t _res_conv_25 = _res_vals[z];
28989                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
28990                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
28991                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
28992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
28993                 _res_constr.data[z] = _res_conv_25_conv;
28994         }
28995         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28996         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
28997 }
28998
28999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29000         LDKAcceptChannel o_conv;
29001         o_conv.inner = untag_ptr(o);
29002         o_conv.is_owned = ptr_is_owned(o);
29003         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29004         o_conv = AcceptChannel_clone(&o_conv);
29005         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
29006         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
29007         return tag_ptr(ret_conv, true);
29008 }
29009
29010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29011         void* e_ptr = untag_ptr(e);
29012         CHECK_ACCESS(e_ptr);
29013         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29014         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29015         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
29016         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
29017         return tag_ptr(ret_conv, true);
29018 }
29019
29020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29021         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
29022         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
29023         return ret_conv;
29024 }
29025
29026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29027         if (!ptr_is_owned(_res)) return;
29028         void* _res_ptr = untag_ptr(_res);
29029         CHECK_ACCESS(_res_ptr);
29030         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
29031         FREE(untag_ptr(_res));
29032         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
29033 }
29034
29035 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
29036         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
29037         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
29038         return tag_ptr(ret_conv, true);
29039 }
29040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29041         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
29042         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
29043         return ret_conv;
29044 }
29045
29046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29047         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
29048         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
29049         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
29050         return tag_ptr(ret_conv, true);
29051 }
29052
29053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29054         LDKAcceptChannelV2 o_conv;
29055         o_conv.inner = untag_ptr(o);
29056         o_conv.is_owned = ptr_is_owned(o);
29057         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29058         o_conv = AcceptChannelV2_clone(&o_conv);
29059         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
29060         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
29061         return tag_ptr(ret_conv, true);
29062 }
29063
29064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29065         void* e_ptr = untag_ptr(e);
29066         CHECK_ACCESS(e_ptr);
29067         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29068         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29069         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
29070         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
29071         return tag_ptr(ret_conv, true);
29072 }
29073
29074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29075         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
29076         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
29077         return ret_conv;
29078 }
29079
29080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29081         if (!ptr_is_owned(_res)) return;
29082         void* _res_ptr = untag_ptr(_res);
29083         CHECK_ACCESS(_res_ptr);
29084         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
29085         FREE(untag_ptr(_res));
29086         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
29087 }
29088
29089 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29090         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
29091         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
29092         return tag_ptr(ret_conv, true);
29093 }
29094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29095         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
29096         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29097         return ret_conv;
29098 }
29099
29100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29101         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
29102         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
29103         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
29104         return tag_ptr(ret_conv, true);
29105 }
29106
29107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29108         LDKTxAddInput o_conv;
29109         o_conv.inner = untag_ptr(o);
29110         o_conv.is_owned = ptr_is_owned(o);
29111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29112         o_conv = TxAddInput_clone(&o_conv);
29113         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
29114         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
29115         return tag_ptr(ret_conv, true);
29116 }
29117
29118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29119         void* e_ptr = untag_ptr(e);
29120         CHECK_ACCESS(e_ptr);
29121         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29122         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29123         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
29124         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
29125         return tag_ptr(ret_conv, true);
29126 }
29127
29128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29129         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
29130         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
29131         return ret_conv;
29132 }
29133
29134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29135         if (!ptr_is_owned(_res)) return;
29136         void* _res_ptr = untag_ptr(_res);
29137         CHECK_ACCESS(_res_ptr);
29138         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
29139         FREE(untag_ptr(_res));
29140         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
29141 }
29142
29143 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
29144         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
29145         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
29146         return tag_ptr(ret_conv, true);
29147 }
29148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29149         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
29150         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
29151         return ret_conv;
29152 }
29153
29154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29155         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
29156         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
29157         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
29158         return tag_ptr(ret_conv, true);
29159 }
29160
29161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29162         LDKTxAddOutput o_conv;
29163         o_conv.inner = untag_ptr(o);
29164         o_conv.is_owned = ptr_is_owned(o);
29165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29166         o_conv = TxAddOutput_clone(&o_conv);
29167         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
29168         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
29169         return tag_ptr(ret_conv, true);
29170 }
29171
29172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29173         void* e_ptr = untag_ptr(e);
29174         CHECK_ACCESS(e_ptr);
29175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29177         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
29178         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
29179         return tag_ptr(ret_conv, true);
29180 }
29181
29182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29183         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
29184         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
29185         return ret_conv;
29186 }
29187
29188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29189         if (!ptr_is_owned(_res)) return;
29190         void* _res_ptr = untag_ptr(_res);
29191         CHECK_ACCESS(_res_ptr);
29192         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
29193         FREE(untag_ptr(_res));
29194         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
29195 }
29196
29197 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
29198         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
29199         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
29200         return tag_ptr(ret_conv, true);
29201 }
29202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29203         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
29204         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
29205         return ret_conv;
29206 }
29207
29208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29209         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
29210         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
29211         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
29212         return tag_ptr(ret_conv, true);
29213 }
29214
29215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29216         LDKTxRemoveInput o_conv;
29217         o_conv.inner = untag_ptr(o);
29218         o_conv.is_owned = ptr_is_owned(o);
29219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29220         o_conv = TxRemoveInput_clone(&o_conv);
29221         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
29222         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
29223         return tag_ptr(ret_conv, true);
29224 }
29225
29226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29227         void* e_ptr = untag_ptr(e);
29228         CHECK_ACCESS(e_ptr);
29229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29231         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
29232         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
29233         return tag_ptr(ret_conv, true);
29234 }
29235
29236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29237         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
29238         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
29239         return ret_conv;
29240 }
29241
29242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29243         if (!ptr_is_owned(_res)) return;
29244         void* _res_ptr = untag_ptr(_res);
29245         CHECK_ACCESS(_res_ptr);
29246         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
29247         FREE(untag_ptr(_res));
29248         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
29249 }
29250
29251 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
29252         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
29253         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
29254         return tag_ptr(ret_conv, true);
29255 }
29256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29257         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
29258         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
29259         return ret_conv;
29260 }
29261
29262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29263         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
29264         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
29265         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
29266         return tag_ptr(ret_conv, true);
29267 }
29268
29269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29270         LDKTxRemoveOutput o_conv;
29271         o_conv.inner = untag_ptr(o);
29272         o_conv.is_owned = ptr_is_owned(o);
29273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29274         o_conv = TxRemoveOutput_clone(&o_conv);
29275         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
29276         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
29277         return tag_ptr(ret_conv, true);
29278 }
29279
29280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29281         void* e_ptr = untag_ptr(e);
29282         CHECK_ACCESS(e_ptr);
29283         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29284         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29285         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
29286         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
29287         return tag_ptr(ret_conv, true);
29288 }
29289
29290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29291         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
29292         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
29293         return ret_conv;
29294 }
29295
29296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29297         if (!ptr_is_owned(_res)) return;
29298         void* _res_ptr = untag_ptr(_res);
29299         CHECK_ACCESS(_res_ptr);
29300         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
29301         FREE(untag_ptr(_res));
29302         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
29303 }
29304
29305 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
29306         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
29307         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
29308         return tag_ptr(ret_conv, true);
29309 }
29310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29311         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
29312         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
29313         return ret_conv;
29314 }
29315
29316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29317         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
29318         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
29319         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
29320         return tag_ptr(ret_conv, true);
29321 }
29322
29323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29324         LDKTxComplete o_conv;
29325         o_conv.inner = untag_ptr(o);
29326         o_conv.is_owned = ptr_is_owned(o);
29327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29328         o_conv = TxComplete_clone(&o_conv);
29329         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
29330         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
29331         return tag_ptr(ret_conv, true);
29332 }
29333
29334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29335         void* e_ptr = untag_ptr(e);
29336         CHECK_ACCESS(e_ptr);
29337         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29338         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29339         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
29340         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
29341         return tag_ptr(ret_conv, true);
29342 }
29343
29344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29345         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
29346         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
29347         return ret_conv;
29348 }
29349
29350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29351         if (!ptr_is_owned(_res)) return;
29352         void* _res_ptr = untag_ptr(_res);
29353         CHECK_ACCESS(_res_ptr);
29354         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
29355         FREE(untag_ptr(_res));
29356         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
29357 }
29358
29359 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
29360         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
29361         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
29362         return tag_ptr(ret_conv, true);
29363 }
29364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29365         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
29366         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
29367         return ret_conv;
29368 }
29369
29370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29371         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
29372         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
29373         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
29374         return tag_ptr(ret_conv, true);
29375 }
29376
29377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29378         LDKTxSignatures o_conv;
29379         o_conv.inner = untag_ptr(o);
29380         o_conv.is_owned = ptr_is_owned(o);
29381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29382         o_conv = TxSignatures_clone(&o_conv);
29383         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
29384         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
29385         return tag_ptr(ret_conv, true);
29386 }
29387
29388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29389         void* e_ptr = untag_ptr(e);
29390         CHECK_ACCESS(e_ptr);
29391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29393         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
29394         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
29395         return tag_ptr(ret_conv, true);
29396 }
29397
29398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29399         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
29400         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
29401         return ret_conv;
29402 }
29403
29404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29405         if (!ptr_is_owned(_res)) return;
29406         void* _res_ptr = untag_ptr(_res);
29407         CHECK_ACCESS(_res_ptr);
29408         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
29409         FREE(untag_ptr(_res));
29410         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
29411 }
29412
29413 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
29414         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
29415         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
29416         return tag_ptr(ret_conv, true);
29417 }
29418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29419         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
29420         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
29421         return ret_conv;
29422 }
29423
29424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29425         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
29426         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
29427         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
29428         return tag_ptr(ret_conv, true);
29429 }
29430
29431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29432         LDKTxInitRbf o_conv;
29433         o_conv.inner = untag_ptr(o);
29434         o_conv.is_owned = ptr_is_owned(o);
29435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29436         o_conv = TxInitRbf_clone(&o_conv);
29437         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
29438         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
29439         return tag_ptr(ret_conv, true);
29440 }
29441
29442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29443         void* e_ptr = untag_ptr(e);
29444         CHECK_ACCESS(e_ptr);
29445         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29446         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29447         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
29448         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
29449         return tag_ptr(ret_conv, true);
29450 }
29451
29452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29453         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
29454         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
29455         return ret_conv;
29456 }
29457
29458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29459         if (!ptr_is_owned(_res)) return;
29460         void* _res_ptr = untag_ptr(_res);
29461         CHECK_ACCESS(_res_ptr);
29462         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
29463         FREE(untag_ptr(_res));
29464         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
29465 }
29466
29467 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
29468         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
29469         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
29470         return tag_ptr(ret_conv, true);
29471 }
29472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29473         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
29474         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
29475         return ret_conv;
29476 }
29477
29478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29479         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
29480         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
29481         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
29482         return tag_ptr(ret_conv, true);
29483 }
29484
29485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29486         LDKTxAckRbf o_conv;
29487         o_conv.inner = untag_ptr(o);
29488         o_conv.is_owned = ptr_is_owned(o);
29489         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29490         o_conv = TxAckRbf_clone(&o_conv);
29491         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29492         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
29493         return tag_ptr(ret_conv, true);
29494 }
29495
29496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29497         void* e_ptr = untag_ptr(e);
29498         CHECK_ACCESS(e_ptr);
29499         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29500         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29501         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29502         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
29503         return tag_ptr(ret_conv, true);
29504 }
29505
29506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29507         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
29508         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
29509         return ret_conv;
29510 }
29511
29512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29513         if (!ptr_is_owned(_res)) return;
29514         void* _res_ptr = untag_ptr(_res);
29515         CHECK_ACCESS(_res_ptr);
29516         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
29517         FREE(untag_ptr(_res));
29518         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
29519 }
29520
29521 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
29522         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29523         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
29524         return tag_ptr(ret_conv, true);
29525 }
29526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29527         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
29528         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
29529         return ret_conv;
29530 }
29531
29532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29533         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
29534         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
29535         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
29536         return tag_ptr(ret_conv, true);
29537 }
29538
29539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29540         LDKTxAbort o_conv;
29541         o_conv.inner = untag_ptr(o);
29542         o_conv.is_owned = ptr_is_owned(o);
29543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29544         o_conv = TxAbort_clone(&o_conv);
29545         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29546         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
29547         return tag_ptr(ret_conv, true);
29548 }
29549
29550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29551         void* e_ptr = untag_ptr(e);
29552         CHECK_ACCESS(e_ptr);
29553         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29554         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29555         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29556         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
29557         return tag_ptr(ret_conv, true);
29558 }
29559
29560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29561         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
29562         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
29563         return ret_conv;
29564 }
29565
29566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29567         if (!ptr_is_owned(_res)) return;
29568         void* _res_ptr = untag_ptr(_res);
29569         CHECK_ACCESS(_res_ptr);
29570         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
29571         FREE(untag_ptr(_res));
29572         CResult_TxAbortDecodeErrorZ_free(_res_conv);
29573 }
29574
29575 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
29576         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29577         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
29578         return tag_ptr(ret_conv, true);
29579 }
29580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29581         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
29582         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
29583         return ret_conv;
29584 }
29585
29586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29587         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
29588         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
29589         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
29590         return tag_ptr(ret_conv, true);
29591 }
29592
29593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29594         LDKAnnouncementSignatures o_conv;
29595         o_conv.inner = untag_ptr(o);
29596         o_conv.is_owned = ptr_is_owned(o);
29597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29598         o_conv = AnnouncementSignatures_clone(&o_conv);
29599         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29600         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
29601         return tag_ptr(ret_conv, true);
29602 }
29603
29604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29605         void* e_ptr = untag_ptr(e);
29606         CHECK_ACCESS(e_ptr);
29607         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29608         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29609         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29610         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
29611         return tag_ptr(ret_conv, true);
29612 }
29613
29614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29615         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
29616         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
29617         return ret_conv;
29618 }
29619
29620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29621         if (!ptr_is_owned(_res)) return;
29622         void* _res_ptr = untag_ptr(_res);
29623         CHECK_ACCESS(_res_ptr);
29624         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
29625         FREE(untag_ptr(_res));
29626         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
29627 }
29628
29629 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
29630         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29631         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
29632         return tag_ptr(ret_conv, true);
29633 }
29634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29635         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
29636         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
29637         return ret_conv;
29638 }
29639
29640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29641         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
29642         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
29643         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
29644         return tag_ptr(ret_conv, true);
29645 }
29646
29647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29648         LDKChannelReestablish o_conv;
29649         o_conv.inner = untag_ptr(o);
29650         o_conv.is_owned = ptr_is_owned(o);
29651         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29652         o_conv = ChannelReestablish_clone(&o_conv);
29653         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29654         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
29655         return tag_ptr(ret_conv, true);
29656 }
29657
29658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29659         void* e_ptr = untag_ptr(e);
29660         CHECK_ACCESS(e_ptr);
29661         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29662         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29663         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29664         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
29665         return tag_ptr(ret_conv, true);
29666 }
29667
29668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29669         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
29670         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
29671         return ret_conv;
29672 }
29673
29674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29675         if (!ptr_is_owned(_res)) return;
29676         void* _res_ptr = untag_ptr(_res);
29677         CHECK_ACCESS(_res_ptr);
29678         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
29679         FREE(untag_ptr(_res));
29680         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
29681 }
29682
29683 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
29684         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29685         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
29686         return tag_ptr(ret_conv, true);
29687 }
29688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29689         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
29690         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
29691         return ret_conv;
29692 }
29693
29694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29695         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
29696         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
29697         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
29698         return tag_ptr(ret_conv, true);
29699 }
29700
29701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29702         LDKClosingSigned o_conv;
29703         o_conv.inner = untag_ptr(o);
29704         o_conv.is_owned = ptr_is_owned(o);
29705         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29706         o_conv = ClosingSigned_clone(&o_conv);
29707         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29708         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
29709         return tag_ptr(ret_conv, true);
29710 }
29711
29712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29713         void* e_ptr = untag_ptr(e);
29714         CHECK_ACCESS(e_ptr);
29715         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29716         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29717         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29718         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
29719         return tag_ptr(ret_conv, true);
29720 }
29721
29722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29723         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
29724         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
29725         return ret_conv;
29726 }
29727
29728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29729         if (!ptr_is_owned(_res)) return;
29730         void* _res_ptr = untag_ptr(_res);
29731         CHECK_ACCESS(_res_ptr);
29732         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
29733         FREE(untag_ptr(_res));
29734         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
29735 }
29736
29737 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
29738         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29739         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
29740         return tag_ptr(ret_conv, true);
29741 }
29742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29743         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
29744         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
29745         return ret_conv;
29746 }
29747
29748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29749         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
29750         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
29751         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
29752         return tag_ptr(ret_conv, true);
29753 }
29754
29755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29756         LDKClosingSignedFeeRange o_conv;
29757         o_conv.inner = untag_ptr(o);
29758         o_conv.is_owned = ptr_is_owned(o);
29759         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29760         o_conv = ClosingSignedFeeRange_clone(&o_conv);
29761         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29762         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
29763         return tag_ptr(ret_conv, true);
29764 }
29765
29766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29767         void* e_ptr = untag_ptr(e);
29768         CHECK_ACCESS(e_ptr);
29769         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29770         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29771         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29772         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
29773         return tag_ptr(ret_conv, true);
29774 }
29775
29776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29777         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
29778         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
29779         return ret_conv;
29780 }
29781
29782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29783         if (!ptr_is_owned(_res)) return;
29784         void* _res_ptr = untag_ptr(_res);
29785         CHECK_ACCESS(_res_ptr);
29786         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
29787         FREE(untag_ptr(_res));
29788         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
29789 }
29790
29791 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
29792         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29793         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
29794         return tag_ptr(ret_conv, true);
29795 }
29796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29797         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
29798         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
29799         return ret_conv;
29800 }
29801
29802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29803         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
29804         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29805         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
29806         return tag_ptr(ret_conv, true);
29807 }
29808
29809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29810         LDKCommitmentSigned o_conv;
29811         o_conv.inner = untag_ptr(o);
29812         o_conv.is_owned = ptr_is_owned(o);
29813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29814         o_conv = CommitmentSigned_clone(&o_conv);
29815         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29816         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
29817         return tag_ptr(ret_conv, true);
29818 }
29819
29820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29821         void* e_ptr = untag_ptr(e);
29822         CHECK_ACCESS(e_ptr);
29823         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29824         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29825         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29826         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
29827         return tag_ptr(ret_conv, true);
29828 }
29829
29830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29831         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
29832         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
29833         return ret_conv;
29834 }
29835
29836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29837         if (!ptr_is_owned(_res)) return;
29838         void* _res_ptr = untag_ptr(_res);
29839         CHECK_ACCESS(_res_ptr);
29840         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
29841         FREE(untag_ptr(_res));
29842         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
29843 }
29844
29845 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
29846         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29847         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
29848         return tag_ptr(ret_conv, true);
29849 }
29850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29851         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
29852         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
29853         return ret_conv;
29854 }
29855
29856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29857         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
29858         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29859         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
29860         return tag_ptr(ret_conv, true);
29861 }
29862
29863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29864         LDKFundingCreated o_conv;
29865         o_conv.inner = untag_ptr(o);
29866         o_conv.is_owned = ptr_is_owned(o);
29867         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29868         o_conv = FundingCreated_clone(&o_conv);
29869         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29870         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
29871         return tag_ptr(ret_conv, true);
29872 }
29873
29874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29875         void* e_ptr = untag_ptr(e);
29876         CHECK_ACCESS(e_ptr);
29877         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29878         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29879         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29880         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
29881         return tag_ptr(ret_conv, true);
29882 }
29883
29884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29885         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
29886         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
29887         return ret_conv;
29888 }
29889
29890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29891         if (!ptr_is_owned(_res)) return;
29892         void* _res_ptr = untag_ptr(_res);
29893         CHECK_ACCESS(_res_ptr);
29894         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
29895         FREE(untag_ptr(_res));
29896         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
29897 }
29898
29899 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
29900         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29901         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
29902         return tag_ptr(ret_conv, true);
29903 }
29904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29905         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
29906         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
29907         return ret_conv;
29908 }
29909
29910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29911         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
29912         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29913         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
29914         return tag_ptr(ret_conv, true);
29915 }
29916
29917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29918         LDKFundingSigned o_conv;
29919         o_conv.inner = untag_ptr(o);
29920         o_conv.is_owned = ptr_is_owned(o);
29921         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29922         o_conv = FundingSigned_clone(&o_conv);
29923         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29924         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
29925         return tag_ptr(ret_conv, true);
29926 }
29927
29928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29929         void* e_ptr = untag_ptr(e);
29930         CHECK_ACCESS(e_ptr);
29931         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29932         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29933         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29934         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
29935         return tag_ptr(ret_conv, true);
29936 }
29937
29938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29939         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
29940         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
29941         return ret_conv;
29942 }
29943
29944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29945         if (!ptr_is_owned(_res)) return;
29946         void* _res_ptr = untag_ptr(_res);
29947         CHECK_ACCESS(_res_ptr);
29948         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
29949         FREE(untag_ptr(_res));
29950         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
29951 }
29952
29953 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
29954         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29955         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
29956         return tag_ptr(ret_conv, true);
29957 }
29958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29959         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
29960         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
29961         return ret_conv;
29962 }
29963
29964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29965         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
29966         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29967         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
29968         return tag_ptr(ret_conv, true);
29969 }
29970
29971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29972         LDKChannelReady o_conv;
29973         o_conv.inner = untag_ptr(o);
29974         o_conv.is_owned = ptr_is_owned(o);
29975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29976         o_conv = ChannelReady_clone(&o_conv);
29977         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29978         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
29979         return tag_ptr(ret_conv, true);
29980 }
29981
29982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29983         void* e_ptr = untag_ptr(e);
29984         CHECK_ACCESS(e_ptr);
29985         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29986         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29987         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29988         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
29989         return tag_ptr(ret_conv, true);
29990 }
29991
29992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29993         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
29994         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
29995         return ret_conv;
29996 }
29997
29998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29999         if (!ptr_is_owned(_res)) return;
30000         void* _res_ptr = untag_ptr(_res);
30001         CHECK_ACCESS(_res_ptr);
30002         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
30003         FREE(untag_ptr(_res));
30004         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
30005 }
30006
30007 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
30008         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
30009         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
30010         return tag_ptr(ret_conv, true);
30011 }
30012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30013         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
30014         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
30015         return ret_conv;
30016 }
30017
30018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30019         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
30020         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
30021         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
30022         return tag_ptr(ret_conv, true);
30023 }
30024
30025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30026         LDKInit o_conv;
30027         o_conv.inner = untag_ptr(o);
30028         o_conv.is_owned = ptr_is_owned(o);
30029         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30030         o_conv = Init_clone(&o_conv);
30031         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
30032         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
30033         return tag_ptr(ret_conv, true);
30034 }
30035
30036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30037         void* e_ptr = untag_ptr(e);
30038         CHECK_ACCESS(e_ptr);
30039         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30040         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30041         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
30042         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
30043         return tag_ptr(ret_conv, true);
30044 }
30045
30046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30047         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
30048         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
30049         return ret_conv;
30050 }
30051
30052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30053         if (!ptr_is_owned(_res)) return;
30054         void* _res_ptr = untag_ptr(_res);
30055         CHECK_ACCESS(_res_ptr);
30056         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
30057         FREE(untag_ptr(_res));
30058         CResult_InitDecodeErrorZ_free(_res_conv);
30059 }
30060
30061 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
30062         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
30063         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
30064         return tag_ptr(ret_conv, true);
30065 }
30066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30067         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
30068         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
30069         return ret_conv;
30070 }
30071
30072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30073         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
30074         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
30075         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
30076         return tag_ptr(ret_conv, true);
30077 }
30078
30079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30080         LDKOpenChannel o_conv;
30081         o_conv.inner = untag_ptr(o);
30082         o_conv.is_owned = ptr_is_owned(o);
30083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30084         o_conv = OpenChannel_clone(&o_conv);
30085         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
30086         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
30087         return tag_ptr(ret_conv, true);
30088 }
30089
30090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30091         void* e_ptr = untag_ptr(e);
30092         CHECK_ACCESS(e_ptr);
30093         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30094         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30095         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
30096         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
30097         return tag_ptr(ret_conv, true);
30098 }
30099
30100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30101         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
30102         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
30103         return ret_conv;
30104 }
30105
30106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30107         if (!ptr_is_owned(_res)) return;
30108         void* _res_ptr = untag_ptr(_res);
30109         CHECK_ACCESS(_res_ptr);
30110         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
30111         FREE(untag_ptr(_res));
30112         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
30113 }
30114
30115 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
30116         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
30117         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
30118         return tag_ptr(ret_conv, true);
30119 }
30120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30121         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
30122         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
30123         return ret_conv;
30124 }
30125
30126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30127         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
30128         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
30129         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
30130         return tag_ptr(ret_conv, true);
30131 }
30132
30133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30134         LDKOpenChannelV2 o_conv;
30135         o_conv.inner = untag_ptr(o);
30136         o_conv.is_owned = ptr_is_owned(o);
30137         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30138         o_conv = OpenChannelV2_clone(&o_conv);
30139         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
30140         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
30141         return tag_ptr(ret_conv, true);
30142 }
30143
30144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30145         void* e_ptr = untag_ptr(e);
30146         CHECK_ACCESS(e_ptr);
30147         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30148         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30149         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
30150         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
30151         return tag_ptr(ret_conv, true);
30152 }
30153
30154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30155         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
30156         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
30157         return ret_conv;
30158 }
30159
30160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30161         if (!ptr_is_owned(_res)) return;
30162         void* _res_ptr = untag_ptr(_res);
30163         CHECK_ACCESS(_res_ptr);
30164         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
30165         FREE(untag_ptr(_res));
30166         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
30167 }
30168
30169 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
30170         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
30171         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
30172         return tag_ptr(ret_conv, true);
30173 }
30174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30175         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
30176         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
30177         return ret_conv;
30178 }
30179
30180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30181         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
30182         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
30183         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
30184         return tag_ptr(ret_conv, true);
30185 }
30186
30187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30188         LDKRevokeAndACK o_conv;
30189         o_conv.inner = untag_ptr(o);
30190         o_conv.is_owned = ptr_is_owned(o);
30191         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30192         o_conv = RevokeAndACK_clone(&o_conv);
30193         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
30194         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
30195         return tag_ptr(ret_conv, true);
30196 }
30197
30198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30199         void* e_ptr = untag_ptr(e);
30200         CHECK_ACCESS(e_ptr);
30201         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30202         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30203         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
30204         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
30205         return tag_ptr(ret_conv, true);
30206 }
30207
30208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30209         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
30210         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
30211         return ret_conv;
30212 }
30213
30214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30215         if (!ptr_is_owned(_res)) return;
30216         void* _res_ptr = untag_ptr(_res);
30217         CHECK_ACCESS(_res_ptr);
30218         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
30219         FREE(untag_ptr(_res));
30220         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
30221 }
30222
30223 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
30224         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
30225         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
30226         return tag_ptr(ret_conv, true);
30227 }
30228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30229         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
30230         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
30231         return ret_conv;
30232 }
30233
30234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30235         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
30236         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
30237         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
30238         return tag_ptr(ret_conv, true);
30239 }
30240
30241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30242         LDKShutdown o_conv;
30243         o_conv.inner = untag_ptr(o);
30244         o_conv.is_owned = ptr_is_owned(o);
30245         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30246         o_conv = Shutdown_clone(&o_conv);
30247         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
30248         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
30249         return tag_ptr(ret_conv, true);
30250 }
30251
30252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30253         void* e_ptr = untag_ptr(e);
30254         CHECK_ACCESS(e_ptr);
30255         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30256         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30257         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
30258         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
30259         return tag_ptr(ret_conv, true);
30260 }
30261
30262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30263         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
30264         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
30265         return ret_conv;
30266 }
30267
30268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30269         if (!ptr_is_owned(_res)) return;
30270         void* _res_ptr = untag_ptr(_res);
30271         CHECK_ACCESS(_res_ptr);
30272         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
30273         FREE(untag_ptr(_res));
30274         CResult_ShutdownDecodeErrorZ_free(_res_conv);
30275 }
30276
30277 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
30278         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
30279         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
30280         return tag_ptr(ret_conv, true);
30281 }
30282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30283         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
30284         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
30285         return ret_conv;
30286 }
30287
30288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30289         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
30290         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
30291         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
30292         return tag_ptr(ret_conv, true);
30293 }
30294
30295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30296         LDKUpdateFailHTLC o_conv;
30297         o_conv.inner = untag_ptr(o);
30298         o_conv.is_owned = ptr_is_owned(o);
30299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30300         o_conv = UpdateFailHTLC_clone(&o_conv);
30301         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
30302         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
30303         return tag_ptr(ret_conv, true);
30304 }
30305
30306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30307         void* e_ptr = untag_ptr(e);
30308         CHECK_ACCESS(e_ptr);
30309         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30310         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30311         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
30312         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
30313         return tag_ptr(ret_conv, true);
30314 }
30315
30316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30317         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
30318         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
30319         return ret_conv;
30320 }
30321
30322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30323         if (!ptr_is_owned(_res)) return;
30324         void* _res_ptr = untag_ptr(_res);
30325         CHECK_ACCESS(_res_ptr);
30326         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
30327         FREE(untag_ptr(_res));
30328         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
30329 }
30330
30331 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
30332         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
30333         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
30334         return tag_ptr(ret_conv, true);
30335 }
30336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30337         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
30338         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
30339         return ret_conv;
30340 }
30341
30342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30343         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
30344         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
30345         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
30346         return tag_ptr(ret_conv, true);
30347 }
30348
30349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30350         LDKUpdateFailMalformedHTLC o_conv;
30351         o_conv.inner = untag_ptr(o);
30352         o_conv.is_owned = ptr_is_owned(o);
30353         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30354         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
30355         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
30356         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
30357         return tag_ptr(ret_conv, true);
30358 }
30359
30360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30361         void* e_ptr = untag_ptr(e);
30362         CHECK_ACCESS(e_ptr);
30363         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30364         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30365         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
30366         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
30367         return tag_ptr(ret_conv, true);
30368 }
30369
30370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30371         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
30372         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
30373         return ret_conv;
30374 }
30375
30376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30377         if (!ptr_is_owned(_res)) return;
30378         void* _res_ptr = untag_ptr(_res);
30379         CHECK_ACCESS(_res_ptr);
30380         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
30381         FREE(untag_ptr(_res));
30382         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
30383 }
30384
30385 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
30386         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
30387         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
30388         return tag_ptr(ret_conv, true);
30389 }
30390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30391         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
30392         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
30393         return ret_conv;
30394 }
30395
30396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30397         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
30398         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
30399         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
30400         return tag_ptr(ret_conv, true);
30401 }
30402
30403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30404         LDKUpdateFee o_conv;
30405         o_conv.inner = untag_ptr(o);
30406         o_conv.is_owned = ptr_is_owned(o);
30407         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30408         o_conv = UpdateFee_clone(&o_conv);
30409         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
30410         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
30411         return tag_ptr(ret_conv, true);
30412 }
30413
30414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30415         void* e_ptr = untag_ptr(e);
30416         CHECK_ACCESS(e_ptr);
30417         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30418         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30419         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
30420         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
30421         return tag_ptr(ret_conv, true);
30422 }
30423
30424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30425         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
30426         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
30427         return ret_conv;
30428 }
30429
30430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30431         if (!ptr_is_owned(_res)) return;
30432         void* _res_ptr = untag_ptr(_res);
30433         CHECK_ACCESS(_res_ptr);
30434         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
30435         FREE(untag_ptr(_res));
30436         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
30437 }
30438
30439 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
30440         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
30441         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
30442         return tag_ptr(ret_conv, true);
30443 }
30444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30445         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
30446         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
30447         return ret_conv;
30448 }
30449
30450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30451         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
30452         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
30453         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
30454         return tag_ptr(ret_conv, true);
30455 }
30456
30457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30458         LDKUpdateFulfillHTLC o_conv;
30459         o_conv.inner = untag_ptr(o);
30460         o_conv.is_owned = ptr_is_owned(o);
30461         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30462         o_conv = UpdateFulfillHTLC_clone(&o_conv);
30463         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
30464         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
30465         return tag_ptr(ret_conv, true);
30466 }
30467
30468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30469         void* e_ptr = untag_ptr(e);
30470         CHECK_ACCESS(e_ptr);
30471         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30472         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30473         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
30474         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
30475         return tag_ptr(ret_conv, true);
30476 }
30477
30478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30479         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
30480         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
30481         return ret_conv;
30482 }
30483
30484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30485         if (!ptr_is_owned(_res)) return;
30486         void* _res_ptr = untag_ptr(_res);
30487         CHECK_ACCESS(_res_ptr);
30488         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
30489         FREE(untag_ptr(_res));
30490         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
30491 }
30492
30493 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
30494         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
30495         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
30496         return tag_ptr(ret_conv, true);
30497 }
30498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30499         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
30500         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
30501         return ret_conv;
30502 }
30503
30504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30505         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
30506         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
30507         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
30508         return tag_ptr(ret_conv, true);
30509 }
30510
30511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30512         LDKUpdateAddHTLC o_conv;
30513         o_conv.inner = untag_ptr(o);
30514         o_conv.is_owned = ptr_is_owned(o);
30515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30516         o_conv = UpdateAddHTLC_clone(&o_conv);
30517         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30518         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
30519         return tag_ptr(ret_conv, true);
30520 }
30521
30522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30523         void* e_ptr = untag_ptr(e);
30524         CHECK_ACCESS(e_ptr);
30525         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30526         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30527         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30528         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
30529         return tag_ptr(ret_conv, true);
30530 }
30531
30532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30533         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
30534         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
30535         return ret_conv;
30536 }
30537
30538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_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         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
30543         FREE(untag_ptr(_res));
30544         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
30545 }
30546
30547 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
30548         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30549         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
30550         return tag_ptr(ret_conv, true);
30551 }
30552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30553         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
30554         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
30555         return ret_conv;
30556 }
30557
30558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30559         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
30560         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
30561         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
30562         return tag_ptr(ret_conv, true);
30563 }
30564
30565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30566         LDKOnionMessage o_conv;
30567         o_conv.inner = untag_ptr(o);
30568         o_conv.is_owned = ptr_is_owned(o);
30569         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30570         o_conv = OnionMessage_clone(&o_conv);
30571         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30572         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
30573         return tag_ptr(ret_conv, true);
30574 }
30575
30576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30577         void* e_ptr = untag_ptr(e);
30578         CHECK_ACCESS(e_ptr);
30579         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30580         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30581         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30582         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
30583         return tag_ptr(ret_conv, true);
30584 }
30585
30586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30587         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
30588         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
30589         return ret_conv;
30590 }
30591
30592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30593         if (!ptr_is_owned(_res)) return;
30594         void* _res_ptr = untag_ptr(_res);
30595         CHECK_ACCESS(_res_ptr);
30596         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
30597         FREE(untag_ptr(_res));
30598         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
30599 }
30600
30601 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
30602         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30603         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
30604         return tag_ptr(ret_conv, true);
30605 }
30606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30607         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
30608         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
30609         return ret_conv;
30610 }
30611
30612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30613         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
30614         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
30615         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
30616         return tag_ptr(ret_conv, true);
30617 }
30618
30619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30620         LDKPing o_conv;
30621         o_conv.inner = untag_ptr(o);
30622         o_conv.is_owned = ptr_is_owned(o);
30623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30624         o_conv = Ping_clone(&o_conv);
30625         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30626         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
30627         return tag_ptr(ret_conv, true);
30628 }
30629
30630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30631         void* e_ptr = untag_ptr(e);
30632         CHECK_ACCESS(e_ptr);
30633         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30634         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30635         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30636         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
30637         return tag_ptr(ret_conv, true);
30638 }
30639
30640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30641         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
30642         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
30643         return ret_conv;
30644 }
30645
30646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30647         if (!ptr_is_owned(_res)) return;
30648         void* _res_ptr = untag_ptr(_res);
30649         CHECK_ACCESS(_res_ptr);
30650         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
30651         FREE(untag_ptr(_res));
30652         CResult_PingDecodeErrorZ_free(_res_conv);
30653 }
30654
30655 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
30656         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30657         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
30658         return tag_ptr(ret_conv, true);
30659 }
30660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30661         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
30662         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
30663         return ret_conv;
30664 }
30665
30666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30667         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
30668         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30669         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
30670         return tag_ptr(ret_conv, true);
30671 }
30672
30673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30674         LDKPong o_conv;
30675         o_conv.inner = untag_ptr(o);
30676         o_conv.is_owned = ptr_is_owned(o);
30677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30678         o_conv = Pong_clone(&o_conv);
30679         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30680         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
30681         return tag_ptr(ret_conv, true);
30682 }
30683
30684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30685         void* e_ptr = untag_ptr(e);
30686         CHECK_ACCESS(e_ptr);
30687         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30688         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30689         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30690         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
30691         return tag_ptr(ret_conv, true);
30692 }
30693
30694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30695         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
30696         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
30697         return ret_conv;
30698 }
30699
30700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30701         if (!ptr_is_owned(_res)) return;
30702         void* _res_ptr = untag_ptr(_res);
30703         CHECK_ACCESS(_res_ptr);
30704         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
30705         FREE(untag_ptr(_res));
30706         CResult_PongDecodeErrorZ_free(_res_conv);
30707 }
30708
30709 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
30710         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30711         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
30712         return tag_ptr(ret_conv, true);
30713 }
30714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30715         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
30716         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
30717         return ret_conv;
30718 }
30719
30720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30721         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
30722         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30723         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
30724         return tag_ptr(ret_conv, true);
30725 }
30726
30727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30728         LDKUnsignedChannelAnnouncement o_conv;
30729         o_conv.inner = untag_ptr(o);
30730         o_conv.is_owned = ptr_is_owned(o);
30731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30732         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
30733         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30734         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
30735         return tag_ptr(ret_conv, true);
30736 }
30737
30738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30739         void* e_ptr = untag_ptr(e);
30740         CHECK_ACCESS(e_ptr);
30741         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30742         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30743         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30744         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
30745         return tag_ptr(ret_conv, true);
30746 }
30747
30748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30749         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30750         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30751         return ret_conv;
30752 }
30753
30754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30755         if (!ptr_is_owned(_res)) return;
30756         void* _res_ptr = untag_ptr(_res);
30757         CHECK_ACCESS(_res_ptr);
30758         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30759         FREE(untag_ptr(_res));
30760         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
30761 }
30762
30763 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30764         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30765         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
30766         return tag_ptr(ret_conv, true);
30767 }
30768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30769         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30770         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30771         return ret_conv;
30772 }
30773
30774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30775         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30776         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30777         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30778         return tag_ptr(ret_conv, true);
30779 }
30780
30781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30782         LDKChannelAnnouncement o_conv;
30783         o_conv.inner = untag_ptr(o);
30784         o_conv.is_owned = ptr_is_owned(o);
30785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30786         o_conv = ChannelAnnouncement_clone(&o_conv);
30787         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30788         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
30789         return tag_ptr(ret_conv, true);
30790 }
30791
30792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30793         void* e_ptr = untag_ptr(e);
30794         CHECK_ACCESS(e_ptr);
30795         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30796         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30797         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30798         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
30799         return tag_ptr(ret_conv, true);
30800 }
30801
30802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30803         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30804         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30805         return ret_conv;
30806 }
30807
30808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30809         if (!ptr_is_owned(_res)) return;
30810         void* _res_ptr = untag_ptr(_res);
30811         CHECK_ACCESS(_res_ptr);
30812         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30813         FREE(untag_ptr(_res));
30814         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
30815 }
30816
30817 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30818         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30819         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
30820         return tag_ptr(ret_conv, true);
30821 }
30822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30823         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30824         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30825         return ret_conv;
30826 }
30827
30828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30829         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30830         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30831         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30832         return tag_ptr(ret_conv, true);
30833 }
30834
30835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30836         LDKUnsignedChannelUpdate o_conv;
30837         o_conv.inner = untag_ptr(o);
30838         o_conv.is_owned = ptr_is_owned(o);
30839         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30840         o_conv = UnsignedChannelUpdate_clone(&o_conv);
30841         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30842         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
30843         return tag_ptr(ret_conv, true);
30844 }
30845
30846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30847         void* e_ptr = untag_ptr(e);
30848         CHECK_ACCESS(e_ptr);
30849         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30850         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30851         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30852         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
30853         return tag_ptr(ret_conv, true);
30854 }
30855
30856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30857         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
30858         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
30859         return ret_conv;
30860 }
30861
30862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30863         if (!ptr_is_owned(_res)) return;
30864         void* _res_ptr = untag_ptr(_res);
30865         CHECK_ACCESS(_res_ptr);
30866         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
30867         FREE(untag_ptr(_res));
30868         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
30869 }
30870
30871 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30872         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30873         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
30874         return tag_ptr(ret_conv, true);
30875 }
30876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30877         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30878         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30879         return ret_conv;
30880 }
30881
30882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30883         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30884         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30885         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
30886         return tag_ptr(ret_conv, true);
30887 }
30888
30889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30890         LDKChannelUpdate o_conv;
30891         o_conv.inner = untag_ptr(o);
30892         o_conv.is_owned = ptr_is_owned(o);
30893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30894         o_conv = ChannelUpdate_clone(&o_conv);
30895         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30896         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
30897         return tag_ptr(ret_conv, true);
30898 }
30899
30900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30901         void* e_ptr = untag_ptr(e);
30902         CHECK_ACCESS(e_ptr);
30903         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30904         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30905         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30906         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
30907         return tag_ptr(ret_conv, true);
30908 }
30909
30910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30911         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
30912         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
30913         return ret_conv;
30914 }
30915
30916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30917         if (!ptr_is_owned(_res)) return;
30918         void* _res_ptr = untag_ptr(_res);
30919         CHECK_ACCESS(_res_ptr);
30920         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
30921         FREE(untag_ptr(_res));
30922         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
30923 }
30924
30925 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30926         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30927         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
30928         return tag_ptr(ret_conv, true);
30929 }
30930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30931         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30932         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30933         return ret_conv;
30934 }
30935
30936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30937         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30938         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30939         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
30940         return tag_ptr(ret_conv, true);
30941 }
30942
30943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30944         LDKErrorMessage o_conv;
30945         o_conv.inner = untag_ptr(o);
30946         o_conv.is_owned = ptr_is_owned(o);
30947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30948         o_conv = ErrorMessage_clone(&o_conv);
30949         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30950         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
30951         return tag_ptr(ret_conv, true);
30952 }
30953
30954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30955         void* e_ptr = untag_ptr(e);
30956         CHECK_ACCESS(e_ptr);
30957         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30958         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30959         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30960         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
30961         return tag_ptr(ret_conv, true);
30962 }
30963
30964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30965         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
30966         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
30967         return ret_conv;
30968 }
30969
30970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30971         if (!ptr_is_owned(_res)) return;
30972         void* _res_ptr = untag_ptr(_res);
30973         CHECK_ACCESS(_res_ptr);
30974         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
30975         FREE(untag_ptr(_res));
30976         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
30977 }
30978
30979 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
30980         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30981         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
30982         return tag_ptr(ret_conv, true);
30983 }
30984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30985         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
30986         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
30987         return ret_conv;
30988 }
30989
30990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30991         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
30992         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30993         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
30994         return tag_ptr(ret_conv, true);
30995 }
30996
30997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30998         LDKWarningMessage o_conv;
30999         o_conv.inner = untag_ptr(o);
31000         o_conv.is_owned = ptr_is_owned(o);
31001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31002         o_conv = WarningMessage_clone(&o_conv);
31003         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31004         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
31005         return tag_ptr(ret_conv, true);
31006 }
31007
31008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31009         void* e_ptr = untag_ptr(e);
31010         CHECK_ACCESS(e_ptr);
31011         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31012         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31013         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31014         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
31015         return tag_ptr(ret_conv, true);
31016 }
31017
31018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31019         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
31020         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
31021         return ret_conv;
31022 }
31023
31024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31025         if (!ptr_is_owned(_res)) return;
31026         void* _res_ptr = untag_ptr(_res);
31027         CHECK_ACCESS(_res_ptr);
31028         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
31029         FREE(untag_ptr(_res));
31030         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
31031 }
31032
31033 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
31034         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31035         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
31036         return tag_ptr(ret_conv, true);
31037 }
31038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31039         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
31040         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
31041         return ret_conv;
31042 }
31043
31044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31045         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
31046         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31047         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
31048         return tag_ptr(ret_conv, true);
31049 }
31050
31051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31052         LDKUnsignedNodeAnnouncement o_conv;
31053         o_conv.inner = untag_ptr(o);
31054         o_conv.is_owned = ptr_is_owned(o);
31055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31056         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
31057         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31058         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
31059         return tag_ptr(ret_conv, true);
31060 }
31061
31062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31063         void* e_ptr = untag_ptr(e);
31064         CHECK_ACCESS(e_ptr);
31065         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31066         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31067         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31068         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
31069         return tag_ptr(ret_conv, true);
31070 }
31071
31072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31073         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
31074         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
31075         return ret_conv;
31076 }
31077
31078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31079         if (!ptr_is_owned(_res)) return;
31080         void* _res_ptr = untag_ptr(_res);
31081         CHECK_ACCESS(_res_ptr);
31082         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
31083         FREE(untag_ptr(_res));
31084         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
31085 }
31086
31087 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
31088         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31089         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
31090         return tag_ptr(ret_conv, true);
31091 }
31092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31093         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
31094         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
31095         return ret_conv;
31096 }
31097
31098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31099         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
31100         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31101         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
31102         return tag_ptr(ret_conv, true);
31103 }
31104
31105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31106         LDKNodeAnnouncement o_conv;
31107         o_conv.inner = untag_ptr(o);
31108         o_conv.is_owned = ptr_is_owned(o);
31109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31110         o_conv = NodeAnnouncement_clone(&o_conv);
31111         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31112         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
31113         return tag_ptr(ret_conv, true);
31114 }
31115
31116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31117         void* e_ptr = untag_ptr(e);
31118         CHECK_ACCESS(e_ptr);
31119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31121         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31122         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
31123         return tag_ptr(ret_conv, true);
31124 }
31125
31126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31127         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
31128         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
31129         return ret_conv;
31130 }
31131
31132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31133         if (!ptr_is_owned(_res)) return;
31134         void* _res_ptr = untag_ptr(_res);
31135         CHECK_ACCESS(_res_ptr);
31136         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
31137         FREE(untag_ptr(_res));
31138         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
31139 }
31140
31141 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
31142         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31143         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
31144         return tag_ptr(ret_conv, true);
31145 }
31146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31147         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
31148         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
31149         return ret_conv;
31150 }
31151
31152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31153         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
31154         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31155         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
31156         return tag_ptr(ret_conv, true);
31157 }
31158
31159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31160         LDKQueryShortChannelIds o_conv;
31161         o_conv.inner = untag_ptr(o);
31162         o_conv.is_owned = ptr_is_owned(o);
31163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31164         o_conv = QueryShortChannelIds_clone(&o_conv);
31165         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31166         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
31167         return tag_ptr(ret_conv, true);
31168 }
31169
31170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31171         void* e_ptr = untag_ptr(e);
31172         CHECK_ACCESS(e_ptr);
31173         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31174         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31175         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31176         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
31177         return tag_ptr(ret_conv, true);
31178 }
31179
31180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31181         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
31182         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
31183         return ret_conv;
31184 }
31185
31186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31187         if (!ptr_is_owned(_res)) return;
31188         void* _res_ptr = untag_ptr(_res);
31189         CHECK_ACCESS(_res_ptr);
31190         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
31191         FREE(untag_ptr(_res));
31192         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
31193 }
31194
31195 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
31196         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31197         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
31198         return tag_ptr(ret_conv, true);
31199 }
31200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31201         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
31202         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
31203         return ret_conv;
31204 }
31205
31206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31207         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
31208         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31209         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
31210         return tag_ptr(ret_conv, true);
31211 }
31212
31213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31214         LDKReplyShortChannelIdsEnd o_conv;
31215         o_conv.inner = untag_ptr(o);
31216         o_conv.is_owned = ptr_is_owned(o);
31217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31218         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
31219         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31220         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
31221         return tag_ptr(ret_conv, true);
31222 }
31223
31224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31225         void* e_ptr = untag_ptr(e);
31226         CHECK_ACCESS(e_ptr);
31227         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31228         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31229         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31230         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
31231         return tag_ptr(ret_conv, true);
31232 }
31233
31234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31235         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
31236         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
31237         return ret_conv;
31238 }
31239
31240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31241         if (!ptr_is_owned(_res)) return;
31242         void* _res_ptr = untag_ptr(_res);
31243         CHECK_ACCESS(_res_ptr);
31244         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
31245         FREE(untag_ptr(_res));
31246         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
31247 }
31248
31249 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
31250         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31251         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
31252         return tag_ptr(ret_conv, true);
31253 }
31254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31255         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
31256         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
31257         return ret_conv;
31258 }
31259
31260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31261         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
31262         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31263         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
31264         return tag_ptr(ret_conv, true);
31265 }
31266
31267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31268         LDKQueryChannelRange o_conv;
31269         o_conv.inner = untag_ptr(o);
31270         o_conv.is_owned = ptr_is_owned(o);
31271         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31272         o_conv = QueryChannelRange_clone(&o_conv);
31273         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31274         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
31275         return tag_ptr(ret_conv, true);
31276 }
31277
31278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31279         void* e_ptr = untag_ptr(e);
31280         CHECK_ACCESS(e_ptr);
31281         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31282         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31283         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31284         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
31285         return tag_ptr(ret_conv, true);
31286 }
31287
31288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31289         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
31290         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
31291         return ret_conv;
31292 }
31293
31294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31295         if (!ptr_is_owned(_res)) return;
31296         void* _res_ptr = untag_ptr(_res);
31297         CHECK_ACCESS(_res_ptr);
31298         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
31299         FREE(untag_ptr(_res));
31300         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
31301 }
31302
31303 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
31304         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31305         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
31306         return tag_ptr(ret_conv, true);
31307 }
31308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31309         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
31310         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
31311         return ret_conv;
31312 }
31313
31314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31315         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
31316         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31317         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
31318         return tag_ptr(ret_conv, true);
31319 }
31320
31321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31322         LDKReplyChannelRange o_conv;
31323         o_conv.inner = untag_ptr(o);
31324         o_conv.is_owned = ptr_is_owned(o);
31325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31326         o_conv = ReplyChannelRange_clone(&o_conv);
31327         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31328         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
31329         return tag_ptr(ret_conv, true);
31330 }
31331
31332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31333         void* e_ptr = untag_ptr(e);
31334         CHECK_ACCESS(e_ptr);
31335         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31336         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31337         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31338         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
31339         return tag_ptr(ret_conv, true);
31340 }
31341
31342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31343         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
31344         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
31345         return ret_conv;
31346 }
31347
31348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31349         if (!ptr_is_owned(_res)) return;
31350         void* _res_ptr = untag_ptr(_res);
31351         CHECK_ACCESS(_res_ptr);
31352         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
31353         FREE(untag_ptr(_res));
31354         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
31355 }
31356
31357 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
31358         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31359         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
31360         return tag_ptr(ret_conv, true);
31361 }
31362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31363         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
31364         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
31365         return ret_conv;
31366 }
31367
31368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31369         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
31370         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31371         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
31372         return tag_ptr(ret_conv, true);
31373 }
31374
31375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31376         LDKGossipTimestampFilter o_conv;
31377         o_conv.inner = untag_ptr(o);
31378         o_conv.is_owned = ptr_is_owned(o);
31379         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31380         o_conv = GossipTimestampFilter_clone(&o_conv);
31381         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31382         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
31383         return tag_ptr(ret_conv, true);
31384 }
31385
31386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31387         void* e_ptr = untag_ptr(e);
31388         CHECK_ACCESS(e_ptr);
31389         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31390         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31391         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31392         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
31393         return tag_ptr(ret_conv, true);
31394 }
31395
31396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31397         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
31398         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
31399         return ret_conv;
31400 }
31401
31402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31403         if (!ptr_is_owned(_res)) return;
31404         void* _res_ptr = untag_ptr(_res);
31405         CHECK_ACCESS(_res_ptr);
31406         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
31407         FREE(untag_ptr(_res));
31408         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
31409 }
31410
31411 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
31412         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31413         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
31414         return tag_ptr(ret_conv, true);
31415 }
31416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31417         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
31418         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
31419         return ret_conv;
31420 }
31421
31422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31423         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
31424         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31425         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
31426         return tag_ptr(ret_conv, true);
31427 }
31428
31429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31430         LDKCVec_PhantomRouteHintsZ _res_constr;
31431         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31432         if (_res_constr.datalen > 0)
31433                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
31434         else
31435                 _res_constr.data = NULL;
31436         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31437         for (size_t t = 0; t < _res_constr.datalen; t++) {
31438                 int64_t _res_conv_19 = _res_vals[t];
31439                 LDKPhantomRouteHints _res_conv_19_conv;
31440                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
31441                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
31442                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
31443                 _res_constr.data[t] = _res_conv_19_conv;
31444         }
31445         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31446         CVec_PhantomRouteHintsZ_free(_res_constr);
31447 }
31448
31449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31450         LDKBolt11Invoice o_conv;
31451         o_conv.inner = untag_ptr(o);
31452         o_conv.is_owned = ptr_is_owned(o);
31453         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31454         o_conv = Bolt11Invoice_clone(&o_conv);
31455         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
31456         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
31457         return tag_ptr(ret_conv, true);
31458 }
31459
31460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31461         void* e_ptr = untag_ptr(e);
31462         CHECK_ACCESS(e_ptr);
31463         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
31464         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
31465         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
31466         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
31467         return tag_ptr(ret_conv, true);
31468 }
31469
31470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31471         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
31472         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
31473         return ret_conv;
31474 }
31475
31476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31477         if (!ptr_is_owned(_res)) return;
31478         void* _res_ptr = untag_ptr(_res);
31479         CHECK_ACCESS(_res_ptr);
31480         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
31481         FREE(untag_ptr(_res));
31482         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
31483 }
31484
31485 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
31486         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
31487         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
31488         return tag_ptr(ret_conv, true);
31489 }
31490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31491         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
31492         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
31493         return ret_conv;
31494 }
31495
31496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31497         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
31498         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
31499         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
31500         return tag_ptr(ret_conv, true);
31501 }
31502
31503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31504         LDKCVec_FutureZ _res_constr;
31505         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31506         if (_res_constr.datalen > 0)
31507                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
31508         else
31509                 _res_constr.data = NULL;
31510         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31511         for (size_t i = 0; i < _res_constr.datalen; i++) {
31512                 int64_t _res_conv_8 = _res_vals[i];
31513                 LDKFuture _res_conv_8_conv;
31514                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
31515                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
31516                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
31517                 _res_constr.data[i] = _res_conv_8_conv;
31518         }
31519         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31520         CVec_FutureZ_free(_res_constr);
31521 }
31522
31523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31524         void* o_ptr = untag_ptr(o);
31525         CHECK_ACCESS(o_ptr);
31526         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
31527         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
31528         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31529         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
31530         return tag_ptr(ret_conv, true);
31531 }
31532
31533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31534         void* e_ptr = untag_ptr(e);
31535         CHECK_ACCESS(e_ptr);
31536         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31537         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31538         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31539         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
31540         return tag_ptr(ret_conv, true);
31541 }
31542
31543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31544         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
31545         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
31546         return ret_conv;
31547 }
31548
31549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31550         if (!ptr_is_owned(_res)) return;
31551         void* _res_ptr = untag_ptr(_res);
31552         CHECK_ACCESS(_res_ptr);
31553         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
31554         FREE(untag_ptr(_res));
31555         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
31556 }
31557
31558 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
31559         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31560         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
31561         return tag_ptr(ret_conv, true);
31562 }
31563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31564         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
31565         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
31566         return ret_conv;
31567 }
31568
31569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31570         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
31571         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31572         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
31573         return tag_ptr(ret_conv, true);
31574 }
31575
31576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
31577         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
31578         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31579         *ret_copy = COption_HTLCClaimZ_some(o_conv);
31580         int64_t ret_ref = tag_ptr(ret_copy, true);
31581         return ret_ref;
31582 }
31583
31584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
31585         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31586         *ret_copy = COption_HTLCClaimZ_none();
31587         int64_t ret_ref = tag_ptr(ret_copy, true);
31588         return ret_ref;
31589 }
31590
31591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31592         if (!ptr_is_owned(_res)) return;
31593         void* _res_ptr = untag_ptr(_res);
31594         CHECK_ACCESS(_res_ptr);
31595         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
31596         FREE(untag_ptr(_res));
31597         COption_HTLCClaimZ_free(_res_conv);
31598 }
31599
31600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31601         LDKCounterpartyCommitmentSecrets o_conv;
31602         o_conv.inner = untag_ptr(o);
31603         o_conv.is_owned = ptr_is_owned(o);
31604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31605         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
31606         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31607         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
31608         return tag_ptr(ret_conv, true);
31609 }
31610
31611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31612         void* e_ptr = untag_ptr(e);
31613         CHECK_ACCESS(e_ptr);
31614         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31615         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31616         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31617         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
31618         return tag_ptr(ret_conv, true);
31619 }
31620
31621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31622         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
31623         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
31624         return ret_conv;
31625 }
31626
31627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31628         if (!ptr_is_owned(_res)) return;
31629         void* _res_ptr = untag_ptr(_res);
31630         CHECK_ACCESS(_res_ptr);
31631         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
31632         FREE(untag_ptr(_res));
31633         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
31634 }
31635
31636 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
31637         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31638         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
31639         return tag_ptr(ret_conv, true);
31640 }
31641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31642         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
31643         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
31644         return ret_conv;
31645 }
31646
31647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31648         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
31649         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31650         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
31651         return tag_ptr(ret_conv, true);
31652 }
31653
31654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31655         LDKTxCreationKeys o_conv;
31656         o_conv.inner = untag_ptr(o);
31657         o_conv.is_owned = ptr_is_owned(o);
31658         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31659         o_conv = TxCreationKeys_clone(&o_conv);
31660         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31661         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
31662         return tag_ptr(ret_conv, true);
31663 }
31664
31665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31666         void* e_ptr = untag_ptr(e);
31667         CHECK_ACCESS(e_ptr);
31668         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31669         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31670         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31671         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
31672         return tag_ptr(ret_conv, true);
31673 }
31674
31675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31676         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
31677         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
31678         return ret_conv;
31679 }
31680
31681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31682         if (!ptr_is_owned(_res)) return;
31683         void* _res_ptr = untag_ptr(_res);
31684         CHECK_ACCESS(_res_ptr);
31685         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
31686         FREE(untag_ptr(_res));
31687         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
31688 }
31689
31690 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
31691         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31692         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
31693         return tag_ptr(ret_conv, true);
31694 }
31695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31696         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
31697         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
31698         return ret_conv;
31699 }
31700
31701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31702         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
31703         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31704         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
31705         return tag_ptr(ret_conv, true);
31706 }
31707
31708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31709         LDKChannelPublicKeys o_conv;
31710         o_conv.inner = untag_ptr(o);
31711         o_conv.is_owned = ptr_is_owned(o);
31712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31713         o_conv = ChannelPublicKeys_clone(&o_conv);
31714         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31715         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
31716         return tag_ptr(ret_conv, true);
31717 }
31718
31719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31720         void* e_ptr = untag_ptr(e);
31721         CHECK_ACCESS(e_ptr);
31722         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31723         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31724         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31725         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
31726         return tag_ptr(ret_conv, true);
31727 }
31728
31729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31730         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
31731         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
31732         return ret_conv;
31733 }
31734
31735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31736         if (!ptr_is_owned(_res)) return;
31737         void* _res_ptr = untag_ptr(_res);
31738         CHECK_ACCESS(_res_ptr);
31739         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
31740         FREE(untag_ptr(_res));
31741         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
31742 }
31743
31744 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
31745         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31746         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
31747         return tag_ptr(ret_conv, true);
31748 }
31749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31750         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
31751         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
31752         return ret_conv;
31753 }
31754
31755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31756         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
31757         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31758         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
31759         return tag_ptr(ret_conv, true);
31760 }
31761
31762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31763         LDKHTLCOutputInCommitment o_conv;
31764         o_conv.inner = untag_ptr(o);
31765         o_conv.is_owned = ptr_is_owned(o);
31766         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31767         o_conv = HTLCOutputInCommitment_clone(&o_conv);
31768         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31769         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
31770         return tag_ptr(ret_conv, true);
31771 }
31772
31773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31774         void* e_ptr = untag_ptr(e);
31775         CHECK_ACCESS(e_ptr);
31776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31778         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31779         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
31780         return tag_ptr(ret_conv, true);
31781 }
31782
31783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31784         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
31785         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
31786         return ret_conv;
31787 }
31788
31789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31790         if (!ptr_is_owned(_res)) return;
31791         void* _res_ptr = untag_ptr(_res);
31792         CHECK_ACCESS(_res_ptr);
31793         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
31794         FREE(untag_ptr(_res));
31795         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
31796 }
31797
31798 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
31799         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31800         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
31801         return tag_ptr(ret_conv, true);
31802 }
31803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31804         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
31805         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
31806         return ret_conv;
31807 }
31808
31809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31810         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
31811         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31812         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
31813         return tag_ptr(ret_conv, true);
31814 }
31815
31816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31817         LDKCounterpartyChannelTransactionParameters o_conv;
31818         o_conv.inner = untag_ptr(o);
31819         o_conv.is_owned = ptr_is_owned(o);
31820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31821         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
31822         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31823         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31824         return tag_ptr(ret_conv, true);
31825 }
31826
31827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31828         void* e_ptr = untag_ptr(e);
31829         CHECK_ACCESS(e_ptr);
31830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31832         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31833         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
31834         return tag_ptr(ret_conv, true);
31835 }
31836
31837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31838         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31839         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31840         return ret_conv;
31841 }
31842
31843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31844         if (!ptr_is_owned(_res)) return;
31845         void* _res_ptr = untag_ptr(_res);
31846         CHECK_ACCESS(_res_ptr);
31847         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31848         FREE(untag_ptr(_res));
31849         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31850 }
31851
31852 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31853         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31854         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
31855         return tag_ptr(ret_conv, true);
31856 }
31857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31858         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31859         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31860         return ret_conv;
31861 }
31862
31863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31864         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31865         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31866         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31867         return tag_ptr(ret_conv, true);
31868 }
31869
31870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31871         LDKChannelTransactionParameters o_conv;
31872         o_conv.inner = untag_ptr(o);
31873         o_conv.is_owned = ptr_is_owned(o);
31874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31875         o_conv = ChannelTransactionParameters_clone(&o_conv);
31876         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31877         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31878         return tag_ptr(ret_conv, true);
31879 }
31880
31881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31882         void* e_ptr = untag_ptr(e);
31883         CHECK_ACCESS(e_ptr);
31884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31886         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31887         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
31888         return tag_ptr(ret_conv, true);
31889 }
31890
31891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31892         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31893         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31894         return ret_conv;
31895 }
31896
31897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31898         if (!ptr_is_owned(_res)) return;
31899         void* _res_ptr = untag_ptr(_res);
31900         CHECK_ACCESS(_res_ptr);
31901         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31902         FREE(untag_ptr(_res));
31903         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31904 }
31905
31906 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31907         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31908         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
31909         return tag_ptr(ret_conv, true);
31910 }
31911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31912         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31913         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31914         return ret_conv;
31915 }
31916
31917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31918         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31919         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31920         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31921         return tag_ptr(ret_conv, true);
31922 }
31923
31924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31925         LDKHolderCommitmentTransaction o_conv;
31926         o_conv.inner = untag_ptr(o);
31927         o_conv.is_owned = ptr_is_owned(o);
31928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31929         o_conv = HolderCommitmentTransaction_clone(&o_conv);
31930         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31931         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
31932         return tag_ptr(ret_conv, true);
31933 }
31934
31935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31936         void* e_ptr = untag_ptr(e);
31937         CHECK_ACCESS(e_ptr);
31938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31940         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31941         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
31942         return tag_ptr(ret_conv, true);
31943 }
31944
31945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31946         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31947         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31948         return ret_conv;
31949 }
31950
31951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31952         if (!ptr_is_owned(_res)) return;
31953         void* _res_ptr = untag_ptr(_res);
31954         CHECK_ACCESS(_res_ptr);
31955         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31956         FREE(untag_ptr(_res));
31957         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31958 }
31959
31960 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31961         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31962         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31963         return tag_ptr(ret_conv, true);
31964 }
31965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31966         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31967         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31968         return ret_conv;
31969 }
31970
31971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31972         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31973         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31974         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31975         return tag_ptr(ret_conv, true);
31976 }
31977
31978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31979         LDKBuiltCommitmentTransaction o_conv;
31980         o_conv.inner = untag_ptr(o);
31981         o_conv.is_owned = ptr_is_owned(o);
31982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31983         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31984         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31985         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31986         return tag_ptr(ret_conv, true);
31987 }
31988
31989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31990         void* e_ptr = untag_ptr(e);
31991         CHECK_ACCESS(e_ptr);
31992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31994         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31995         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31996         return tag_ptr(ret_conv, true);
31997 }
31998
31999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32000         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
32001         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
32002         return ret_conv;
32003 }
32004
32005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32006         if (!ptr_is_owned(_res)) return;
32007         void* _res_ptr = untag_ptr(_res);
32008         CHECK_ACCESS(_res_ptr);
32009         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
32010         FREE(untag_ptr(_res));
32011         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
32012 }
32013
32014 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
32015         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
32016         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
32017         return tag_ptr(ret_conv, true);
32018 }
32019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32020         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
32021         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
32022         return ret_conv;
32023 }
32024
32025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32026         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
32027         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
32028         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
32029         return tag_ptr(ret_conv, true);
32030 }
32031
32032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32033         LDKTrustedClosingTransaction o_conv;
32034         o_conv.inner = untag_ptr(o);
32035         o_conv.is_owned = ptr_is_owned(o);
32036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32037         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
32038         
32039         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
32040         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
32041         return tag_ptr(ret_conv, true);
32042 }
32043
32044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
32045         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
32046         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
32047         return tag_ptr(ret_conv, true);
32048 }
32049
32050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32051         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
32052         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
32053         return ret_conv;
32054 }
32055
32056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32057         if (!ptr_is_owned(_res)) return;
32058         void* _res_ptr = untag_ptr(_res);
32059         CHECK_ACCESS(_res_ptr);
32060         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
32061         FREE(untag_ptr(_res));
32062         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
32063 }
32064
32065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32066         LDKCommitmentTransaction o_conv;
32067         o_conv.inner = untag_ptr(o);
32068         o_conv.is_owned = ptr_is_owned(o);
32069         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32070         o_conv = CommitmentTransaction_clone(&o_conv);
32071         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
32072         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
32073         return tag_ptr(ret_conv, true);
32074 }
32075
32076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32077         void* e_ptr = untag_ptr(e);
32078         CHECK_ACCESS(e_ptr);
32079         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32080         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32081         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
32082         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
32083         return tag_ptr(ret_conv, true);
32084 }
32085
32086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32087         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
32088         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
32089         return ret_conv;
32090 }
32091
32092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32093         if (!ptr_is_owned(_res)) return;
32094         void* _res_ptr = untag_ptr(_res);
32095         CHECK_ACCESS(_res_ptr);
32096         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
32097         FREE(untag_ptr(_res));
32098         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
32099 }
32100
32101 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
32102         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
32103         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
32104         return tag_ptr(ret_conv, true);
32105 }
32106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32107         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
32108         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
32109         return ret_conv;
32110 }
32111
32112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32113         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
32114         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
32115         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
32116         return tag_ptr(ret_conv, true);
32117 }
32118
32119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32120         LDKTrustedCommitmentTransaction o_conv;
32121         o_conv.inner = untag_ptr(o);
32122         o_conv.is_owned = ptr_is_owned(o);
32123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32124         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
32125         
32126         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
32127         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
32128         return tag_ptr(ret_conv, true);
32129 }
32130
32131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
32132         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
32133         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
32134         return tag_ptr(ret_conv, true);
32135 }
32136
32137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32138         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
32139         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
32140         return ret_conv;
32141 }
32142
32143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32144         if (!ptr_is_owned(_res)) return;
32145         void* _res_ptr = untag_ptr(_res);
32146         CHECK_ACCESS(_res_ptr);
32147         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
32148         FREE(untag_ptr(_res));
32149         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
32150 }
32151
32152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
32153         LDKCVec_ECDSASignatureZ o_constr;
32154         o_constr.datalen = (*env)->GetArrayLength(env, o);
32155         if (o_constr.datalen > 0)
32156                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
32157         else
32158                 o_constr.data = NULL;
32159         for (size_t i = 0; i < o_constr.datalen; i++) {
32160                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
32161                 LDKECDSASignature o_conv_8_ref;
32162                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
32163                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
32164                 o_constr.data[i] = o_conv_8_ref;
32165         }
32166         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32167         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
32168         return tag_ptr(ret_conv, true);
32169 }
32170
32171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
32172         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32173         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
32174         return tag_ptr(ret_conv, true);
32175 }
32176
32177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32178         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
32179         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
32180         return ret_conv;
32181 }
32182
32183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32184         if (!ptr_is_owned(_res)) return;
32185         void* _res_ptr = untag_ptr(_res);
32186         CHECK_ACCESS(_res_ptr);
32187         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
32188         FREE(untag_ptr(_res));
32189         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
32190 }
32191
32192 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
32193         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32194         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
32195         return tag_ptr(ret_conv, true);
32196 }
32197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32198         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
32199         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
32200         return ret_conv;
32201 }
32202
32203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32204         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
32205         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32206         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
32207         return tag_ptr(ret_conv, true);
32208 }
32209
32210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32211         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32212         *ret_copy = COption_usizeZ_some(o);
32213         int64_t ret_ref = tag_ptr(ret_copy, true);
32214         return ret_ref;
32215 }
32216
32217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
32218         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32219         *ret_copy = COption_usizeZ_none();
32220         int64_t ret_ref = tag_ptr(ret_copy, true);
32221         return ret_ref;
32222 }
32223
32224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32225         if (!ptr_is_owned(_res)) return;
32226         void* _res_ptr = untag_ptr(_res);
32227         CHECK_ACCESS(_res_ptr);
32228         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
32229         FREE(untag_ptr(_res));
32230         COption_usizeZ_free(_res_conv);
32231 }
32232
32233 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
32234         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32235         *ret_copy = COption_usizeZ_clone(arg);
32236         int64_t ret_ref = tag_ptr(ret_copy, true);
32237         return ret_ref;
32238 }
32239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32240         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
32241         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
32242         return ret_conv;
32243 }
32244
32245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32246         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
32247         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32248         *ret_copy = COption_usizeZ_clone(orig_conv);
32249         int64_t ret_ref = tag_ptr(ret_copy, true);
32250         return ret_ref;
32251 }
32252
32253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32254         LDKShutdownScript o_conv;
32255         o_conv.inner = untag_ptr(o);
32256         o_conv.is_owned = ptr_is_owned(o);
32257         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32258         o_conv = ShutdownScript_clone(&o_conv);
32259         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32260         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
32261         return tag_ptr(ret_conv, true);
32262 }
32263
32264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32265         void* e_ptr = untag_ptr(e);
32266         CHECK_ACCESS(e_ptr);
32267         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32268         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32269         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32270         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
32271         return tag_ptr(ret_conv, true);
32272 }
32273
32274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32275         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
32276         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
32277         return ret_conv;
32278 }
32279
32280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32281         if (!ptr_is_owned(_res)) return;
32282         void* _res_ptr = untag_ptr(_res);
32283         CHECK_ACCESS(_res_ptr);
32284         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
32285         FREE(untag_ptr(_res));
32286         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
32287 }
32288
32289 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
32290         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32291         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
32292         return tag_ptr(ret_conv, true);
32293 }
32294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32295         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
32296         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
32297         return ret_conv;
32298 }
32299
32300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32301         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
32302         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32303         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
32304         return tag_ptr(ret_conv, true);
32305 }
32306
32307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32308         LDKShutdownScript o_conv;
32309         o_conv.inner = untag_ptr(o);
32310         o_conv.is_owned = ptr_is_owned(o);
32311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32312         o_conv = ShutdownScript_clone(&o_conv);
32313         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32314         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
32315         return tag_ptr(ret_conv, true);
32316 }
32317
32318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32319         LDKInvalidShutdownScript e_conv;
32320         e_conv.inner = untag_ptr(e);
32321         e_conv.is_owned = ptr_is_owned(e);
32322         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32323         e_conv = InvalidShutdownScript_clone(&e_conv);
32324         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32325         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
32326         return tag_ptr(ret_conv, true);
32327 }
32328
32329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32330         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
32331         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
32332         return ret_conv;
32333 }
32334
32335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32336         if (!ptr_is_owned(_res)) return;
32337         void* _res_ptr = untag_ptr(_res);
32338         CHECK_ACCESS(_res_ptr);
32339         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
32340         FREE(untag_ptr(_res));
32341         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
32342 }
32343
32344 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
32345         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32346         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
32347         return tag_ptr(ret_conv, true);
32348 }
32349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32350         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
32351         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
32352         return ret_conv;
32353 }
32354
32355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32356         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
32357         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32358         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
32359         return tag_ptr(ret_conv, true);
32360 }
32361
32362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32363         void* o_ptr = untag_ptr(o);
32364         CHECK_ACCESS(o_ptr);
32365         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
32366         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
32367         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32368         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
32369         return tag_ptr(ret_conv, true);
32370 }
32371
32372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32373         void* e_ptr = untag_ptr(e);
32374         CHECK_ACCESS(e_ptr);
32375         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32376         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32377         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32378         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
32379         return tag_ptr(ret_conv, true);
32380 }
32381
32382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32383         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
32384         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
32385         return ret_conv;
32386 }
32387
32388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32389         if (!ptr_is_owned(_res)) return;
32390         void* _res_ptr = untag_ptr(_res);
32391         CHECK_ACCESS(_res_ptr);
32392         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
32393         FREE(untag_ptr(_res));
32394         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
32395 }
32396
32397 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
32398         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32399         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
32400         return tag_ptr(ret_conv, true);
32401 }
32402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32403         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
32404         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
32405         return ret_conv;
32406 }
32407
32408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32409         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
32410         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32411         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
32412         return tag_ptr(ret_conv, true);
32413 }
32414
32415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32416         LDKClaimedHTLC o_conv;
32417         o_conv.inner = untag_ptr(o);
32418         o_conv.is_owned = ptr_is_owned(o);
32419         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32420         o_conv = ClaimedHTLC_clone(&o_conv);
32421         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32422         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
32423         return tag_ptr(ret_conv, true);
32424 }
32425
32426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32427         void* e_ptr = untag_ptr(e);
32428         CHECK_ACCESS(e_ptr);
32429         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32430         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32431         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32432         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
32433         return tag_ptr(ret_conv, true);
32434 }
32435
32436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32437         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
32438         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
32439         return ret_conv;
32440 }
32441
32442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32443         if (!ptr_is_owned(_res)) return;
32444         void* _res_ptr = untag_ptr(_res);
32445         CHECK_ACCESS(_res_ptr);
32446         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
32447         FREE(untag_ptr(_res));
32448         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
32449 }
32450
32451 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
32452         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32453         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
32454         return tag_ptr(ret_conv, true);
32455 }
32456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32457         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
32458         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
32459         return ret_conv;
32460 }
32461
32462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32463         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
32464         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32465         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
32466         return tag_ptr(ret_conv, true);
32467 }
32468
32469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32470         void* o_ptr = untag_ptr(o);
32471         CHECK_ACCESS(o_ptr);
32472         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
32473         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
32474         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32475         *ret_copy = COption_PathFailureZ_some(o_conv);
32476         int64_t ret_ref = tag_ptr(ret_copy, true);
32477         return ret_ref;
32478 }
32479
32480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
32481         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32482         *ret_copy = COption_PathFailureZ_none();
32483         int64_t ret_ref = tag_ptr(ret_copy, true);
32484         return ret_ref;
32485 }
32486
32487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32488         if (!ptr_is_owned(_res)) return;
32489         void* _res_ptr = untag_ptr(_res);
32490         CHECK_ACCESS(_res_ptr);
32491         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
32492         FREE(untag_ptr(_res));
32493         COption_PathFailureZ_free(_res_conv);
32494 }
32495
32496 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
32497         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32498         *ret_copy = COption_PathFailureZ_clone(arg);
32499         int64_t ret_ref = tag_ptr(ret_copy, true);
32500         return ret_ref;
32501 }
32502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32503         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
32504         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
32505         return ret_conv;
32506 }
32507
32508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32509         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
32510         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32511         *ret_copy = COption_PathFailureZ_clone(orig_conv);
32512         int64_t ret_ref = tag_ptr(ret_copy, true);
32513         return ret_ref;
32514 }
32515
32516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32517         void* o_ptr = untag_ptr(o);
32518         CHECK_ACCESS(o_ptr);
32519         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
32520         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
32521         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32522         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
32523         return tag_ptr(ret_conv, true);
32524 }
32525
32526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32527         void* e_ptr = untag_ptr(e);
32528         CHECK_ACCESS(e_ptr);
32529         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32530         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32531         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32532         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
32533         return tag_ptr(ret_conv, true);
32534 }
32535
32536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32537         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
32538         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
32539         return ret_conv;
32540 }
32541
32542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32543         if (!ptr_is_owned(_res)) return;
32544         void* _res_ptr = untag_ptr(_res);
32545         CHECK_ACCESS(_res_ptr);
32546         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
32547         FREE(untag_ptr(_res));
32548         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
32549 }
32550
32551 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
32552         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32553         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
32554         return tag_ptr(ret_conv, true);
32555 }
32556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32557         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
32558         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
32559         return ret_conv;
32560 }
32561
32562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32563         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
32564         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32565         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
32566         return tag_ptr(ret_conv, true);
32567 }
32568
32569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32570         void* o_ptr = untag_ptr(o);
32571         CHECK_ACCESS(o_ptr);
32572         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
32573         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
32574         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32575         *ret_copy = COption_ClosureReasonZ_some(o_conv);
32576         int64_t ret_ref = tag_ptr(ret_copy, true);
32577         return ret_ref;
32578 }
32579
32580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
32581         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32582         *ret_copy = COption_ClosureReasonZ_none();
32583         int64_t ret_ref = tag_ptr(ret_copy, true);
32584         return ret_ref;
32585 }
32586
32587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32588         if (!ptr_is_owned(_res)) return;
32589         void* _res_ptr = untag_ptr(_res);
32590         CHECK_ACCESS(_res_ptr);
32591         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
32592         FREE(untag_ptr(_res));
32593         COption_ClosureReasonZ_free(_res_conv);
32594 }
32595
32596 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
32597         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32598         *ret_copy = COption_ClosureReasonZ_clone(arg);
32599         int64_t ret_ref = tag_ptr(ret_copy, true);
32600         return ret_ref;
32601 }
32602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32603         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
32604         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
32605         return ret_conv;
32606 }
32607
32608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32609         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
32610         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32611         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
32612         int64_t ret_ref = tag_ptr(ret_copy, true);
32613         return ret_ref;
32614 }
32615
32616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32617         void* o_ptr = untag_ptr(o);
32618         CHECK_ACCESS(o_ptr);
32619         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
32620         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
32621         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32622         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
32623         return tag_ptr(ret_conv, true);
32624 }
32625
32626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32627         void* e_ptr = untag_ptr(e);
32628         CHECK_ACCESS(e_ptr);
32629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32631         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32632         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
32633         return tag_ptr(ret_conv, true);
32634 }
32635
32636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32637         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
32638         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
32639         return ret_conv;
32640 }
32641
32642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32643         if (!ptr_is_owned(_res)) return;
32644         void* _res_ptr = untag_ptr(_res);
32645         CHECK_ACCESS(_res_ptr);
32646         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
32647         FREE(untag_ptr(_res));
32648         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
32649 }
32650
32651 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
32652         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32653         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
32654         return tag_ptr(ret_conv, true);
32655 }
32656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32657         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
32658         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
32659         return ret_conv;
32660 }
32661
32662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32663         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
32664         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32665         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
32666         return tag_ptr(ret_conv, true);
32667 }
32668
32669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32670         void* o_ptr = untag_ptr(o);
32671         CHECK_ACCESS(o_ptr);
32672         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
32673         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
32674         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32675         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
32676         int64_t ret_ref = tag_ptr(ret_copy, true);
32677         return ret_ref;
32678 }
32679
32680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
32681         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32682         *ret_copy = COption_HTLCDestinationZ_none();
32683         int64_t ret_ref = tag_ptr(ret_copy, true);
32684         return ret_ref;
32685 }
32686
32687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32688         if (!ptr_is_owned(_res)) return;
32689         void* _res_ptr = untag_ptr(_res);
32690         CHECK_ACCESS(_res_ptr);
32691         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
32692         FREE(untag_ptr(_res));
32693         COption_HTLCDestinationZ_free(_res_conv);
32694 }
32695
32696 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
32697         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32698         *ret_copy = COption_HTLCDestinationZ_clone(arg);
32699         int64_t ret_ref = tag_ptr(ret_copy, true);
32700         return ret_ref;
32701 }
32702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32703         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
32704         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
32705         return ret_conv;
32706 }
32707
32708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32709         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
32710         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32711         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
32712         int64_t ret_ref = tag_ptr(ret_copy, true);
32713         return ret_ref;
32714 }
32715
32716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32717         void* o_ptr = untag_ptr(o);
32718         CHECK_ACCESS(o_ptr);
32719         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
32720         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
32721         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32722         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
32723         return tag_ptr(ret_conv, true);
32724 }
32725
32726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32727         void* e_ptr = untag_ptr(e);
32728         CHECK_ACCESS(e_ptr);
32729         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32730         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32731         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32732         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
32733         return tag_ptr(ret_conv, true);
32734 }
32735
32736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32737         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
32738         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
32739         return ret_conv;
32740 }
32741
32742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32743         if (!ptr_is_owned(_res)) return;
32744         void* _res_ptr = untag_ptr(_res);
32745         CHECK_ACCESS(_res_ptr);
32746         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
32747         FREE(untag_ptr(_res));
32748         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
32749 }
32750
32751 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
32752         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32753         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
32754         return tag_ptr(ret_conv, true);
32755 }
32756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32757         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
32758         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
32759         return ret_conv;
32760 }
32761
32762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32763         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
32764         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32765         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
32766         return tag_ptr(ret_conv, true);
32767 }
32768
32769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
32770         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
32771         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32772         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
32773         return tag_ptr(ret_conv, true);
32774 }
32775
32776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32777         void* e_ptr = untag_ptr(e);
32778         CHECK_ACCESS(e_ptr);
32779         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32780         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32781         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32782         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
32783         return tag_ptr(ret_conv, true);
32784 }
32785
32786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32787         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
32788         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
32789         return ret_conv;
32790 }
32791
32792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32793         if (!ptr_is_owned(_res)) return;
32794         void* _res_ptr = untag_ptr(_res);
32795         CHECK_ACCESS(_res_ptr);
32796         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
32797         FREE(untag_ptr(_res));
32798         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
32799 }
32800
32801 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
32802         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32803         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
32804         return tag_ptr(ret_conv, true);
32805 }
32806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32807         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
32808         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
32809         return ret_conv;
32810 }
32811
32812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32813         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
32814         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32815         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
32816         return tag_ptr(ret_conv, true);
32817 }
32818
32819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
32820         LDKU128 o_ref;
32821         CHECK((*env)->GetArrayLength(env, o) == 16);
32822         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
32823         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32824         *ret_copy = COption_U128Z_some(o_ref);
32825         int64_t ret_ref = tag_ptr(ret_copy, true);
32826         return ret_ref;
32827 }
32828
32829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
32830         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32831         *ret_copy = COption_U128Z_none();
32832         int64_t ret_ref = tag_ptr(ret_copy, true);
32833         return ret_ref;
32834 }
32835
32836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
32837         if (!ptr_is_owned(_res)) return;
32838         void* _res_ptr = untag_ptr(_res);
32839         CHECK_ACCESS(_res_ptr);
32840         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
32841         FREE(untag_ptr(_res));
32842         COption_U128Z_free(_res_conv);
32843 }
32844
32845 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
32846         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32847         *ret_copy = COption_U128Z_clone(arg);
32848         int64_t ret_ref = tag_ptr(ret_copy, true);
32849         return ret_ref;
32850 }
32851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32852         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
32853         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
32854         return ret_conv;
32855 }
32856
32857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32858         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
32859         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32860         *ret_copy = COption_U128Z_clone(orig_conv);
32861         int64_t ret_ref = tag_ptr(ret_copy, true);
32862         return ret_ref;
32863 }
32864
32865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32866         LDKCVec_ClaimedHTLCZ _res_constr;
32867         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32868         if (_res_constr.datalen > 0)
32869                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
32870         else
32871                 _res_constr.data = NULL;
32872         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32873         for (size_t n = 0; n < _res_constr.datalen; n++) {
32874                 int64_t _res_conv_13 = _res_vals[n];
32875                 LDKClaimedHTLC _res_conv_13_conv;
32876                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32877                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32878                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32879                 _res_constr.data[n] = _res_conv_13_conv;
32880         }
32881         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32882         CVec_ClaimedHTLCZ_free(_res_constr);
32883 }
32884
32885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
32886         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
32887         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32888         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
32889         int64_t ret_ref = tag_ptr(ret_copy, true);
32890         return ret_ref;
32891 }
32892
32893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
32894         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32895         *ret_copy = COption_PaymentFailureReasonZ_none();
32896         int64_t ret_ref = tag_ptr(ret_copy, true);
32897         return ret_ref;
32898 }
32899
32900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32901         if (!ptr_is_owned(_res)) return;
32902         void* _res_ptr = untag_ptr(_res);
32903         CHECK_ACCESS(_res_ptr);
32904         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
32905         FREE(untag_ptr(_res));
32906         COption_PaymentFailureReasonZ_free(_res_conv);
32907 }
32908
32909 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
32910         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32911         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
32912         int64_t ret_ref = tag_ptr(ret_copy, true);
32913         return ret_ref;
32914 }
32915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32916         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
32917         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
32918         return ret_conv;
32919 }
32920
32921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32922         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32923         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32924         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32925         int64_t ret_ref = tag_ptr(ret_copy, true);
32926         return ret_ref;
32927 }
32928
32929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32930         void* o_ptr = untag_ptr(o);
32931         CHECK_ACCESS(o_ptr);
32932         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32933         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32934         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32935         *ret_copy = COption_EventZ_some(o_conv);
32936         int64_t ret_ref = tag_ptr(ret_copy, true);
32937         return ret_ref;
32938 }
32939
32940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
32941         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32942         *ret_copy = COption_EventZ_none();
32943         int64_t ret_ref = tag_ptr(ret_copy, true);
32944         return ret_ref;
32945 }
32946
32947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32948         if (!ptr_is_owned(_res)) return;
32949         void* _res_ptr = untag_ptr(_res);
32950         CHECK_ACCESS(_res_ptr);
32951         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32952         FREE(untag_ptr(_res));
32953         COption_EventZ_free(_res_conv);
32954 }
32955
32956 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32957         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32958         *ret_copy = COption_EventZ_clone(arg);
32959         int64_t ret_ref = tag_ptr(ret_copy, true);
32960         return ret_ref;
32961 }
32962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32963         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32964         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32965         return ret_conv;
32966 }
32967
32968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32969         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32970         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32971         *ret_copy = COption_EventZ_clone(orig_conv);
32972         int64_t ret_ref = tag_ptr(ret_copy, true);
32973         return ret_ref;
32974 }
32975
32976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32977         void* o_ptr = untag_ptr(o);
32978         CHECK_ACCESS(o_ptr);
32979         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32980         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32981         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32982         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32983         return tag_ptr(ret_conv, true);
32984 }
32985
32986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32987         void* e_ptr = untag_ptr(e);
32988         CHECK_ACCESS(e_ptr);
32989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32991         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32992         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32993         return tag_ptr(ret_conv, true);
32994 }
32995
32996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32997         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32998         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32999         return ret_conv;
33000 }
33001
33002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33003         if (!ptr_is_owned(_res)) return;
33004         void* _res_ptr = untag_ptr(_res);
33005         CHECK_ACCESS(_res_ptr);
33006         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
33007         FREE(untag_ptr(_res));
33008         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
33009 }
33010
33011 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
33012         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
33013         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
33014         return tag_ptr(ret_conv, true);
33015 }
33016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33017         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
33018         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
33019         return ret_conv;
33020 }
33021
33022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33023         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
33024         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
33025         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
33026         return tag_ptr(ret_conv, true);
33027 }
33028
33029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
33030         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
33031         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
33032         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
33033         return tag_ptr(ret_conv, true);
33034 }
33035
33036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33037         void* e_ptr = untag_ptr(e);
33038         CHECK_ACCESS(e_ptr);
33039         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
33040         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
33041         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
33042         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
33043         return tag_ptr(ret_conv, true);
33044 }
33045
33046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33047         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
33048         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
33049         return ret_conv;
33050 }
33051
33052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33053         if (!ptr_is_owned(_res)) return;
33054         void* _res_ptr = untag_ptr(_res);
33055         CHECK_ACCESS(_res_ptr);
33056         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
33057         FREE(untag_ptr(_res));
33058         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
33059 }
33060
33061 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
33062         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
33063         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
33064         return tag_ptr(ret_conv, true);
33065 }
33066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33067         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
33068         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
33069         return ret_conv;
33070 }
33071
33072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33073         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
33074         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
33075         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
33076         return tag_ptr(ret_conv, true);
33077 }
33078
33079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33080         LDKBolt11Invoice o_conv;
33081         o_conv.inner = untag_ptr(o);
33082         o_conv.is_owned = ptr_is_owned(o);
33083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33084         o_conv = Bolt11Invoice_clone(&o_conv);
33085         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33086         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
33087         return tag_ptr(ret_conv, true);
33088 }
33089
33090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33091         void* e_ptr = untag_ptr(e);
33092         CHECK_ACCESS(e_ptr);
33093         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
33094         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
33095         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33096         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
33097         return tag_ptr(ret_conv, true);
33098 }
33099
33100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33101         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
33102         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
33103         return ret_conv;
33104 }
33105
33106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33107         if (!ptr_is_owned(_res)) return;
33108         void* _res_ptr = untag_ptr(_res);
33109         CHECK_ACCESS(_res_ptr);
33110         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
33111         FREE(untag_ptr(_res));
33112         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
33113 }
33114
33115 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
33116         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33117         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
33118         return tag_ptr(ret_conv, true);
33119 }
33120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33121         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
33122         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
33123         return ret_conv;
33124 }
33125
33126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33127         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
33128         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33129         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
33130         return tag_ptr(ret_conv, true);
33131 }
33132
33133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33134         LDKSignedRawBolt11Invoice o_conv;
33135         o_conv.inner = untag_ptr(o);
33136         o_conv.is_owned = ptr_is_owned(o);
33137         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33138         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
33139         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33140         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
33141         return tag_ptr(ret_conv, true);
33142 }
33143
33144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33145         void* e_ptr = untag_ptr(e);
33146         CHECK_ACCESS(e_ptr);
33147         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
33148         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
33149         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33150         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
33151         return tag_ptr(ret_conv, true);
33152 }
33153
33154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33155         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
33156         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
33157         return ret_conv;
33158 }
33159
33160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33161         if (!ptr_is_owned(_res)) return;
33162         void* _res_ptr = untag_ptr(_res);
33163         CHECK_ACCESS(_res_ptr);
33164         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
33165         FREE(untag_ptr(_res));
33166         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
33167 }
33168
33169 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
33170         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33171         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
33172         return tag_ptr(ret_conv, true);
33173 }
33174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33175         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
33176         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
33177         return ret_conv;
33178 }
33179
33180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33181         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
33182         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33183         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
33184         return tag_ptr(ret_conv, true);
33185 }
33186
33187 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
33188         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33189         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
33190         return tag_ptr(ret_conv, true);
33191 }
33192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33193         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
33194         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
33195         return ret_conv;
33196 }
33197
33198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33199         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
33200         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33201         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
33202         return tag_ptr(ret_conv, true);
33203 }
33204
33205 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) {
33206         LDKRawBolt11Invoice a_conv;
33207         a_conv.inner = untag_ptr(a);
33208         a_conv.is_owned = ptr_is_owned(a);
33209         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33210         a_conv = RawBolt11Invoice_clone(&a_conv);
33211         LDKThirtyTwoBytes b_ref;
33212         CHECK((*env)->GetArrayLength(env, b) == 32);
33213         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
33214         LDKBolt11InvoiceSignature c_conv;
33215         c_conv.inner = untag_ptr(c);
33216         c_conv.is_owned = ptr_is_owned(c);
33217         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
33218         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
33219         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33220         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
33221         return tag_ptr(ret_conv, true);
33222 }
33223
33224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33225         if (!ptr_is_owned(_res)) return;
33226         void* _res_ptr = untag_ptr(_res);
33227         CHECK_ACCESS(_res_ptr);
33228         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
33229         FREE(untag_ptr(_res));
33230         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
33231 }
33232
33233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33234         LDKPayeePubKey o_conv;
33235         o_conv.inner = untag_ptr(o);
33236         o_conv.is_owned = ptr_is_owned(o);
33237         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33238         o_conv = PayeePubKey_clone(&o_conv);
33239         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33240         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
33241         return tag_ptr(ret_conv, true);
33242 }
33243
33244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33245         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
33246         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33247         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
33248         return tag_ptr(ret_conv, true);
33249 }
33250
33251 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33252         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
33253         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
33254         return ret_conv;
33255 }
33256
33257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33258         if (!ptr_is_owned(_res)) return;
33259         void* _res_ptr = untag_ptr(_res);
33260         CHECK_ACCESS(_res_ptr);
33261         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
33262         FREE(untag_ptr(_res));
33263         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
33264 }
33265
33266 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
33267         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33268         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
33269         return tag_ptr(ret_conv, true);
33270 }
33271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33272         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
33273         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
33274         return ret_conv;
33275 }
33276
33277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33278         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
33279         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33280         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
33281         return tag_ptr(ret_conv, true);
33282 }
33283
33284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33285         LDKCVec_PrivateRouteZ _res_constr;
33286         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33287         if (_res_constr.datalen > 0)
33288                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
33289         else
33290                 _res_constr.data = NULL;
33291         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33292         for (size_t o = 0; o < _res_constr.datalen; o++) {
33293                 int64_t _res_conv_14 = _res_vals[o];
33294                 LDKPrivateRoute _res_conv_14_conv;
33295                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
33296                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
33297                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
33298                 _res_constr.data[o] = _res_conv_14_conv;
33299         }
33300         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33301         CVec_PrivateRouteZ_free(_res_constr);
33302 }
33303
33304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33305         LDKPositiveTimestamp o_conv;
33306         o_conv.inner = untag_ptr(o);
33307         o_conv.is_owned = ptr_is_owned(o);
33308         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33309         o_conv = PositiveTimestamp_clone(&o_conv);
33310         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33311         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
33312         return tag_ptr(ret_conv, true);
33313 }
33314
33315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33316         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
33317         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33318         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
33319         return tag_ptr(ret_conv, true);
33320 }
33321
33322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33323         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
33324         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
33325         return ret_conv;
33326 }
33327
33328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33329         if (!ptr_is_owned(_res)) return;
33330         void* _res_ptr = untag_ptr(_res);
33331         CHECK_ACCESS(_res_ptr);
33332         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
33333         FREE(untag_ptr(_res));
33334         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
33335 }
33336
33337 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
33338         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33339         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
33340         return tag_ptr(ret_conv, true);
33341 }
33342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33343         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
33344         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
33345         return ret_conv;
33346 }
33347
33348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33349         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
33350         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33351         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
33352         return tag_ptr(ret_conv, true);
33353 }
33354
33355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
33356         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33357         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
33358         return tag_ptr(ret_conv, true);
33359 }
33360
33361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33362         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
33363         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33364         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
33365         return tag_ptr(ret_conv, true);
33366 }
33367
33368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33369         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
33370         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
33371         return ret_conv;
33372 }
33373
33374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33375         if (!ptr_is_owned(_res)) return;
33376         void* _res_ptr = untag_ptr(_res);
33377         CHECK_ACCESS(_res_ptr);
33378         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
33379         FREE(untag_ptr(_res));
33380         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
33381 }
33382
33383 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
33384         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33385         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
33386         return tag_ptr(ret_conv, true);
33387 }
33388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33389         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
33390         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
33391         return ret_conv;
33392 }
33393
33394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33395         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
33396         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33397         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
33398         return tag_ptr(ret_conv, true);
33399 }
33400
33401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33402         LDKBolt11Invoice o_conv;
33403         o_conv.inner = untag_ptr(o);
33404         o_conv.is_owned = ptr_is_owned(o);
33405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33406         o_conv = Bolt11Invoice_clone(&o_conv);
33407         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33408         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
33409         return tag_ptr(ret_conv, true);
33410 }
33411
33412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33413         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
33414         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33415         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
33416         return tag_ptr(ret_conv, true);
33417 }
33418
33419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33420         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
33421         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
33422         return ret_conv;
33423 }
33424
33425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33426         if (!ptr_is_owned(_res)) return;
33427         void* _res_ptr = untag_ptr(_res);
33428         CHECK_ACCESS(_res_ptr);
33429         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
33430         FREE(untag_ptr(_res));
33431         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
33432 }
33433
33434 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
33435         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33436         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
33437         return tag_ptr(ret_conv, true);
33438 }
33439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33440         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
33441         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
33442         return ret_conv;
33443 }
33444
33445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33446         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
33447         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33448         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
33449         return tag_ptr(ret_conv, true);
33450 }
33451
33452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33453         LDKDescription o_conv;
33454         o_conv.inner = untag_ptr(o);
33455         o_conv.is_owned = ptr_is_owned(o);
33456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33457         o_conv = Description_clone(&o_conv);
33458         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33459         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
33460         return tag_ptr(ret_conv, true);
33461 }
33462
33463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33464         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
33465         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33466         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
33467         return tag_ptr(ret_conv, true);
33468 }
33469
33470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33471         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
33472         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
33473         return ret_conv;
33474 }
33475
33476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33477         if (!ptr_is_owned(_res)) return;
33478         void* _res_ptr = untag_ptr(_res);
33479         CHECK_ACCESS(_res_ptr);
33480         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
33481         FREE(untag_ptr(_res));
33482         CResult_DescriptionCreationErrorZ_free(_res_conv);
33483 }
33484
33485 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
33486         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33487         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
33488         return tag_ptr(ret_conv, true);
33489 }
33490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33491         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
33492         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
33493         return ret_conv;
33494 }
33495
33496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33497         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
33498         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33499         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
33500         return tag_ptr(ret_conv, true);
33501 }
33502
33503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33504         LDKPrivateRoute o_conv;
33505         o_conv.inner = untag_ptr(o);
33506         o_conv.is_owned = ptr_is_owned(o);
33507         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33508         o_conv = PrivateRoute_clone(&o_conv);
33509         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33510         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
33511         return tag_ptr(ret_conv, true);
33512 }
33513
33514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33515         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
33516         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33517         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
33518         return tag_ptr(ret_conv, true);
33519 }
33520
33521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33522         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
33523         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
33524         return ret_conv;
33525 }
33526
33527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33528         if (!ptr_is_owned(_res)) return;
33529         void* _res_ptr = untag_ptr(_res);
33530         CHECK_ACCESS(_res_ptr);
33531         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
33532         FREE(untag_ptr(_res));
33533         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
33534 }
33535
33536 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
33537         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33538         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
33539         return tag_ptr(ret_conv, true);
33540 }
33541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33542         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
33543         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
33544         return ret_conv;
33545 }
33546
33547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33548         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
33549         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33550         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
33551         return tag_ptr(ret_conv, true);
33552 }
33553
33554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33555         LDKOutPoint o_conv;
33556         o_conv.inner = untag_ptr(o);
33557         o_conv.is_owned = ptr_is_owned(o);
33558         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33559         o_conv = OutPoint_clone(&o_conv);
33560         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33561         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
33562         return tag_ptr(ret_conv, true);
33563 }
33564
33565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33566         void* e_ptr = untag_ptr(e);
33567         CHECK_ACCESS(e_ptr);
33568         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33569         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33570         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33571         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
33572         return tag_ptr(ret_conv, true);
33573 }
33574
33575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33576         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
33577         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
33578         return ret_conv;
33579 }
33580
33581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33582         if (!ptr_is_owned(_res)) return;
33583         void* _res_ptr = untag_ptr(_res);
33584         CHECK_ACCESS(_res_ptr);
33585         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
33586         FREE(untag_ptr(_res));
33587         CResult_OutPointDecodeErrorZ_free(_res_conv);
33588 }
33589
33590 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
33591         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33592         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
33593         return tag_ptr(ret_conv, true);
33594 }
33595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33596         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
33597         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
33598         return ret_conv;
33599 }
33600
33601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33602         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
33603         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33604         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
33605         return tag_ptr(ret_conv, true);
33606 }
33607
33608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33609         LDKBigSize o_conv;
33610         o_conv.inner = untag_ptr(o);
33611         o_conv.is_owned = ptr_is_owned(o);
33612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33613         o_conv = BigSize_clone(&o_conv);
33614         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33615         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
33616         return tag_ptr(ret_conv, true);
33617 }
33618
33619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33620         void* e_ptr = untag_ptr(e);
33621         CHECK_ACCESS(e_ptr);
33622         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33623         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33624         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33625         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
33626         return tag_ptr(ret_conv, true);
33627 }
33628
33629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33630         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
33631         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
33632         return ret_conv;
33633 }
33634
33635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33636         if (!ptr_is_owned(_res)) return;
33637         void* _res_ptr = untag_ptr(_res);
33638         CHECK_ACCESS(_res_ptr);
33639         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
33640         FREE(untag_ptr(_res));
33641         CResult_BigSizeDecodeErrorZ_free(_res_conv);
33642 }
33643
33644 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
33645         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33646         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
33647         return tag_ptr(ret_conv, true);
33648 }
33649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33650         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
33651         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
33652         return ret_conv;
33653 }
33654
33655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33656         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
33657         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33658         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
33659         return tag_ptr(ret_conv, true);
33660 }
33661
33662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33663         LDKHostname o_conv;
33664         o_conv.inner = untag_ptr(o);
33665         o_conv.is_owned = ptr_is_owned(o);
33666         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33667         o_conv = Hostname_clone(&o_conv);
33668         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33669         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
33670         return tag_ptr(ret_conv, true);
33671 }
33672
33673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33674         void* e_ptr = untag_ptr(e);
33675         CHECK_ACCESS(e_ptr);
33676         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33677         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33678         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33679         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
33680         return tag_ptr(ret_conv, true);
33681 }
33682
33683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33684         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
33685         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
33686         return ret_conv;
33687 }
33688
33689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33690         if (!ptr_is_owned(_res)) return;
33691         void* _res_ptr = untag_ptr(_res);
33692         CHECK_ACCESS(_res_ptr);
33693         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
33694         FREE(untag_ptr(_res));
33695         CResult_HostnameDecodeErrorZ_free(_res_conv);
33696 }
33697
33698 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
33699         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33700         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
33701         return tag_ptr(ret_conv, true);
33702 }
33703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33704         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
33705         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
33706         return ret_conv;
33707 }
33708
33709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33710         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
33711         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33712         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
33713         return tag_ptr(ret_conv, true);
33714 }
33715
33716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33717         LDKTransactionU16LenLimited o_conv;
33718         o_conv.inner = untag_ptr(o);
33719         o_conv.is_owned = ptr_is_owned(o);
33720         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33721         o_conv = TransactionU16LenLimited_clone(&o_conv);
33722         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33723         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
33724         return tag_ptr(ret_conv, true);
33725 }
33726
33727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
33728         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33729         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
33730         return tag_ptr(ret_conv, true);
33731 }
33732
33733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33734         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
33735         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
33736         return ret_conv;
33737 }
33738
33739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33740         if (!ptr_is_owned(_res)) return;
33741         void* _res_ptr = untag_ptr(_res);
33742         CHECK_ACCESS(_res_ptr);
33743         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
33744         FREE(untag_ptr(_res));
33745         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
33746 }
33747
33748 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
33749         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33750         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
33751         return tag_ptr(ret_conv, true);
33752 }
33753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33754         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
33755         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
33756         return ret_conv;
33757 }
33758
33759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33760         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
33761         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33762         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
33763         return tag_ptr(ret_conv, true);
33764 }
33765
33766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33767         LDKTransactionU16LenLimited o_conv;
33768         o_conv.inner = untag_ptr(o);
33769         o_conv.is_owned = ptr_is_owned(o);
33770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33771         o_conv = TransactionU16LenLimited_clone(&o_conv);
33772         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33773         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
33774         return tag_ptr(ret_conv, true);
33775 }
33776
33777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33778         void* e_ptr = untag_ptr(e);
33779         CHECK_ACCESS(e_ptr);
33780         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33781         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33782         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33783         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
33784         return tag_ptr(ret_conv, true);
33785 }
33786
33787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33788         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
33789         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
33790         return ret_conv;
33791 }
33792
33793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33794         if (!ptr_is_owned(_res)) return;
33795         void* _res_ptr = untag_ptr(_res);
33796         CHECK_ACCESS(_res_ptr);
33797         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
33798         FREE(untag_ptr(_res));
33799         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
33800 }
33801
33802 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
33803         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33804         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
33805         return tag_ptr(ret_conv, true);
33806 }
33807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33808         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
33809         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
33810         return ret_conv;
33811 }
33812
33813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33814         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
33815         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33816         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
33817         return tag_ptr(ret_conv, true);
33818 }
33819
33820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33821         LDKUntrustedString o_conv;
33822         o_conv.inner = untag_ptr(o);
33823         o_conv.is_owned = ptr_is_owned(o);
33824         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33825         o_conv = UntrustedString_clone(&o_conv);
33826         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33827         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
33828         return tag_ptr(ret_conv, true);
33829 }
33830
33831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33832         void* e_ptr = untag_ptr(e);
33833         CHECK_ACCESS(e_ptr);
33834         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33835         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33836         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33837         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
33838         return tag_ptr(ret_conv, true);
33839 }
33840
33841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33842         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
33843         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
33844         return ret_conv;
33845 }
33846
33847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33848         if (!ptr_is_owned(_res)) return;
33849         void* _res_ptr = untag_ptr(_res);
33850         CHECK_ACCESS(_res_ptr);
33851         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
33852         FREE(untag_ptr(_res));
33853         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
33854 }
33855
33856 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
33857         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33858         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
33859         return tag_ptr(ret_conv, true);
33860 }
33861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33862         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
33863         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
33864         return ret_conv;
33865 }
33866
33867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33868         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
33869         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33870         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
33871         return tag_ptr(ret_conv, true);
33872 }
33873
33874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33875         LDKReceiveTlvs o_conv;
33876         o_conv.inner = untag_ptr(o);
33877         o_conv.is_owned = ptr_is_owned(o);
33878         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33879         o_conv = ReceiveTlvs_clone(&o_conv);
33880         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33881         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_ok(o_conv);
33882         return tag_ptr(ret_conv, true);
33883 }
33884
33885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33886         void* e_ptr = untag_ptr(e);
33887         CHECK_ACCESS(e_ptr);
33888         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33889         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33890         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33891         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_err(e_conv);
33892         return tag_ptr(ret_conv, true);
33893 }
33894
33895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33896         LDKCResult_ReceiveTlvsDecodeErrorZ* o_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(o);
33897         jboolean ret_conv = CResult_ReceiveTlvsDecodeErrorZ_is_ok(o_conv);
33898         return ret_conv;
33899 }
33900
33901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33902         if (!ptr_is_owned(_res)) return;
33903         void* _res_ptr = untag_ptr(_res);
33904         CHECK_ACCESS(_res_ptr);
33905         LDKCResult_ReceiveTlvsDecodeErrorZ _res_conv = *(LDKCResult_ReceiveTlvsDecodeErrorZ*)(_res_ptr);
33906         FREE(untag_ptr(_res));
33907         CResult_ReceiveTlvsDecodeErrorZ_free(_res_conv);
33908 }
33909
33910 static inline uint64_t CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR arg) {
33911         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33912         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(arg);
33913         return tag_ptr(ret_conv, true);
33914 }
33915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33916         LDKCResult_ReceiveTlvsDecodeErrorZ* arg_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(arg);
33917         int64_t ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone_ptr(arg_conv);
33918         return ret_conv;
33919 }
33920
33921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReceiveTlvsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33922         LDKCResult_ReceiveTlvsDecodeErrorZ* orig_conv = (LDKCResult_ReceiveTlvsDecodeErrorZ*)untag_ptr(orig);
33923         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
33924         *ret_conv = CResult_ReceiveTlvsDecodeErrorZ_clone(orig_conv);
33925         return tag_ptr(ret_conv, true);
33926 }
33927
33928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33929         LDKPaymentRelay o_conv;
33930         o_conv.inner = untag_ptr(o);
33931         o_conv.is_owned = ptr_is_owned(o);
33932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33933         o_conv = PaymentRelay_clone(&o_conv);
33934         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33935         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33936         return tag_ptr(ret_conv, true);
33937 }
33938
33939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33940         void* e_ptr = untag_ptr(e);
33941         CHECK_ACCESS(e_ptr);
33942         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33943         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33944         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33945         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33946         return tag_ptr(ret_conv, true);
33947 }
33948
33949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33950         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33951         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33952         return ret_conv;
33953 }
33954
33955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33956         if (!ptr_is_owned(_res)) return;
33957         void* _res_ptr = untag_ptr(_res);
33958         CHECK_ACCESS(_res_ptr);
33959         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33960         FREE(untag_ptr(_res));
33961         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33962 }
33963
33964 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33965         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33966         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33967         return tag_ptr(ret_conv, true);
33968 }
33969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33970         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33971         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33972         return ret_conv;
33973 }
33974
33975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33976         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33977         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33978         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33979         return tag_ptr(ret_conv, true);
33980 }
33981
33982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33983         LDKPaymentConstraints o_conv;
33984         o_conv.inner = untag_ptr(o);
33985         o_conv.is_owned = ptr_is_owned(o);
33986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33987         o_conv = PaymentConstraints_clone(&o_conv);
33988         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33989         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33990         return tag_ptr(ret_conv, true);
33991 }
33992
33993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33994         void* e_ptr = untag_ptr(e);
33995         CHECK_ACCESS(e_ptr);
33996         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33997         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33998         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33999         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
34000         return tag_ptr(ret_conv, true);
34001 }
34002
34003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34004         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
34005         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
34006         return ret_conv;
34007 }
34008
34009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34010         if (!ptr_is_owned(_res)) return;
34011         void* _res_ptr = untag_ptr(_res);
34012         CHECK_ACCESS(_res_ptr);
34013         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
34014         FREE(untag_ptr(_res));
34015         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
34016 }
34017
34018 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
34019         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
34020         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
34021         return tag_ptr(ret_conv, true);
34022 }
34023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34024         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
34025         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
34026         return ret_conv;
34027 }
34028
34029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34030         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
34031         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
34032         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
34033         return tag_ptr(ret_conv, true);
34034 }
34035
34036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
34037         LDKThirtyTwoBytes o_ref;
34038         CHECK((*env)->GetArrayLength(env, o) == 32);
34039         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
34040         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
34041         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_ok(o_ref);
34042         return tag_ptr(ret_conv, true);
34043 }
34044
34045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34046         void* e_ptr = untag_ptr(e);
34047         CHECK_ACCESS(e_ptr);
34048         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
34049         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
34050         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
34051         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_err(e_conv);
34052         return tag_ptr(ret_conv, true);
34053 }
34054
34055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34056         LDKCResult_ThirtyTwoBytesPaymentErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(o);
34057         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(o_conv);
34058         return ret_conv;
34059 }
34060
34061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34062         if (!ptr_is_owned(_res)) return;
34063         void* _res_ptr = untag_ptr(_res);
34064         CHECK_ACCESS(_res_ptr);
34065         LDKCResult_ThirtyTwoBytesPaymentErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentErrorZ*)(_res_ptr);
34066         FREE(untag_ptr(_res));
34067         CResult_ThirtyTwoBytesPaymentErrorZ_free(_res_conv);
34068 }
34069
34070 static inline uint64_t CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR arg) {
34071         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
34072         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(arg);
34073         return tag_ptr(ret_conv, true);
34074 }
34075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34076         LDKCResult_ThirtyTwoBytesPaymentErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(arg);
34077         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone_ptr(arg_conv);
34078         return ret_conv;
34079 }
34080
34081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34082         LDKCResult_ThirtyTwoBytesPaymentErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentErrorZ*)untag_ptr(orig);
34083         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
34084         *ret_conv = CResult_ThirtyTwoBytesPaymentErrorZ_clone(orig_conv);
34085         return tag_ptr(ret_conv, true);
34086 }
34087
34088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1ok(JNIEnv *env, jclass clz) {
34089         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
34090         *ret_conv = CResult_NonePaymentErrorZ_ok();
34091         return tag_ptr(ret_conv, true);
34092 }
34093
34094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34095         void* e_ptr = untag_ptr(e);
34096         CHECK_ACCESS(e_ptr);
34097         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
34098         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
34099         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
34100         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
34101         return tag_ptr(ret_conv, true);
34102 }
34103
34104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34105         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
34106         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
34107         return ret_conv;
34108 }
34109
34110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34111         if (!ptr_is_owned(_res)) return;
34112         void* _res_ptr = untag_ptr(_res);
34113         CHECK_ACCESS(_res_ptr);
34114         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
34115         FREE(untag_ptr(_res));
34116         CResult_NonePaymentErrorZ_free(_res_conv);
34117 }
34118
34119 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
34120         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
34121         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
34122         return tag_ptr(ret_conv, true);
34123 }
34124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34125         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
34126         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
34127         return ret_conv;
34128 }
34129
34130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34131         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
34132         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
34133         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
34134         return tag_ptr(ret_conv, true);
34135 }
34136
34137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
34138         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
34139         o_constr.datalen = (*env)->GetArrayLength(env, o);
34140         if (o_constr.datalen > 0)
34141                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
34142         else
34143                 o_constr.data = NULL;
34144         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
34145         for (size_t o = 0; o < o_constr.datalen; o++) {
34146                 int64_t o_conv_40 = o_vals[o];
34147                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
34148                 CHECK_ACCESS(o_conv_40_ptr);
34149                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
34150                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
34151                 o_constr.data[o] = o_conv_40_conv;
34152         }
34153         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
34154         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
34155         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(o_constr);
34156         return tag_ptr(ret_conv, true);
34157 }
34158
34159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34160         void* e_ptr = untag_ptr(e);
34161         CHECK_ACCESS(e_ptr);
34162         LDKProbingError e_conv = *(LDKProbingError*)(e_ptr);
34163         e_conv = ProbingError_clone((LDKProbingError*)untag_ptr(e));
34164         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
34165         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(e_conv);
34166         return tag_ptr(ret_conv, true);
34167 }
34168
34169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34170         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(o);
34171         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(o_conv);
34172         return ret_conv;
34173 }
34174
34175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34176         if (!ptr_is_owned(_res)) return;
34177         void* _res_ptr = untag_ptr(_res);
34178         CHECK_ACCESS(_res_ptr);
34179         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)(_res_ptr);
34180         FREE(untag_ptr(_res));
34181         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(_res_conv);
34182 }
34183
34184 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR arg) {
34185         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
34186         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(arg);
34187         return tag_ptr(ret_conv, true);
34188 }
34189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34190         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(arg);
34191         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone_ptr(arg_conv);
34192         return ret_conv;
34193 }
34194
34195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34196         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ*)untag_ptr(orig);
34197         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
34198         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(orig_conv);
34199         return tag_ptr(ret_conv, true);
34200 }
34201
34202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
34203         LDKStr o_conv = java_to_owned_str(env, o);
34204         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34205         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
34206         return tag_ptr(ret_conv, true);
34207 }
34208
34209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
34210         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
34211         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34212         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
34213         return tag_ptr(ret_conv, true);
34214 }
34215
34216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34217         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
34218         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
34219         return ret_conv;
34220 }
34221
34222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34223         if (!ptr_is_owned(_res)) return;
34224         void* _res_ptr = untag_ptr(_res);
34225         CHECK_ACCESS(_res_ptr);
34226         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
34227         FREE(untag_ptr(_res));
34228         CResult_StrSecp256k1ErrorZ_free(_res_conv);
34229 }
34230
34231 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
34232         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34233         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
34234         return tag_ptr(ret_conv, true);
34235 }
34236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34237         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
34238         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
34239         return ret_conv;
34240 }
34241
34242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34243         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
34244         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34245         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
34246         return tag_ptr(ret_conv, true);
34247 }
34248
34249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34250         void* o_ptr = untag_ptr(o);
34251         CHECK_ACCESS(o_ptr);
34252         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
34253         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
34254         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34255         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
34256         return tag_ptr(ret_conv, true);
34257 }
34258
34259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
34260         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
34261         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34262         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
34263         return tag_ptr(ret_conv, true);
34264 }
34265
34266 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34267         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
34268         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
34269         return ret_conv;
34270 }
34271
34272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34273         if (!ptr_is_owned(_res)) return;
34274         void* _res_ptr = untag_ptr(_res);
34275         CHECK_ACCESS(_res_ptr);
34276         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
34277         FREE(untag_ptr(_res));
34278         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
34279 }
34280
34281 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
34282         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34283         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
34284         return tag_ptr(ret_conv, true);
34285 }
34286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34287         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
34288         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
34289         return ret_conv;
34290 }
34291
34292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34293         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
34294         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34295         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
34296         return tag_ptr(ret_conv, true);
34297 }
34298
34299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34300         LDKOnionMessagePath o_conv;
34301         o_conv.inner = untag_ptr(o);
34302         o_conv.is_owned = ptr_is_owned(o);
34303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34304         o_conv = OnionMessagePath_clone(&o_conv);
34305         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
34306         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
34307         return tag_ptr(ret_conv, true);
34308 }
34309
34310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
34311         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
34312         *ret_conv = CResult_OnionMessagePathNoneZ_err();
34313         return tag_ptr(ret_conv, true);
34314 }
34315
34316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34317         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
34318         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
34319         return ret_conv;
34320 }
34321
34322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34323         if (!ptr_is_owned(_res)) return;
34324         void* _res_ptr = untag_ptr(_res);
34325         CHECK_ACCESS(_res_ptr);
34326         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
34327         FREE(untag_ptr(_res));
34328         CResult_OnionMessagePathNoneZ_free(_res_conv);
34329 }
34330
34331 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
34332         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
34333         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
34334         return tag_ptr(ret_conv, true);
34335 }
34336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34337         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
34338         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
34339         return ret_conv;
34340 }
34341
34342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34343         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
34344         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
34345         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
34346         return tag_ptr(ret_conv, true);
34347 }
34348
34349 static inline uint64_t C2Tuple_PublicKeyOnionMessageZ_clone_ptr(LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR arg) {
34350         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
34351         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(arg);
34352         return tag_ptr(ret_conv, true);
34353 }
34354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34355         LDKC2Tuple_PublicKeyOnionMessageZ* arg_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(arg);
34356         int64_t ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone_ptr(arg_conv);
34357         return ret_conv;
34358 }
34359
34360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34361         LDKC2Tuple_PublicKeyOnionMessageZ* orig_conv = (LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(orig);
34362         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
34363         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_clone(orig_conv);
34364         return tag_ptr(ret_conv, true);
34365 }
34366
34367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
34368         LDKPublicKey a_ref;
34369         CHECK((*env)->GetArrayLength(env, a) == 33);
34370         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
34371         LDKOnionMessage b_conv;
34372         b_conv.inner = untag_ptr(b);
34373         b_conv.is_owned = ptr_is_owned(b);
34374         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34375         b_conv = OnionMessage_clone(&b_conv);
34376         LDKC2Tuple_PublicKeyOnionMessageZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyOnionMessageZ), "LDKC2Tuple_PublicKeyOnionMessageZ");
34377         *ret_conv = C2Tuple_PublicKeyOnionMessageZ_new(a_ref, b_conv);
34378         return tag_ptr(ret_conv, true);
34379 }
34380
34381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyOnionMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34382         if (!ptr_is_owned(_res)) return;
34383         void* _res_ptr = untag_ptr(_res);
34384         CHECK_ACCESS(_res_ptr);
34385         LDKC2Tuple_PublicKeyOnionMessageZ _res_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(_res_ptr);
34386         FREE(untag_ptr(_res));
34387         C2Tuple_PublicKeyOnionMessageZ_free(_res_conv);
34388 }
34389
34390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34391         void* o_ptr = untag_ptr(o);
34392         CHECK_ACCESS(o_ptr);
34393         LDKC2Tuple_PublicKeyOnionMessageZ o_conv = *(LDKC2Tuple_PublicKeyOnionMessageZ*)(o_ptr);
34394         o_conv = C2Tuple_PublicKeyOnionMessageZ_clone((LDKC2Tuple_PublicKeyOnionMessageZ*)untag_ptr(o));
34395         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
34396         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(o_conv);
34397         return tag_ptr(ret_conv, true);
34398 }
34399
34400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34401         void* e_ptr = untag_ptr(e);
34402         CHECK_ACCESS(e_ptr);
34403         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34404         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34405         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
34406         *ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(e_conv);
34407         return tag_ptr(ret_conv, true);
34408 }
34409
34410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34411         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* o_conv = (LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)untag_ptr(o);
34412         jboolean ret_conv = CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(o_conv);
34413         return ret_conv;
34414 }
34415
34416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34417         if (!ptr_is_owned(_res)) return;
34418         void* _res_ptr = untag_ptr(_res);
34419         CHECK_ACCESS(_res_ptr);
34420         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res_conv = *(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ*)(_res_ptr);
34421         FREE(untag_ptr(_res));
34422         CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv);
34423 }
34424
34425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34426         void* o_ptr = untag_ptr(o);
34427         CHECK_ACCESS(o_ptr);
34428         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
34429         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
34430         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34431         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
34432         return tag_ptr(ret_conv, true);
34433 }
34434
34435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err(JNIEnv *env, jclass clz) {
34436         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34437         *ret_conv = CResult_PeeledOnionNoneZ_err();
34438         return tag_ptr(ret_conv, true);
34439 }
34440
34441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34442         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
34443         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
34444         return ret_conv;
34445 }
34446
34447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34448         if (!ptr_is_owned(_res)) return;
34449         void* _res_ptr = untag_ptr(_res);
34450         CHECK_ACCESS(_res_ptr);
34451         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
34452         FREE(untag_ptr(_res));
34453         CResult_PeeledOnionNoneZ_free(_res_conv);
34454 }
34455
34456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) {
34457         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
34458         *ret_conv = CResult_NoneSendErrorZ_ok();
34459         return tag_ptr(ret_conv, true);
34460 }
34461
34462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34463         void* e_ptr = untag_ptr(e);
34464         CHECK_ACCESS(e_ptr);
34465         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34466         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34467         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
34468         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
34469         return tag_ptr(ret_conv, true);
34470 }
34471
34472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34473         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
34474         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
34475         return ret_conv;
34476 }
34477
34478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34479         if (!ptr_is_owned(_res)) return;
34480         void* _res_ptr = untag_ptr(_res);
34481         CHECK_ACCESS(_res_ptr);
34482         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
34483         FREE(untag_ptr(_res));
34484         CResult_NoneSendErrorZ_free(_res_conv);
34485 }
34486
34487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34488         LDKBlindedPath o_conv;
34489         o_conv.inner = untag_ptr(o);
34490         o_conv.is_owned = ptr_is_owned(o);
34491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34492         o_conv = BlindedPath_clone(&o_conv);
34493         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34494         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
34495         return tag_ptr(ret_conv, true);
34496 }
34497
34498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
34499         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34500         *ret_conv = CResult_BlindedPathNoneZ_err();
34501         return tag_ptr(ret_conv, true);
34502 }
34503
34504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34505         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
34506         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
34507         return ret_conv;
34508 }
34509
34510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34511         if (!ptr_is_owned(_res)) return;
34512         void* _res_ptr = untag_ptr(_res);
34513         CHECK_ACCESS(_res_ptr);
34514         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
34515         FREE(untag_ptr(_res));
34516         CResult_BlindedPathNoneZ_free(_res_conv);
34517 }
34518
34519 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
34520         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34521         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
34522         return tag_ptr(ret_conv, true);
34523 }
34524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34525         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
34526         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
34527         return ret_conv;
34528 }
34529
34530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34531         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
34532         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34533         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
34534         return tag_ptr(ret_conv, true);
34535 }
34536
34537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34538         void* o_ptr = untag_ptr(o);
34539         CHECK_ACCESS(o_ptr);
34540         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
34541         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
34542         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34543         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
34544         return tag_ptr(ret_conv, true);
34545 }
34546
34547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
34548         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34549         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
34550         return tag_ptr(ret_conv, true);
34551 }
34552
34553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34554         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
34555         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
34556         return ret_conv;
34557 }
34558
34559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34560         if (!ptr_is_owned(_res)) return;
34561         void* _res_ptr = untag_ptr(_res);
34562         CHECK_ACCESS(_res_ptr);
34563         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
34564         FREE(untag_ptr(_res));
34565         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
34566 }
34567
34568 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
34569         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34570         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
34571         return tag_ptr(ret_conv, true);
34572 }
34573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34574         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
34575         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
34576         return ret_conv;
34577 }
34578
34579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34580         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
34581         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34582         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
34583         return tag_ptr(ret_conv, true);
34584 }
34585
34586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34587         LDKBlindedPath o_conv;
34588         o_conv.inner = untag_ptr(o);
34589         o_conv.is_owned = ptr_is_owned(o);
34590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34591         o_conv = BlindedPath_clone(&o_conv);
34592         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34593         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
34594         return tag_ptr(ret_conv, true);
34595 }
34596
34597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34598         void* e_ptr = untag_ptr(e);
34599         CHECK_ACCESS(e_ptr);
34600         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34601         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34602         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34603         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
34604         return tag_ptr(ret_conv, true);
34605 }
34606
34607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34608         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
34609         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
34610         return ret_conv;
34611 }
34612
34613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34614         if (!ptr_is_owned(_res)) return;
34615         void* _res_ptr = untag_ptr(_res);
34616         CHECK_ACCESS(_res_ptr);
34617         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
34618         FREE(untag_ptr(_res));
34619         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
34620 }
34621
34622 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
34623         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34624         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
34625         return tag_ptr(ret_conv, true);
34626 }
34627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34628         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
34629         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
34630         return ret_conv;
34631 }
34632
34633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34634         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
34635         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34636         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
34637         return tag_ptr(ret_conv, true);
34638 }
34639
34640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34641         LDKBlindedHop o_conv;
34642         o_conv.inner = untag_ptr(o);
34643         o_conv.is_owned = ptr_is_owned(o);
34644         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34645         o_conv = BlindedHop_clone(&o_conv);
34646         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34647         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
34648         return tag_ptr(ret_conv, true);
34649 }
34650
34651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34652         void* e_ptr = untag_ptr(e);
34653         CHECK_ACCESS(e_ptr);
34654         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34655         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34656         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34657         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
34658         return tag_ptr(ret_conv, true);
34659 }
34660
34661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34662         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
34663         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
34664         return ret_conv;
34665 }
34666
34667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34668         if (!ptr_is_owned(_res)) return;
34669         void* _res_ptr = untag_ptr(_res);
34670         CHECK_ACCESS(_res_ptr);
34671         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
34672         FREE(untag_ptr(_res));
34673         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
34674 }
34675
34676 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
34677         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34678         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
34679         return tag_ptr(ret_conv, true);
34680 }
34681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34682         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
34683         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
34684         return ret_conv;
34685 }
34686
34687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34688         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
34689         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34690         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
34691         return tag_ptr(ret_conv, true);
34692 }
34693
34694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34695         LDKInvoiceError o_conv;
34696         o_conv.inner = untag_ptr(o);
34697         o_conv.is_owned = ptr_is_owned(o);
34698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34699         o_conv = InvoiceError_clone(&o_conv);
34700         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34701         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
34702         return tag_ptr(ret_conv, true);
34703 }
34704
34705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34706         void* e_ptr = untag_ptr(e);
34707         CHECK_ACCESS(e_ptr);
34708         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34709         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34710         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34711         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34712         return tag_ptr(ret_conv, true);
34713 }
34714
34715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34716         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34717         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34718         return ret_conv;
34719 }
34720
34721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34722         if (!ptr_is_owned(_res)) return;
34723         void* _res_ptr = untag_ptr(_res);
34724         CHECK_ACCESS(_res_ptr);
34725         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34726         FREE(untag_ptr(_res));
34727         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34728 }
34729
34730 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34731         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34732         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34733         return tag_ptr(ret_conv, true);
34734 }
34735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34736         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34737         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34738         return ret_conv;
34739 }
34740
34741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34742         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34743         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34744         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34745         return tag_ptr(ret_conv, true);
34746 }
34747
34748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34749         void* o_ptr = untag_ptr(o);
34750         CHECK_ACCESS(o_ptr);
34751         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34752         if (o_conv.free == LDKFilter_JCalls_free) {
34753                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34754                 LDKFilter_JCalls_cloned(&o_conv);
34755         }
34756         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34757         *ret_copy = COption_FilterZ_some(o_conv);
34758         int64_t ret_ref = tag_ptr(ret_copy, true);
34759         return ret_ref;
34760 }
34761
34762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
34763         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34764         *ret_copy = COption_FilterZ_none();
34765         int64_t ret_ref = tag_ptr(ret_copy, true);
34766         return ret_ref;
34767 }
34768
34769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34770         if (!ptr_is_owned(_res)) return;
34771         void* _res_ptr = untag_ptr(_res);
34772         CHECK_ACCESS(_res_ptr);
34773         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34774         FREE(untag_ptr(_res));
34775         COption_FilterZ_free(_res_conv);
34776 }
34777
34778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34779         LDKLockedChannelMonitor o_conv;
34780         o_conv.inner = untag_ptr(o);
34781         o_conv.is_owned = ptr_is_owned(o);
34782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34783         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
34784         
34785         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34786         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
34787         return tag_ptr(ret_conv, true);
34788 }
34789
34790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
34791         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34792         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
34793         return tag_ptr(ret_conv, true);
34794 }
34795
34796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34797         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
34798         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
34799         return ret_conv;
34800 }
34801
34802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34803         if (!ptr_is_owned(_res)) return;
34804         void* _res_ptr = untag_ptr(_res);
34805         CHECK_ACCESS(_res_ptr);
34806         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
34807         FREE(untag_ptr(_res));
34808         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
34809 }
34810
34811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34812         LDKCVec_OutPointZ _res_constr;
34813         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34814         if (_res_constr.datalen > 0)
34815                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
34816         else
34817                 _res_constr.data = NULL;
34818         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34819         for (size_t k = 0; k < _res_constr.datalen; k++) {
34820                 int64_t _res_conv_10 = _res_vals[k];
34821                 LDKOutPoint _res_conv_10_conv;
34822                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
34823                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
34824                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
34825                 _res_constr.data[k] = _res_conv_10_conv;
34826         }
34827         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34828         CVec_OutPointZ_free(_res_constr);
34829 }
34830
34831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34832         LDKCVec_MonitorUpdateIdZ _res_constr;
34833         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34834         if (_res_constr.datalen > 0)
34835                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34836         else
34837                 _res_constr.data = NULL;
34838         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34839         for (size_t r = 0; r < _res_constr.datalen; r++) {
34840                 int64_t _res_conv_17 = _res_vals[r];
34841                 LDKMonitorUpdateId _res_conv_17_conv;
34842                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
34843                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
34844                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
34845                 _res_constr.data[r] = _res_conv_17_conv;
34846         }
34847         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34848         CVec_MonitorUpdateIdZ_free(_res_constr);
34849 }
34850
34851 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
34852         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34853         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
34854         return tag_ptr(ret_conv, true);
34855 }
34856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34857         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
34858         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
34859         return ret_conv;
34860 }
34861
34862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34863         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
34864         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34865         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
34866         return tag_ptr(ret_conv, true);
34867 }
34868
34869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
34870         LDKOutPoint a_conv;
34871         a_conv.inner = untag_ptr(a);
34872         a_conv.is_owned = ptr_is_owned(a);
34873         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34874         a_conv = OutPoint_clone(&a_conv);
34875         LDKCVec_MonitorUpdateIdZ b_constr;
34876         b_constr.datalen = (*env)->GetArrayLength(env, b);
34877         if (b_constr.datalen > 0)
34878                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
34879         else
34880                 b_constr.data = NULL;
34881         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
34882         for (size_t r = 0; r < b_constr.datalen; r++) {
34883                 int64_t b_conv_17 = b_vals[r];
34884                 LDKMonitorUpdateId b_conv_17_conv;
34885                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
34886                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
34887                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
34888                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
34889                 b_constr.data[r] = b_conv_17_conv;
34890         }
34891         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
34892         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
34893         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
34894         return tag_ptr(ret_conv, true);
34895 }
34896
34897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34898         if (!ptr_is_owned(_res)) return;
34899         void* _res_ptr = untag_ptr(_res);
34900         CHECK_ACCESS(_res_ptr);
34901         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
34902         FREE(untag_ptr(_res));
34903         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
34904 }
34905
34906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
34907         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
34908         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
34909         if (_res_constr.datalen > 0)
34910                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
34911         else
34912                 _res_constr.data = NULL;
34913         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
34914         for (size_t p = 0; p < _res_constr.datalen; p++) {
34915                 int64_t _res_conv_41 = _res_vals[p];
34916                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
34917                 CHECK_ACCESS(_res_conv_41_ptr);
34918                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
34919                 FREE(untag_ptr(_res_conv_41));
34920                 _res_constr.data[p] = _res_conv_41_conv;
34921         }
34922         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
34923         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
34924 }
34925
34926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34927         if (!ptr_is_owned(this_ptr)) return;
34928         void* this_ptr_ptr = untag_ptr(this_ptr);
34929         CHECK_ACCESS(this_ptr_ptr);
34930         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
34931         FREE(untag_ptr(this_ptr));
34932         APIError_free(this_ptr_conv);
34933 }
34934
34935 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
34936         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34937         *ret_copy = APIError_clone(arg);
34938         int64_t ret_ref = tag_ptr(ret_copy, true);
34939         return ret_ref;
34940 }
34941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34942         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
34943         int64_t ret_conv = APIError_clone_ptr(arg_conv);
34944         return ret_conv;
34945 }
34946
34947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34948         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
34949         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34950         *ret_copy = APIError_clone(orig_conv);
34951         int64_t ret_ref = tag_ptr(ret_copy, true);
34952         return ret_ref;
34953 }
34954
34955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
34956         LDKStr err_conv = java_to_owned_str(env, err);
34957         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34958         *ret_copy = APIError_apimisuse_error(err_conv);
34959         int64_t ret_ref = tag_ptr(ret_copy, true);
34960         return ret_ref;
34961 }
34962
34963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
34964         LDKStr err_conv = java_to_owned_str(env, err);
34965         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34966         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
34967         int64_t ret_ref = tag_ptr(ret_copy, true);
34968         return ret_ref;
34969 }
34970
34971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
34972         LDKStr err_conv = java_to_owned_str(env, err);
34973         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34974         *ret_copy = APIError_invalid_route(err_conv);
34975         int64_t ret_ref = tag_ptr(ret_copy, true);
34976         return ret_ref;
34977 }
34978
34979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
34980         LDKStr err_conv = java_to_owned_str(env, err);
34981         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34982         *ret_copy = APIError_channel_unavailable(err_conv);
34983         int64_t ret_ref = tag_ptr(ret_copy, true);
34984         return ret_ref;
34985 }
34986
34987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
34988         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
34989         *ret_copy = APIError_monitor_update_in_progress();
34990         int64_t ret_ref = tag_ptr(ret_copy, true);
34991         return ret_ref;
34992 }
34993
34994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
34995         LDKShutdownScript script_conv;
34996         script_conv.inner = untag_ptr(script);
34997         script_conv.is_owned = ptr_is_owned(script);
34998         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
34999         script_conv = ShutdownScript_clone(&script_conv);
35000         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35001         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
35002         int64_t ret_ref = tag_ptr(ret_copy, true);
35003         return ret_ref;
35004 }
35005
35006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35007         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
35008         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
35009         jboolean ret_conv = APIError_eq(a_conv, b_conv);
35010         return ret_conv;
35011 }
35012
35013 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
35014         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
35015         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
35016         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35017         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35018         CVec_u8Z_free(ret_var);
35019         return ret_arr;
35020 }
35021
35022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35023         LDKu8slice ser_ref;
35024         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35025         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35026         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
35027         *ret_conv = APIError_read(ser_ref);
35028         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35029         return tag_ptr(ret_conv, true);
35030 }
35031
35032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35033         LDKBigSize this_obj_conv;
35034         this_obj_conv.inner = untag_ptr(this_obj);
35035         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35037         BigSize_free(this_obj_conv);
35038 }
35039
35040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
35041         LDKBigSize this_ptr_conv;
35042         this_ptr_conv.inner = untag_ptr(this_ptr);
35043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35045         this_ptr_conv.is_owned = false;
35046         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
35047         return ret_conv;
35048 }
35049
35050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35051         LDKBigSize this_ptr_conv;
35052         this_ptr_conv.inner = untag_ptr(this_ptr);
35053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35055         this_ptr_conv.is_owned = false;
35056         BigSize_set_a(&this_ptr_conv, val);
35057 }
35058
35059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
35060         LDKBigSize ret_var = BigSize_new(a_arg);
35061         int64_t ret_ref = 0;
35062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35064         return ret_ref;
35065 }
35066
35067 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
35068         LDKBigSize ret_var = BigSize_clone(arg);
35069         int64_t ret_ref = 0;
35070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35072         return ret_ref;
35073 }
35074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35075         LDKBigSize arg_conv;
35076         arg_conv.inner = untag_ptr(arg);
35077         arg_conv.is_owned = ptr_is_owned(arg);
35078         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35079         arg_conv.is_owned = false;
35080         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
35081         return ret_conv;
35082 }
35083
35084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35085         LDKBigSize orig_conv;
35086         orig_conv.inner = untag_ptr(orig);
35087         orig_conv.is_owned = ptr_is_owned(orig);
35088         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35089         orig_conv.is_owned = false;
35090         LDKBigSize ret_var = BigSize_clone(&orig_conv);
35091         int64_t ret_ref = 0;
35092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35094         return ret_ref;
35095 }
35096
35097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
35098         LDKBigSize o_conv;
35099         o_conv.inner = untag_ptr(o);
35100         o_conv.is_owned = ptr_is_owned(o);
35101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35102         o_conv.is_owned = false;
35103         int64_t ret_conv = BigSize_hash(&o_conv);
35104         return ret_conv;
35105 }
35106
35107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35108         LDKBigSize a_conv;
35109         a_conv.inner = untag_ptr(a);
35110         a_conv.is_owned = ptr_is_owned(a);
35111         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35112         a_conv.is_owned = false;
35113         LDKBigSize b_conv;
35114         b_conv.inner = untag_ptr(b);
35115         b_conv.is_owned = ptr_is_owned(b);
35116         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35117         b_conv.is_owned = false;
35118         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
35119         return ret_conv;
35120 }
35121
35122 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
35123         LDKBigSize obj_conv;
35124         obj_conv.inner = untag_ptr(obj);
35125         obj_conv.is_owned = ptr_is_owned(obj);
35126         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35127         obj_conv.is_owned = false;
35128         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
35129         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35130         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35131         CVec_u8Z_free(ret_var);
35132         return ret_arr;
35133 }
35134
35135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35136         LDKu8slice ser_ref;
35137         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35138         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35139         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35140         *ret_conv = BigSize_read(ser_ref);
35141         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35142         return tag_ptr(ret_conv, true);
35143 }
35144
35145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35146         LDKHostname this_obj_conv;
35147         this_obj_conv.inner = untag_ptr(this_obj);
35148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35150         Hostname_free(this_obj_conv);
35151 }
35152
35153 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
35154         LDKHostname ret_var = Hostname_clone(arg);
35155         int64_t ret_ref = 0;
35156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35158         return ret_ref;
35159 }
35160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35161         LDKHostname arg_conv;
35162         arg_conv.inner = untag_ptr(arg);
35163         arg_conv.is_owned = ptr_is_owned(arg);
35164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35165         arg_conv.is_owned = false;
35166         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
35167         return ret_conv;
35168 }
35169
35170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35171         LDKHostname orig_conv;
35172         orig_conv.inner = untag_ptr(orig);
35173         orig_conv.is_owned = ptr_is_owned(orig);
35174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35175         orig_conv.is_owned = false;
35176         LDKHostname ret_var = Hostname_clone(&orig_conv);
35177         int64_t ret_ref = 0;
35178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35180         return ret_ref;
35181 }
35182
35183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35184         LDKHostname a_conv;
35185         a_conv.inner = untag_ptr(a);
35186         a_conv.is_owned = ptr_is_owned(a);
35187         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35188         a_conv.is_owned = false;
35189         LDKHostname b_conv;
35190         b_conv.inner = untag_ptr(b);
35191         b_conv.is_owned = ptr_is_owned(b);
35192         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35193         b_conv.is_owned = false;
35194         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
35195         return ret_conv;
35196 }
35197
35198 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
35199         LDKHostname this_arg_conv;
35200         this_arg_conv.inner = untag_ptr(this_arg);
35201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35203         this_arg_conv.is_owned = false;
35204         int8_t ret_conv = Hostname_len(&this_arg_conv);
35205         return ret_conv;
35206 }
35207
35208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
35209         LDKHostname obj_conv;
35210         obj_conv.inner = untag_ptr(obj);
35211         obj_conv.is_owned = ptr_is_owned(obj);
35212         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35213         obj_conv.is_owned = false;
35214         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
35215         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35216         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35217         CVec_u8Z_free(ret_var);
35218         return ret_arr;
35219 }
35220
35221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35222         LDKu8slice ser_ref;
35223         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35224         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35225         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35226         *ret_conv = Hostname_read(ser_ref);
35227         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35228         return tag_ptr(ret_conv, true);
35229 }
35230
35231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35232         LDKTransactionU16LenLimited this_obj_conv;
35233         this_obj_conv.inner = untag_ptr(this_obj);
35234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35236         TransactionU16LenLimited_free(this_obj_conv);
35237 }
35238
35239 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
35240         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
35241         int64_t ret_ref = 0;
35242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35244         return ret_ref;
35245 }
35246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35247         LDKTransactionU16LenLimited arg_conv;
35248         arg_conv.inner = untag_ptr(arg);
35249         arg_conv.is_owned = ptr_is_owned(arg);
35250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35251         arg_conv.is_owned = false;
35252         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
35253         return ret_conv;
35254 }
35255
35256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35257         LDKTransactionU16LenLimited orig_conv;
35258         orig_conv.inner = untag_ptr(orig);
35259         orig_conv.is_owned = ptr_is_owned(orig);
35260         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35261         orig_conv.is_owned = false;
35262         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
35263         int64_t ret_ref = 0;
35264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35266         return ret_ref;
35267 }
35268
35269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35270         LDKTransactionU16LenLimited a_conv;
35271         a_conv.inner = untag_ptr(a);
35272         a_conv.is_owned = ptr_is_owned(a);
35273         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35274         a_conv.is_owned = false;
35275         LDKTransactionU16LenLimited b_conv;
35276         b_conv.inner = untag_ptr(b);
35277         b_conv.is_owned = ptr_is_owned(b);
35278         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35279         b_conv.is_owned = false;
35280         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
35281         return ret_conv;
35282 }
35283
35284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
35285         LDKTransaction transaction_ref;
35286         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
35287         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
35288         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
35289         transaction_ref.data_is_owned = true;
35290         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35291         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
35292         return tag_ptr(ret_conv, true);
35293 }
35294
35295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
35296         LDKTransactionU16LenLimited this_arg_conv;
35297         this_arg_conv.inner = untag_ptr(this_arg);
35298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35300         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
35301         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
35302         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35303         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35304         Transaction_free(ret_var);
35305         return ret_arr;
35306 }
35307
35308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
35309         LDKTransactionU16LenLimited obj_conv;
35310         obj_conv.inner = untag_ptr(obj);
35311         obj_conv.is_owned = ptr_is_owned(obj);
35312         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35313         obj_conv.is_owned = false;
35314         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
35315         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35316         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35317         CVec_u8Z_free(ret_var);
35318         return ret_arr;
35319 }
35320
35321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35322         LDKu8slice ser_ref;
35323         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35324         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35325         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35326         *ret_conv = TransactionU16LenLimited_read(ser_ref);
35327         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35328         return tag_ptr(ret_conv, true);
35329 }
35330
35331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
35332         LDKu8slice msg_ref;
35333         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
35334         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
35335         uint8_t sk_arr[32];
35336         CHECK((*env)->GetArrayLength(env, sk) == 32);
35337         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
35338         uint8_t (*sk_ref)[32] = &sk_arr;
35339         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
35340         *ret_conv = sign(msg_ref, sk_ref);
35341         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
35342         return tag_ptr(ret_conv, true);
35343 }
35344
35345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
35346         LDKu8slice msg_ref;
35347         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
35348         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
35349         LDKStr sig_conv = java_to_owned_str(env, sig);
35350         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
35351         *ret_conv = recover_pk(msg_ref, sig_conv);
35352         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
35353         return tag_ptr(ret_conv, true);
35354 }
35355
35356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
35357         LDKu8slice msg_ref;
35358         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
35359         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
35360         LDKStr sig_conv = java_to_owned_str(env, sig);
35361         LDKPublicKey pk_ref;
35362         CHECK((*env)->GetArrayLength(env, pk) == 33);
35363         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
35364         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
35365         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
35366         return ret_conv;
35367 }
35368
35369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
35370         LDKu8slice hrp_bytes_ref;
35371         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
35372         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
35373         LDKCVec_U5Z data_without_signature_constr;
35374         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
35375         if (data_without_signature_constr.datalen > 0)
35376                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
35377         else
35378                 data_without_signature_constr.data = NULL;
35379         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
35380         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
35381                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
35382                 
35383                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
35384         }
35385         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
35386         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
35387         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35388         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35389         CVec_u8Z_free(ret_var);
35390         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
35391         return ret_arr;
35392 }
35393
35394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35395         if (!ptr_is_owned(this_ptr)) return;
35396         void* this_ptr_ptr = untag_ptr(this_ptr);
35397         CHECK_ACCESS(this_ptr_ptr);
35398         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
35399         FREE(untag_ptr(this_ptr));
35400         KVStore_free(this_ptr_conv);
35401 }
35402
35403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35404         if (!ptr_is_owned(this_ptr)) return;
35405         void* this_ptr_ptr = untag_ptr(this_ptr);
35406         CHECK_ACCESS(this_ptr_ptr);
35407         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
35408         FREE(untag_ptr(this_ptr));
35409         Persister_free(this_ptr_conv);
35410 }
35411
35412 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) {
35413         void* kv_store_ptr = untag_ptr(kv_store);
35414         CHECK_ACCESS(kv_store_ptr);
35415         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35416         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35417                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35418                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35419         }
35420         void* entropy_source_ptr = untag_ptr(entropy_source);
35421         CHECK_ACCESS(entropy_source_ptr);
35422         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35423         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35424                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35425                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35426         }
35427         void* signer_provider_ptr = untag_ptr(signer_provider);
35428         CHECK_ACCESS(signer_provider_ptr);
35429         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35430         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35431                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35432                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35433         }
35434         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35435         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
35436         return tag_ptr(ret_conv, true);
35437 }
35438
35439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35440         LDKMonitorUpdatingPersister this_obj_conv;
35441         this_obj_conv.inner = untag_ptr(this_obj);
35442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35444         MonitorUpdatingPersister_free(this_obj_conv);
35445 }
35446
35447 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) {
35448         void* kv_store_ptr = untag_ptr(kv_store);
35449         CHECK_ACCESS(kv_store_ptr);
35450         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35451         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35452                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35453                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35454         }
35455         void* logger_ptr = untag_ptr(logger);
35456         CHECK_ACCESS(logger_ptr);
35457         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35458         if (logger_conv.free == LDKLogger_JCalls_free) {
35459                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35460                 LDKLogger_JCalls_cloned(&logger_conv);
35461         }
35462         void* entropy_source_ptr = untag_ptr(entropy_source);
35463         CHECK_ACCESS(entropy_source_ptr);
35464         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35465         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35466                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35467                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35468         }
35469         void* signer_provider_ptr = untag_ptr(signer_provider);
35470         CHECK_ACCESS(signer_provider_ptr);
35471         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35472         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35473                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35474                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35475         }
35476         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
35477         int64_t ret_ref = 0;
35478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35480         return ret_ref;
35481 }
35482
35483 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) {
35484         LDKMonitorUpdatingPersister this_arg_conv;
35485         this_arg_conv.inner = untag_ptr(this_arg);
35486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35488         this_arg_conv.is_owned = false;
35489         void* broadcaster_ptr = untag_ptr(broadcaster);
35490         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35491         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35492         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35493         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35494         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35495         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35496         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
35497         return tag_ptr(ret_conv, true);
35498 }
35499
35500 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) {
35501         LDKMonitorUpdatingPersister this_arg_conv;
35502         this_arg_conv.inner = untag_ptr(this_arg);
35503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35505         this_arg_conv.is_owned = false;
35506         void* broadcaster_ptr = untag_ptr(broadcaster);
35507         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35508         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35509         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35510         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35511         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35512         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
35513         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
35514         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
35515         return tag_ptr(ret_conv, true);
35516 }
35517
35518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
35519         LDKMonitorUpdatingPersister this_arg_conv;
35520         this_arg_conv.inner = untag_ptr(this_arg);
35521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35523         this_arg_conv.is_owned = false;
35524         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
35525         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
35526         return tag_ptr(ret_conv, true);
35527 }
35528
35529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
35530         LDKMonitorUpdatingPersister this_arg_conv;
35531         this_arg_conv.inner = untag_ptr(this_arg);
35532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35534         this_arg_conv.is_owned = false;
35535         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
35536         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
35537         return tag_ptr(ret_ret, true);
35538 }
35539
35540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35541         LDKUntrustedString this_obj_conv;
35542         this_obj_conv.inner = untag_ptr(this_obj);
35543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35545         UntrustedString_free(this_obj_conv);
35546 }
35547
35548 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
35549         LDKUntrustedString this_ptr_conv;
35550         this_ptr_conv.inner = untag_ptr(this_ptr);
35551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35553         this_ptr_conv.is_owned = false;
35554         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
35555         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35556         Str_free(ret_str);
35557         return ret_conv;
35558 }
35559
35560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35561         LDKUntrustedString this_ptr_conv;
35562         this_ptr_conv.inner = untag_ptr(this_ptr);
35563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35565         this_ptr_conv.is_owned = false;
35566         LDKStr val_conv = java_to_owned_str(env, val);
35567         UntrustedString_set_a(&this_ptr_conv, val_conv);
35568 }
35569
35570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
35571         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
35572         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
35573         int64_t ret_ref = 0;
35574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35576         return ret_ref;
35577 }
35578
35579 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
35580         LDKUntrustedString ret_var = UntrustedString_clone(arg);
35581         int64_t ret_ref = 0;
35582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35584         return ret_ref;
35585 }
35586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35587         LDKUntrustedString arg_conv;
35588         arg_conv.inner = untag_ptr(arg);
35589         arg_conv.is_owned = ptr_is_owned(arg);
35590         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35591         arg_conv.is_owned = false;
35592         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
35593         return ret_conv;
35594 }
35595
35596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35597         LDKUntrustedString orig_conv;
35598         orig_conv.inner = untag_ptr(orig);
35599         orig_conv.is_owned = ptr_is_owned(orig);
35600         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35601         orig_conv.is_owned = false;
35602         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
35603         int64_t ret_ref = 0;
35604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35606         return ret_ref;
35607 }
35608
35609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35610         LDKUntrustedString a_conv;
35611         a_conv.inner = untag_ptr(a);
35612         a_conv.is_owned = ptr_is_owned(a);
35613         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35614         a_conv.is_owned = false;
35615         LDKUntrustedString b_conv;
35616         b_conv.inner = untag_ptr(b);
35617         b_conv.is_owned = ptr_is_owned(b);
35618         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35619         b_conv.is_owned = false;
35620         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
35621         return ret_conv;
35622 }
35623
35624 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
35625         LDKUntrustedString obj_conv;
35626         obj_conv.inner = untag_ptr(obj);
35627         obj_conv.is_owned = ptr_is_owned(obj);
35628         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35629         obj_conv.is_owned = false;
35630         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
35631         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35632         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35633         CVec_u8Z_free(ret_var);
35634         return ret_arr;
35635 }
35636
35637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35638         LDKu8slice ser_ref;
35639         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35640         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35641         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35642         *ret_conv = UntrustedString_read(ser_ref);
35643         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35644         return tag_ptr(ret_conv, true);
35645 }
35646
35647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35648         LDKPrintableString this_obj_conv;
35649         this_obj_conv.inner = untag_ptr(this_obj);
35650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35652         PrintableString_free(this_obj_conv);
35653 }
35654
35655 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
35656         LDKPrintableString this_ptr_conv;
35657         this_ptr_conv.inner = untag_ptr(this_ptr);
35658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35660         this_ptr_conv.is_owned = false;
35661         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
35662         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35663         Str_free(ret_str);
35664         return ret_conv;
35665 }
35666
35667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35668         LDKPrintableString this_ptr_conv;
35669         this_ptr_conv.inner = untag_ptr(this_ptr);
35670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35672         this_ptr_conv.is_owned = false;
35673         LDKStr val_conv = java_to_owned_str(env, val);
35674         PrintableString_set_a(&this_ptr_conv, val_conv);
35675 }
35676
35677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
35678         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
35679         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
35680         int64_t ret_ref = 0;
35681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35683         return ret_ref;
35684 }
35685
35686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35687         if (!ptr_is_owned(this_ptr)) return;
35688         void* this_ptr_ptr = untag_ptr(this_ptr);
35689         CHECK_ACCESS(this_ptr_ptr);
35690         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
35691         FREE(untag_ptr(this_ptr));
35692         FutureCallback_free(this_ptr_conv);
35693 }
35694
35695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35696         LDKFuture this_obj_conv;
35697         this_obj_conv.inner = untag_ptr(this_obj);
35698         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35700         Future_free(this_obj_conv);
35701 }
35702
35703 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
35704         LDKFuture ret_var = Future_clone(arg);
35705         int64_t ret_ref = 0;
35706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35708         return ret_ref;
35709 }
35710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35711         LDKFuture arg_conv;
35712         arg_conv.inner = untag_ptr(arg);
35713         arg_conv.is_owned = ptr_is_owned(arg);
35714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35715         arg_conv.is_owned = false;
35716         int64_t ret_conv = Future_clone_ptr(&arg_conv);
35717         return ret_conv;
35718 }
35719
35720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35721         LDKFuture orig_conv;
35722         orig_conv.inner = untag_ptr(orig);
35723         orig_conv.is_owned = ptr_is_owned(orig);
35724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35725         orig_conv.is_owned = false;
35726         LDKFuture ret_var = Future_clone(&orig_conv);
35727         int64_t ret_ref = 0;
35728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35730         return ret_ref;
35731 }
35732
35733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
35734         LDKFuture this_arg_conv;
35735         this_arg_conv.inner = untag_ptr(this_arg);
35736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35738         this_arg_conv.is_owned = false;
35739         void* callback_ptr = untag_ptr(callback);
35740         CHECK_ACCESS(callback_ptr);
35741         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
35742         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
35743                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35744                 LDKFutureCallback_JCalls_cloned(&callback_conv);
35745         }
35746         Future_register_callback_fn(&this_arg_conv, callback_conv);
35747 }
35748
35749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
35750         LDKFuture this_arg_conv;
35751         this_arg_conv.inner = untag_ptr(this_arg);
35752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35754         this_arg_conv = Future_clone(&this_arg_conv);
35755         Future_wait(this_arg_conv);
35756 }
35757
35758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
35759         LDKFuture this_arg_conv;
35760         this_arg_conv.inner = untag_ptr(this_arg);
35761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35763         this_arg_conv = Future_clone(&this_arg_conv);
35764         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
35765         return ret_conv;
35766 }
35767
35768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35769         LDKSleeper this_obj_conv;
35770         this_obj_conv.inner = untag_ptr(this_obj);
35771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35773         Sleeper_free(this_obj_conv);
35774 }
35775
35776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
35777         LDKFuture future_conv;
35778         future_conv.inner = untag_ptr(future);
35779         future_conv.is_owned = ptr_is_owned(future);
35780         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
35781         future_conv = Future_clone(&future_conv);
35782         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
35783         int64_t ret_ref = 0;
35784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35786         return ret_ref;
35787 }
35788
35789 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) {
35790         LDKFuture fut_a_conv;
35791         fut_a_conv.inner = untag_ptr(fut_a);
35792         fut_a_conv.is_owned = ptr_is_owned(fut_a);
35793         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
35794         fut_a_conv = Future_clone(&fut_a_conv);
35795         LDKFuture fut_b_conv;
35796         fut_b_conv.inner = untag_ptr(fut_b);
35797         fut_b_conv.is_owned = ptr_is_owned(fut_b);
35798         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
35799         fut_b_conv = Future_clone(&fut_b_conv);
35800         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
35801         int64_t ret_ref = 0;
35802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35804         return ret_ref;
35805 }
35806
35807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
35808         LDKCVec_FutureZ futures_constr;
35809         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
35810         if (futures_constr.datalen > 0)
35811                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
35812         else
35813                 futures_constr.data = NULL;
35814         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
35815         for (size_t i = 0; i < futures_constr.datalen; i++) {
35816                 int64_t futures_conv_8 = futures_vals[i];
35817                 LDKFuture futures_conv_8_conv;
35818                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
35819                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
35820                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
35821                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
35822                 futures_constr.data[i] = futures_conv_8_conv;
35823         }
35824         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
35825         LDKSleeper ret_var = Sleeper_new(futures_constr);
35826         int64_t ret_ref = 0;
35827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35829         return ret_ref;
35830 }
35831
35832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
35833         LDKSleeper this_arg_conv;
35834         this_arg_conv.inner = untag_ptr(this_arg);
35835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35837         this_arg_conv.is_owned = false;
35838         Sleeper_wait(&this_arg_conv);
35839 }
35840
35841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
35842         LDKSleeper this_arg_conv;
35843         this_arg_conv.inner = untag_ptr(this_arg);
35844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35846         this_arg_conv.is_owned = false;
35847         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
35848         return ret_conv;
35849 }
35850
35851 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35852         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
35853         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
35854         return ret_conv;
35855 }
35856
35857 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
35858         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
35859         return ret_conv;
35860 }
35861
35862 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
35863         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
35864         return ret_conv;
35865 }
35866
35867 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
35868         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
35869         return ret_conv;
35870 }
35871
35872 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
35873         jclass ret_conv = LDKLevel_to_java(env, Level_info());
35874         return ret_conv;
35875 }
35876
35877 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
35878         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
35879         return ret_conv;
35880 }
35881
35882 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
35883         jclass ret_conv = LDKLevel_to_java(env, Level_error());
35884         return ret_conv;
35885 }
35886
35887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35888         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
35889         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
35890         jboolean ret_conv = Level_eq(a_conv, b_conv);
35891         return ret_conv;
35892 }
35893
35894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
35895         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
35896         int64_t ret_conv = Level_hash(o_conv);
35897         return ret_conv;
35898 }
35899
35900 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
35901         jclass ret_conv = LDKLevel_to_java(env, Level_max());
35902         return ret_conv;
35903 }
35904
35905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35906         LDKRecord this_obj_conv;
35907         this_obj_conv.inner = untag_ptr(this_obj);
35908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35910         Record_free(this_obj_conv);
35911 }
35912
35913 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
35914         LDKRecord this_ptr_conv;
35915         this_ptr_conv.inner = untag_ptr(this_ptr);
35916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35918         this_ptr_conv.is_owned = false;
35919         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
35920         return ret_conv;
35921 }
35922
35923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
35924         LDKRecord this_ptr_conv;
35925         this_ptr_conv.inner = untag_ptr(this_ptr);
35926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35928         this_ptr_conv.is_owned = false;
35929         LDKLevel val_conv = LDKLevel_from_java(env, val);
35930         Record_set_level(&this_ptr_conv, val_conv);
35931 }
35932
35933 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
35934         LDKRecord this_ptr_conv;
35935         this_ptr_conv.inner = untag_ptr(this_ptr);
35936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35938         this_ptr_conv.is_owned = false;
35939         LDKStr ret_str = Record_get_args(&this_ptr_conv);
35940         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35941         Str_free(ret_str);
35942         return ret_conv;
35943 }
35944
35945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35946         LDKRecord this_ptr_conv;
35947         this_ptr_conv.inner = untag_ptr(this_ptr);
35948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35950         this_ptr_conv.is_owned = false;
35951         LDKStr val_conv = java_to_owned_str(env, val);
35952         Record_set_args(&this_ptr_conv, val_conv);
35953 }
35954
35955 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
35956         LDKRecord this_ptr_conv;
35957         this_ptr_conv.inner = untag_ptr(this_ptr);
35958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35960         this_ptr_conv.is_owned = false;
35961         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
35962         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35963         Str_free(ret_str);
35964         return ret_conv;
35965 }
35966
35967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35968         LDKRecord this_ptr_conv;
35969         this_ptr_conv.inner = untag_ptr(this_ptr);
35970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35972         this_ptr_conv.is_owned = false;
35973         LDKStr val_conv = java_to_owned_str(env, val);
35974         Record_set_module_path(&this_ptr_conv, val_conv);
35975 }
35976
35977 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
35978         LDKRecord this_ptr_conv;
35979         this_ptr_conv.inner = untag_ptr(this_ptr);
35980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35982         this_ptr_conv.is_owned = false;
35983         LDKStr ret_str = Record_get_file(&this_ptr_conv);
35984         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35985         Str_free(ret_str);
35986         return ret_conv;
35987 }
35988
35989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35990         LDKRecord this_ptr_conv;
35991         this_ptr_conv.inner = untag_ptr(this_ptr);
35992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35994         this_ptr_conv.is_owned = false;
35995         LDKStr val_conv = java_to_owned_str(env, val);
35996         Record_set_file(&this_ptr_conv, val_conv);
35997 }
35998
35999 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
36000         LDKRecord this_ptr_conv;
36001         this_ptr_conv.inner = untag_ptr(this_ptr);
36002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36004         this_ptr_conv.is_owned = false;
36005         int32_t ret_conv = Record_get_line(&this_ptr_conv);
36006         return ret_conv;
36007 }
36008
36009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36010         LDKRecord this_ptr_conv;
36011         this_ptr_conv.inner = untag_ptr(this_ptr);
36012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36014         this_ptr_conv.is_owned = false;
36015         Record_set_line(&this_ptr_conv, val);
36016 }
36017
36018 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
36019         LDKRecord ret_var = Record_clone(arg);
36020         int64_t ret_ref = 0;
36021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36023         return ret_ref;
36024 }
36025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36026         LDKRecord arg_conv;
36027         arg_conv.inner = untag_ptr(arg);
36028         arg_conv.is_owned = ptr_is_owned(arg);
36029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36030         arg_conv.is_owned = false;
36031         int64_t ret_conv = Record_clone_ptr(&arg_conv);
36032         return ret_conv;
36033 }
36034
36035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36036         LDKRecord orig_conv;
36037         orig_conv.inner = untag_ptr(orig);
36038         orig_conv.is_owned = ptr_is_owned(orig);
36039         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36040         orig_conv.is_owned = false;
36041         LDKRecord ret_var = Record_clone(&orig_conv);
36042         int64_t ret_ref = 0;
36043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36045         return ret_ref;
36046 }
36047
36048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36049         if (!ptr_is_owned(this_ptr)) return;
36050         void* this_ptr_ptr = untag_ptr(this_ptr);
36051         CHECK_ACCESS(this_ptr_ptr);
36052         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
36053         FREE(untag_ptr(this_ptr));
36054         Logger_free(this_ptr_conv);
36055 }
36056
36057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36058         LDKChannelHandshakeConfig this_obj_conv;
36059         this_obj_conv.inner = untag_ptr(this_obj);
36060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36062         ChannelHandshakeConfig_free(this_obj_conv);
36063 }
36064
36065 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
36066         LDKChannelHandshakeConfig this_ptr_conv;
36067         this_ptr_conv.inner = untag_ptr(this_ptr);
36068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36070         this_ptr_conv.is_owned = false;
36071         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
36072         return ret_conv;
36073 }
36074
36075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36076         LDKChannelHandshakeConfig this_ptr_conv;
36077         this_ptr_conv.inner = untag_ptr(this_ptr);
36078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36080         this_ptr_conv.is_owned = false;
36081         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
36082 }
36083
36084 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
36085         LDKChannelHandshakeConfig this_ptr_conv;
36086         this_ptr_conv.inner = untag_ptr(this_ptr);
36087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36089         this_ptr_conv.is_owned = false;
36090         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
36091         return ret_conv;
36092 }
36093
36094 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) {
36095         LDKChannelHandshakeConfig this_ptr_conv;
36096         this_ptr_conv.inner = untag_ptr(this_ptr);
36097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36099         this_ptr_conv.is_owned = false;
36100         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
36101 }
36102
36103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36104         LDKChannelHandshakeConfig this_ptr_conv;
36105         this_ptr_conv.inner = untag_ptr(this_ptr);
36106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36108         this_ptr_conv.is_owned = false;
36109         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
36110         return ret_conv;
36111 }
36112
36113 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) {
36114         LDKChannelHandshakeConfig this_ptr_conv;
36115         this_ptr_conv.inner = untag_ptr(this_ptr);
36116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36118         this_ptr_conv.is_owned = false;
36119         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
36120 }
36121
36122 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) {
36123         LDKChannelHandshakeConfig this_ptr_conv;
36124         this_ptr_conv.inner = untag_ptr(this_ptr);
36125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36127         this_ptr_conv.is_owned = false;
36128         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
36129         return ret_conv;
36130 }
36131
36132 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) {
36133         LDKChannelHandshakeConfig this_ptr_conv;
36134         this_ptr_conv.inner = untag_ptr(this_ptr);
36135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36137         this_ptr_conv.is_owned = false;
36138         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
36139 }
36140
36141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
36142         LDKChannelHandshakeConfig this_ptr_conv;
36143         this_ptr_conv.inner = untag_ptr(this_ptr);
36144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36146         this_ptr_conv.is_owned = false;
36147         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
36148         return ret_conv;
36149 }
36150
36151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36152         LDKChannelHandshakeConfig this_ptr_conv;
36153         this_ptr_conv.inner = untag_ptr(this_ptr);
36154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36156         this_ptr_conv.is_owned = false;
36157         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
36158 }
36159
36160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
36161         LDKChannelHandshakeConfig this_ptr_conv;
36162         this_ptr_conv.inner = untag_ptr(this_ptr);
36163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36165         this_ptr_conv.is_owned = false;
36166         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
36167         return ret_conv;
36168 }
36169
36170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36171         LDKChannelHandshakeConfig this_ptr_conv;
36172         this_ptr_conv.inner = untag_ptr(this_ptr);
36173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36175         this_ptr_conv.is_owned = false;
36176         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
36177 }
36178
36179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
36180         LDKChannelHandshakeConfig this_ptr_conv;
36181         this_ptr_conv.inner = untag_ptr(this_ptr);
36182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36184         this_ptr_conv.is_owned = false;
36185         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
36186         return ret_conv;
36187 }
36188
36189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36190         LDKChannelHandshakeConfig this_ptr_conv;
36191         this_ptr_conv.inner = untag_ptr(this_ptr);
36192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36194         this_ptr_conv.is_owned = false;
36195         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
36196 }
36197
36198 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36199         LDKChannelHandshakeConfig this_ptr_conv;
36200         this_ptr_conv.inner = untag_ptr(this_ptr);
36201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36203         this_ptr_conv.is_owned = false;
36204         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
36205         return ret_conv;
36206 }
36207
36208 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) {
36209         LDKChannelHandshakeConfig this_ptr_conv;
36210         this_ptr_conv.inner = untag_ptr(this_ptr);
36211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36213         this_ptr_conv.is_owned = false;
36214         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
36215 }
36216
36217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
36218         LDKChannelHandshakeConfig this_ptr_conv;
36219         this_ptr_conv.inner = untag_ptr(this_ptr);
36220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36222         this_ptr_conv.is_owned = false;
36223         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
36224         return ret_conv;
36225 }
36226
36227 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) {
36228         LDKChannelHandshakeConfig this_ptr_conv;
36229         this_ptr_conv.inner = untag_ptr(this_ptr);
36230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36232         this_ptr_conv.is_owned = false;
36233         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
36234 }
36235
36236 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36237         LDKChannelHandshakeConfig this_ptr_conv;
36238         this_ptr_conv.inner = untag_ptr(this_ptr);
36239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36241         this_ptr_conv.is_owned = false;
36242         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
36243         return ret_conv;
36244 }
36245
36246 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) {
36247         LDKChannelHandshakeConfig this_ptr_conv;
36248         this_ptr_conv.inner = untag_ptr(this_ptr);
36249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36251         this_ptr_conv.is_owned = false;
36252         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
36253 }
36254
36255 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) {
36256         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);
36257         int64_t ret_ref = 0;
36258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36260         return ret_ref;
36261 }
36262
36263 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
36264         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
36265         int64_t ret_ref = 0;
36266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36268         return ret_ref;
36269 }
36270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36271         LDKChannelHandshakeConfig arg_conv;
36272         arg_conv.inner = untag_ptr(arg);
36273         arg_conv.is_owned = ptr_is_owned(arg);
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36275         arg_conv.is_owned = false;
36276         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
36277         return ret_conv;
36278 }
36279
36280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36281         LDKChannelHandshakeConfig orig_conv;
36282         orig_conv.inner = untag_ptr(orig);
36283         orig_conv.is_owned = ptr_is_owned(orig);
36284         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36285         orig_conv.is_owned = false;
36286         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
36287         int64_t ret_ref = 0;
36288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36290         return ret_ref;
36291 }
36292
36293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
36294         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
36295         int64_t ret_ref = 0;
36296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36298         return ret_ref;
36299 }
36300
36301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36302         LDKChannelHandshakeLimits this_obj_conv;
36303         this_obj_conv.inner = untag_ptr(this_obj);
36304         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36306         ChannelHandshakeLimits_free(this_obj_conv);
36307 }
36308
36309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36310         LDKChannelHandshakeLimits this_ptr_conv;
36311         this_ptr_conv.inner = untag_ptr(this_ptr);
36312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36314         this_ptr_conv.is_owned = false;
36315         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
36316         return ret_conv;
36317 }
36318
36319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36320         LDKChannelHandshakeLimits this_ptr_conv;
36321         this_ptr_conv.inner = untag_ptr(this_ptr);
36322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36324         this_ptr_conv.is_owned = false;
36325         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
36326 }
36327
36328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36329         LDKChannelHandshakeLimits this_ptr_conv;
36330         this_ptr_conv.inner = untag_ptr(this_ptr);
36331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36333         this_ptr_conv.is_owned = false;
36334         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
36335         return ret_conv;
36336 }
36337
36338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36339         LDKChannelHandshakeLimits this_ptr_conv;
36340         this_ptr_conv.inner = untag_ptr(this_ptr);
36341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36343         this_ptr_conv.is_owned = false;
36344         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
36345 }
36346
36347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36348         LDKChannelHandshakeLimits this_ptr_conv;
36349         this_ptr_conv.inner = untag_ptr(this_ptr);
36350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36352         this_ptr_conv.is_owned = false;
36353         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
36354         return ret_conv;
36355 }
36356
36357 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) {
36358         LDKChannelHandshakeLimits this_ptr_conv;
36359         this_ptr_conv.inner = untag_ptr(this_ptr);
36360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36362         this_ptr_conv.is_owned = false;
36363         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
36364 }
36365
36366 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) {
36367         LDKChannelHandshakeLimits this_ptr_conv;
36368         this_ptr_conv.inner = untag_ptr(this_ptr);
36369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36371         this_ptr_conv.is_owned = false;
36372         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
36373         return ret_conv;
36374 }
36375
36376 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) {
36377         LDKChannelHandshakeLimits this_ptr_conv;
36378         this_ptr_conv.inner = untag_ptr(this_ptr);
36379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36381         this_ptr_conv.is_owned = false;
36382         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
36383 }
36384
36385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
36386         LDKChannelHandshakeLimits this_ptr_conv;
36387         this_ptr_conv.inner = untag_ptr(this_ptr);
36388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36390         this_ptr_conv.is_owned = false;
36391         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
36392         return ret_conv;
36393 }
36394
36395 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) {
36396         LDKChannelHandshakeLimits this_ptr_conv;
36397         this_ptr_conv.inner = untag_ptr(this_ptr);
36398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36400         this_ptr_conv.is_owned = false;
36401         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
36402 }
36403
36404 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36405         LDKChannelHandshakeLimits this_ptr_conv;
36406         this_ptr_conv.inner = untag_ptr(this_ptr);
36407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36409         this_ptr_conv.is_owned = false;
36410         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
36411         return ret_conv;
36412 }
36413
36414 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) {
36415         LDKChannelHandshakeLimits this_ptr_conv;
36416         this_ptr_conv.inner = untag_ptr(this_ptr);
36417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36419         this_ptr_conv.is_owned = false;
36420         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
36421 }
36422
36423 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
36424         LDKChannelHandshakeLimits this_ptr_conv;
36425         this_ptr_conv.inner = untag_ptr(this_ptr);
36426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36428         this_ptr_conv.is_owned = false;
36429         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
36430         return ret_conv;
36431 }
36432
36433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36434         LDKChannelHandshakeLimits this_ptr_conv;
36435         this_ptr_conv.inner = untag_ptr(this_ptr);
36436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36438         this_ptr_conv.is_owned = false;
36439         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
36440 }
36441
36442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
36443         LDKChannelHandshakeLimits this_ptr_conv;
36444         this_ptr_conv.inner = untag_ptr(this_ptr);
36445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36447         this_ptr_conv.is_owned = false;
36448         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
36449         return ret_conv;
36450 }
36451
36452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36453         LDKChannelHandshakeLimits this_ptr_conv;
36454         this_ptr_conv.inner = untag_ptr(this_ptr);
36455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36457         this_ptr_conv.is_owned = false;
36458         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
36459 }
36460
36461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
36462         LDKChannelHandshakeLimits this_ptr_conv;
36463         this_ptr_conv.inner = untag_ptr(this_ptr);
36464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36466         this_ptr_conv.is_owned = false;
36467         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
36468         return ret_conv;
36469 }
36470
36471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36472         LDKChannelHandshakeLimits this_ptr_conv;
36473         this_ptr_conv.inner = untag_ptr(this_ptr);
36474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36476         this_ptr_conv.is_owned = false;
36477         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
36478 }
36479
36480 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
36481         LDKChannelHandshakeLimits this_ptr_conv;
36482         this_ptr_conv.inner = untag_ptr(this_ptr);
36483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36485         this_ptr_conv.is_owned = false;
36486         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
36487         return ret_conv;
36488 }
36489
36490 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) {
36491         LDKChannelHandshakeLimits this_ptr_conv;
36492         this_ptr_conv.inner = untag_ptr(this_ptr);
36493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36495         this_ptr_conv.is_owned = false;
36496         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
36497 }
36498
36499 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) {
36500         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);
36501         int64_t ret_ref = 0;
36502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36504         return ret_ref;
36505 }
36506
36507 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
36508         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
36509         int64_t ret_ref = 0;
36510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36512         return ret_ref;
36513 }
36514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36515         LDKChannelHandshakeLimits arg_conv;
36516         arg_conv.inner = untag_ptr(arg);
36517         arg_conv.is_owned = ptr_is_owned(arg);
36518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36519         arg_conv.is_owned = false;
36520         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
36521         return ret_conv;
36522 }
36523
36524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36525         LDKChannelHandshakeLimits orig_conv;
36526         orig_conv.inner = untag_ptr(orig);
36527         orig_conv.is_owned = ptr_is_owned(orig);
36528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36529         orig_conv.is_owned = false;
36530         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
36531         int64_t ret_ref = 0;
36532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36534         return ret_ref;
36535 }
36536
36537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
36538         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
36539         int64_t ret_ref = 0;
36540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36542         return ret_ref;
36543 }
36544
36545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36546         if (!ptr_is_owned(this_ptr)) return;
36547         void* this_ptr_ptr = untag_ptr(this_ptr);
36548         CHECK_ACCESS(this_ptr_ptr);
36549         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
36550         FREE(untag_ptr(this_ptr));
36551         MaxDustHTLCExposure_free(this_ptr_conv);
36552 }
36553
36554 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
36555         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36556         *ret_copy = MaxDustHTLCExposure_clone(arg);
36557         int64_t ret_ref = tag_ptr(ret_copy, true);
36558         return ret_ref;
36559 }
36560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36561         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
36562         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
36563         return ret_conv;
36564 }
36565
36566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36567         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
36568         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36569         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
36570         int64_t ret_ref = tag_ptr(ret_copy, true);
36571         return ret_ref;
36572 }
36573
36574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
36575         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36576         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
36577         int64_t ret_ref = tag_ptr(ret_copy, true);
36578         return ret_ref;
36579 }
36580
36581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
36582         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36583         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
36584         int64_t ret_ref = tag_ptr(ret_copy, true);
36585         return ret_ref;
36586 }
36587
36588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36589         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
36590         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
36591         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
36592         return ret_conv;
36593 }
36594
36595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
36596         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
36597         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
36598         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36599         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36600         CVec_u8Z_free(ret_var);
36601         return ret_arr;
36602 }
36603
36604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36605         LDKu8slice ser_ref;
36606         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36607         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36608         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
36609         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
36610         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36611         return tag_ptr(ret_conv, true);
36612 }
36613
36614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36615         LDKChannelConfig this_obj_conv;
36616         this_obj_conv.inner = untag_ptr(this_obj);
36617         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36619         ChannelConfig_free(this_obj_conv);
36620 }
36621
36622 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36623         LDKChannelConfig this_ptr_conv;
36624         this_ptr_conv.inner = untag_ptr(this_ptr);
36625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36627         this_ptr_conv.is_owned = false;
36628         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
36629         return ret_conv;
36630 }
36631
36632 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) {
36633         LDKChannelConfig this_ptr_conv;
36634         this_ptr_conv.inner = untag_ptr(this_ptr);
36635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36637         this_ptr_conv.is_owned = false;
36638         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
36639 }
36640
36641 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36642         LDKChannelConfig this_ptr_conv;
36643         this_ptr_conv.inner = untag_ptr(this_ptr);
36644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36646         this_ptr_conv.is_owned = false;
36647         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
36648         return ret_conv;
36649 }
36650
36651 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) {
36652         LDKChannelConfig this_ptr_conv;
36653         this_ptr_conv.inner = untag_ptr(this_ptr);
36654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36656         this_ptr_conv.is_owned = false;
36657         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
36658 }
36659
36660 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36661         LDKChannelConfig this_ptr_conv;
36662         this_ptr_conv.inner = untag_ptr(this_ptr);
36663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36665         this_ptr_conv.is_owned = false;
36666         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
36667         return ret_conv;
36668 }
36669
36670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36671         LDKChannelConfig this_ptr_conv;
36672         this_ptr_conv.inner = untag_ptr(this_ptr);
36673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36675         this_ptr_conv.is_owned = false;
36676         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
36677 }
36678
36679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
36680         LDKChannelConfig this_ptr_conv;
36681         this_ptr_conv.inner = untag_ptr(this_ptr);
36682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36684         this_ptr_conv.is_owned = false;
36685         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
36686         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
36687         int64_t ret_ref = tag_ptr(ret_copy, true);
36688         return ret_ref;
36689 }
36690
36691 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) {
36692         LDKChannelConfig this_ptr_conv;
36693         this_ptr_conv.inner = untag_ptr(this_ptr);
36694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36696         this_ptr_conv.is_owned = false;
36697         void* val_ptr = untag_ptr(val);
36698         CHECK_ACCESS(val_ptr);
36699         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
36700         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
36701         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
36702 }
36703
36704 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) {
36705         LDKChannelConfig this_ptr_conv;
36706         this_ptr_conv.inner = untag_ptr(this_ptr);
36707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36709         this_ptr_conv.is_owned = false;
36710         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
36711         return ret_conv;
36712 }
36713
36714 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) {
36715         LDKChannelConfig this_ptr_conv;
36716         this_ptr_conv.inner = untag_ptr(this_ptr);
36717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36719         this_ptr_conv.is_owned = false;
36720         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
36721 }
36722
36723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
36724         LDKChannelConfig this_ptr_conv;
36725         this_ptr_conv.inner = untag_ptr(this_ptr);
36726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36728         this_ptr_conv.is_owned = false;
36729         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
36730         return ret_conv;
36731 }
36732
36733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36734         LDKChannelConfig this_ptr_conv;
36735         this_ptr_conv.inner = untag_ptr(this_ptr);
36736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36738         this_ptr_conv.is_owned = false;
36739         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
36740 }
36741
36742 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) {
36743         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
36744         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
36745         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
36746         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
36747         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);
36748         int64_t ret_ref = 0;
36749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36751         return ret_ref;
36752 }
36753
36754 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
36755         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
36756         int64_t ret_ref = 0;
36757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36759         return ret_ref;
36760 }
36761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36762         LDKChannelConfig arg_conv;
36763         arg_conv.inner = untag_ptr(arg);
36764         arg_conv.is_owned = ptr_is_owned(arg);
36765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36766         arg_conv.is_owned = false;
36767         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
36768         return ret_conv;
36769 }
36770
36771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36772         LDKChannelConfig orig_conv;
36773         orig_conv.inner = untag_ptr(orig);
36774         orig_conv.is_owned = ptr_is_owned(orig);
36775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36776         orig_conv.is_owned = false;
36777         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
36778         int64_t ret_ref = 0;
36779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36781         return ret_ref;
36782 }
36783
36784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36785         LDKChannelConfig a_conv;
36786         a_conv.inner = untag_ptr(a);
36787         a_conv.is_owned = ptr_is_owned(a);
36788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36789         a_conv.is_owned = false;
36790         LDKChannelConfig b_conv;
36791         b_conv.inner = untag_ptr(b);
36792         b_conv.is_owned = ptr_is_owned(b);
36793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36794         b_conv.is_owned = false;
36795         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
36796         return ret_conv;
36797 }
36798
36799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
36800         LDKChannelConfig this_arg_conv;
36801         this_arg_conv.inner = untag_ptr(this_arg);
36802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36804         this_arg_conv.is_owned = false;
36805         LDKChannelConfigUpdate update_conv;
36806         update_conv.inner = untag_ptr(update);
36807         update_conv.is_owned = ptr_is_owned(update);
36808         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
36809         update_conv.is_owned = false;
36810         ChannelConfig_apply(&this_arg_conv, &update_conv);
36811 }
36812
36813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
36814         LDKChannelConfig ret_var = ChannelConfig_default();
36815         int64_t ret_ref = 0;
36816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36818         return ret_ref;
36819 }
36820
36821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
36822         LDKChannelConfig obj_conv;
36823         obj_conv.inner = untag_ptr(obj);
36824         obj_conv.is_owned = ptr_is_owned(obj);
36825         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36826         obj_conv.is_owned = false;
36827         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
36828         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36829         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36830         CVec_u8Z_free(ret_var);
36831         return ret_arr;
36832 }
36833
36834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36835         LDKu8slice ser_ref;
36836         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36837         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36838         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
36839         *ret_conv = ChannelConfig_read(ser_ref);
36840         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36841         return tag_ptr(ret_conv, true);
36842 }
36843
36844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36845         LDKChannelConfigUpdate this_obj_conv;
36846         this_obj_conv.inner = untag_ptr(this_obj);
36847         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36849         ChannelConfigUpdate_free(this_obj_conv);
36850 }
36851
36852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36853         LDKChannelConfigUpdate this_ptr_conv;
36854         this_ptr_conv.inner = untag_ptr(this_ptr);
36855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36857         this_ptr_conv.is_owned = false;
36858         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36859         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
36860         int64_t ret_ref = tag_ptr(ret_copy, true);
36861         return ret_ref;
36862 }
36863
36864 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) {
36865         LDKChannelConfigUpdate this_ptr_conv;
36866         this_ptr_conv.inner = untag_ptr(this_ptr);
36867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36869         this_ptr_conv.is_owned = false;
36870         void* val_ptr = untag_ptr(val);
36871         CHECK_ACCESS(val_ptr);
36872         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36873         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36874         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
36875 }
36876
36877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36878         LDKChannelConfigUpdate this_ptr_conv;
36879         this_ptr_conv.inner = untag_ptr(this_ptr);
36880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36882         this_ptr_conv.is_owned = false;
36883         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36884         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
36885         int64_t ret_ref = tag_ptr(ret_copy, true);
36886         return ret_ref;
36887 }
36888
36889 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) {
36890         LDKChannelConfigUpdate this_ptr_conv;
36891         this_ptr_conv.inner = untag_ptr(this_ptr);
36892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36894         this_ptr_conv.is_owned = false;
36895         void* val_ptr = untag_ptr(val);
36896         CHECK_ACCESS(val_ptr);
36897         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36898         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36899         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
36900 }
36901
36902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36903         LDKChannelConfigUpdate this_ptr_conv;
36904         this_ptr_conv.inner = untag_ptr(this_ptr);
36905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36907         this_ptr_conv.is_owned = false;
36908         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
36909         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
36910         int64_t ret_ref = tag_ptr(ret_copy, true);
36911         return ret_ref;
36912 }
36913
36914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36915         LDKChannelConfigUpdate this_ptr_conv;
36916         this_ptr_conv.inner = untag_ptr(this_ptr);
36917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36919         this_ptr_conv.is_owned = false;
36920         void* val_ptr = untag_ptr(val);
36921         CHECK_ACCESS(val_ptr);
36922         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
36923         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
36924         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
36925 }
36926
36927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36928         LDKChannelConfigUpdate this_ptr_conv;
36929         this_ptr_conv.inner = untag_ptr(this_ptr);
36930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36932         this_ptr_conv.is_owned = false;
36933         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
36934         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
36935         int64_t ret_ref = tag_ptr(ret_copy, true);
36936         return ret_ref;
36937 }
36938
36939 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) {
36940         LDKChannelConfigUpdate this_ptr_conv;
36941         this_ptr_conv.inner = untag_ptr(this_ptr);
36942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36944         this_ptr_conv.is_owned = false;
36945         void* val_ptr = untag_ptr(val);
36946         CHECK_ACCESS(val_ptr);
36947         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
36948         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
36949         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
36950 }
36951
36952 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) {
36953         LDKChannelConfigUpdate this_ptr_conv;
36954         this_ptr_conv.inner = untag_ptr(this_ptr);
36955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36957         this_ptr_conv.is_owned = false;
36958         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36959         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
36960         int64_t ret_ref = tag_ptr(ret_copy, true);
36961         return ret_ref;
36962 }
36963
36964 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) {
36965         LDKChannelConfigUpdate this_ptr_conv;
36966         this_ptr_conv.inner = untag_ptr(this_ptr);
36967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36969         this_ptr_conv.is_owned = false;
36970         void* val_ptr = untag_ptr(val);
36971         CHECK_ACCESS(val_ptr);
36972         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36973         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36974         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
36975 }
36976
36977 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) {
36978         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
36979         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
36980         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
36981         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
36982         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
36983         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
36984         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
36985         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
36986         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
36987         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
36988         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
36989         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
36990         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
36991         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
36992         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
36993         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
36994         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
36995         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
36996         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
36997         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
36998         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);
36999         int64_t ret_ref = 0;
37000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37002         return ret_ref;
37003 }
37004
37005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
37006         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
37007         int64_t ret_ref = 0;
37008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37010         return ret_ref;
37011 }
37012
37013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37014         LDKUserConfig this_obj_conv;
37015         this_obj_conv.inner = untag_ptr(this_obj);
37016         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37018         UserConfig_free(this_obj_conv);
37019 }
37020
37021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
37022         LDKUserConfig this_ptr_conv;
37023         this_ptr_conv.inner = untag_ptr(this_ptr);
37024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37026         this_ptr_conv.is_owned = false;
37027         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
37028         int64_t ret_ref = 0;
37029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37031         return ret_ref;
37032 }
37033
37034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37035         LDKUserConfig this_ptr_conv;
37036         this_ptr_conv.inner = untag_ptr(this_ptr);
37037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37039         this_ptr_conv.is_owned = false;
37040         LDKChannelHandshakeConfig val_conv;
37041         val_conv.inner = untag_ptr(val);
37042         val_conv.is_owned = ptr_is_owned(val);
37043         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37044         val_conv = ChannelHandshakeConfig_clone(&val_conv);
37045         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
37046 }
37047
37048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
37049         LDKUserConfig this_ptr_conv;
37050         this_ptr_conv.inner = untag_ptr(this_ptr);
37051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37053         this_ptr_conv.is_owned = false;
37054         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
37055         int64_t ret_ref = 0;
37056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37058         return ret_ref;
37059 }
37060
37061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37062         LDKUserConfig this_ptr_conv;
37063         this_ptr_conv.inner = untag_ptr(this_ptr);
37064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37066         this_ptr_conv.is_owned = false;
37067         LDKChannelHandshakeLimits val_conv;
37068         val_conv.inner = untag_ptr(val);
37069         val_conv.is_owned = ptr_is_owned(val);
37070         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37071         val_conv = ChannelHandshakeLimits_clone(&val_conv);
37072         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
37073 }
37074
37075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
37076         LDKUserConfig this_ptr_conv;
37077         this_ptr_conv.inner = untag_ptr(this_ptr);
37078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37080         this_ptr_conv.is_owned = false;
37081         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
37082         int64_t ret_ref = 0;
37083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37085         return ret_ref;
37086 }
37087
37088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37089         LDKUserConfig this_ptr_conv;
37090         this_ptr_conv.inner = untag_ptr(this_ptr);
37091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37093         this_ptr_conv.is_owned = false;
37094         LDKChannelConfig val_conv;
37095         val_conv.inner = untag_ptr(val);
37096         val_conv.is_owned = ptr_is_owned(val);
37097         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37098         val_conv = ChannelConfig_clone(&val_conv);
37099         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
37100 }
37101
37102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
37103         LDKUserConfig this_ptr_conv;
37104         this_ptr_conv.inner = untag_ptr(this_ptr);
37105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37107         this_ptr_conv.is_owned = false;
37108         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
37109         return ret_conv;
37110 }
37111
37112 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) {
37113         LDKUserConfig this_ptr_conv;
37114         this_ptr_conv.inner = untag_ptr(this_ptr);
37115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37117         this_ptr_conv.is_owned = false;
37118         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
37119 }
37120
37121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
37122         LDKUserConfig this_ptr_conv;
37123         this_ptr_conv.inner = untag_ptr(this_ptr);
37124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37126         this_ptr_conv.is_owned = false;
37127         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
37128         return ret_conv;
37129 }
37130
37131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37132         LDKUserConfig this_ptr_conv;
37133         this_ptr_conv.inner = untag_ptr(this_ptr);
37134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37136         this_ptr_conv.is_owned = false;
37137         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
37138 }
37139
37140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
37141         LDKUserConfig this_ptr_conv;
37142         this_ptr_conv.inner = untag_ptr(this_ptr);
37143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37145         this_ptr_conv.is_owned = false;
37146         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
37147         return ret_conv;
37148 }
37149
37150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37151         LDKUserConfig this_ptr_conv;
37152         this_ptr_conv.inner = untag_ptr(this_ptr);
37153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37155         this_ptr_conv.is_owned = false;
37156         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
37157 }
37158
37159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37160         LDKUserConfig this_ptr_conv;
37161         this_ptr_conv.inner = untag_ptr(this_ptr);
37162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37164         this_ptr_conv.is_owned = false;
37165         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
37166         return ret_conv;
37167 }
37168
37169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37170         LDKUserConfig this_ptr_conv;
37171         this_ptr_conv.inner = untag_ptr(this_ptr);
37172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37174         this_ptr_conv.is_owned = false;
37175         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
37176 }
37177
37178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
37179         LDKUserConfig this_ptr_conv;
37180         this_ptr_conv.inner = untag_ptr(this_ptr);
37181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37183         this_ptr_conv.is_owned = false;
37184         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
37185         return ret_conv;
37186 }
37187
37188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37189         LDKUserConfig this_ptr_conv;
37190         this_ptr_conv.inner = untag_ptr(this_ptr);
37191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37193         this_ptr_conv.is_owned = false;
37194         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
37195 }
37196
37197 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) {
37198         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
37199         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
37200         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
37201         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
37202         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
37203         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
37204         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
37205         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
37206         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
37207         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
37208         LDKChannelConfig channel_config_arg_conv;
37209         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
37210         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
37211         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
37212         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
37213         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);
37214         int64_t ret_ref = 0;
37215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37217         return ret_ref;
37218 }
37219
37220 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
37221         LDKUserConfig ret_var = UserConfig_clone(arg);
37222         int64_t ret_ref = 0;
37223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37225         return ret_ref;
37226 }
37227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37228         LDKUserConfig arg_conv;
37229         arg_conv.inner = untag_ptr(arg);
37230         arg_conv.is_owned = ptr_is_owned(arg);
37231         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37232         arg_conv.is_owned = false;
37233         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
37234         return ret_conv;
37235 }
37236
37237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37238         LDKUserConfig orig_conv;
37239         orig_conv.inner = untag_ptr(orig);
37240         orig_conv.is_owned = ptr_is_owned(orig);
37241         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37242         orig_conv.is_owned = false;
37243         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
37244         int64_t ret_ref = 0;
37245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37247         return ret_ref;
37248 }
37249
37250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
37251         LDKUserConfig ret_var = UserConfig_default();
37252         int64_t ret_ref = 0;
37253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37255         return ret_ref;
37256 }
37257
37258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37259         LDKBestBlock this_obj_conv;
37260         this_obj_conv.inner = untag_ptr(this_obj);
37261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37263         BestBlock_free(this_obj_conv);
37264 }
37265
37266 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
37267         LDKBestBlock ret_var = BestBlock_clone(arg);
37268         int64_t ret_ref = 0;
37269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37271         return ret_ref;
37272 }
37273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37274         LDKBestBlock arg_conv;
37275         arg_conv.inner = untag_ptr(arg);
37276         arg_conv.is_owned = ptr_is_owned(arg);
37277         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37278         arg_conv.is_owned = false;
37279         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
37280         return ret_conv;
37281 }
37282
37283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37284         LDKBestBlock orig_conv;
37285         orig_conv.inner = untag_ptr(orig);
37286         orig_conv.is_owned = ptr_is_owned(orig);
37287         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37288         orig_conv.is_owned = false;
37289         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
37290         int64_t ret_ref = 0;
37291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37293         return ret_ref;
37294 }
37295
37296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37297         LDKBestBlock a_conv;
37298         a_conv.inner = untag_ptr(a);
37299         a_conv.is_owned = ptr_is_owned(a);
37300         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37301         a_conv.is_owned = false;
37302         LDKBestBlock b_conv;
37303         b_conv.inner = untag_ptr(b);
37304         b_conv.is_owned = ptr_is_owned(b);
37305         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37306         b_conv.is_owned = false;
37307         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
37308         return ret_conv;
37309 }
37310
37311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
37312         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
37313         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
37314         int64_t ret_ref = 0;
37315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37317         return ret_ref;
37318 }
37319
37320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
37321         LDKThirtyTwoBytes block_hash_ref;
37322         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
37323         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
37324         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
37325         int64_t ret_ref = 0;
37326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37328         return ret_ref;
37329 }
37330
37331 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
37332         LDKBestBlock this_arg_conv;
37333         this_arg_conv.inner = untag_ptr(this_arg);
37334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37336         this_arg_conv.is_owned = false;
37337         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37338         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
37339         return ret_arr;
37340 }
37341
37342 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
37343         LDKBestBlock this_arg_conv;
37344         this_arg_conv.inner = untag_ptr(this_arg);
37345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37347         this_arg_conv.is_owned = false;
37348         int32_t ret_conv = BestBlock_height(&this_arg_conv);
37349         return ret_conv;
37350 }
37351
37352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37353         if (!ptr_is_owned(this_ptr)) return;
37354         void* this_ptr_ptr = untag_ptr(this_ptr);
37355         CHECK_ACCESS(this_ptr_ptr);
37356         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
37357         FREE(untag_ptr(this_ptr));
37358         Listen_free(this_ptr_conv);
37359 }
37360
37361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37362         if (!ptr_is_owned(this_ptr)) return;
37363         void* this_ptr_ptr = untag_ptr(this_ptr);
37364         CHECK_ACCESS(this_ptr_ptr);
37365         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
37366         FREE(untag_ptr(this_ptr));
37367         Confirm_free(this_ptr_conv);
37368 }
37369
37370 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37371         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
37372         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
37373         return ret_conv;
37374 }
37375
37376 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
37377         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
37378         return ret_conv;
37379 }
37380
37381 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
37382         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
37383         return ret_conv;
37384 }
37385
37386 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
37387         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
37388         return ret_conv;
37389 }
37390
37391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37392         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
37393         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
37394         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
37395         return ret_conv;
37396 }
37397
37398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37399         if (!ptr_is_owned(this_ptr)) return;
37400         void* this_ptr_ptr = untag_ptr(this_ptr);
37401         CHECK_ACCESS(this_ptr_ptr);
37402         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
37403         FREE(untag_ptr(this_ptr));
37404         Watch_free(this_ptr_conv);
37405 }
37406
37407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37408         if (!ptr_is_owned(this_ptr)) return;
37409         void* this_ptr_ptr = untag_ptr(this_ptr);
37410         CHECK_ACCESS(this_ptr_ptr);
37411         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
37412         FREE(untag_ptr(this_ptr));
37413         Filter_free(this_ptr_conv);
37414 }
37415
37416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37417         LDKWatchedOutput this_obj_conv;
37418         this_obj_conv.inner = untag_ptr(this_obj);
37419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37421         WatchedOutput_free(this_obj_conv);
37422 }
37423
37424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
37425         LDKWatchedOutput this_ptr_conv;
37426         this_ptr_conv.inner = untag_ptr(this_ptr);
37427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37429         this_ptr_conv.is_owned = false;
37430         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
37431         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
37432         int64_t ret_ref = tag_ptr(ret_copy, true);
37433         return ret_ref;
37434 }
37435
37436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37437         LDKWatchedOutput this_ptr_conv;
37438         this_ptr_conv.inner = untag_ptr(this_ptr);
37439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37441         this_ptr_conv.is_owned = false;
37442         void* val_ptr = untag_ptr(val);
37443         CHECK_ACCESS(val_ptr);
37444         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
37445         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
37446         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
37447 }
37448
37449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37450         LDKWatchedOutput this_ptr_conv;
37451         this_ptr_conv.inner = untag_ptr(this_ptr);
37452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37454         this_ptr_conv.is_owned = false;
37455         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
37456         int64_t ret_ref = 0;
37457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37459         return ret_ref;
37460 }
37461
37462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37463         LDKWatchedOutput this_ptr_conv;
37464         this_ptr_conv.inner = untag_ptr(this_ptr);
37465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37467         this_ptr_conv.is_owned = false;
37468         LDKOutPoint val_conv;
37469         val_conv.inner = untag_ptr(val);
37470         val_conv.is_owned = ptr_is_owned(val);
37471         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37472         val_conv = OutPoint_clone(&val_conv);
37473         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
37474 }
37475
37476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37477         LDKWatchedOutput this_ptr_conv;
37478         this_ptr_conv.inner = untag_ptr(this_ptr);
37479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37481         this_ptr_conv.is_owned = false;
37482         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
37483         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37484         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37485         return ret_arr;
37486 }
37487
37488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37489         LDKWatchedOutput this_ptr_conv;
37490         this_ptr_conv.inner = untag_ptr(this_ptr);
37491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37493         this_ptr_conv.is_owned = false;
37494         LDKCVec_u8Z val_ref;
37495         val_ref.datalen = (*env)->GetArrayLength(env, val);
37496         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37497         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
37498         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
37499 }
37500
37501 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) {
37502         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
37503         CHECK_ACCESS(block_hash_arg_ptr);
37504         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
37505         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
37506         LDKOutPoint outpoint_arg_conv;
37507         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
37508         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
37509         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
37510         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
37511         LDKCVec_u8Z script_pubkey_arg_ref;
37512         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
37513         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37514         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
37515         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
37516         int64_t ret_ref = 0;
37517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37519         return ret_ref;
37520 }
37521
37522 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
37523         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
37524         int64_t ret_ref = 0;
37525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37527         return ret_ref;
37528 }
37529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37530         LDKWatchedOutput arg_conv;
37531         arg_conv.inner = untag_ptr(arg);
37532         arg_conv.is_owned = ptr_is_owned(arg);
37533         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37534         arg_conv.is_owned = false;
37535         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
37536         return ret_conv;
37537 }
37538
37539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37540         LDKWatchedOutput orig_conv;
37541         orig_conv.inner = untag_ptr(orig);
37542         orig_conv.is_owned = ptr_is_owned(orig);
37543         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37544         orig_conv.is_owned = false;
37545         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
37546         int64_t ret_ref = 0;
37547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37549         return ret_ref;
37550 }
37551
37552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37553         LDKWatchedOutput a_conv;
37554         a_conv.inner = untag_ptr(a);
37555         a_conv.is_owned = ptr_is_owned(a);
37556         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37557         a_conv.is_owned = false;
37558         LDKWatchedOutput b_conv;
37559         b_conv.inner = untag_ptr(b);
37560         b_conv.is_owned = ptr_is_owned(b);
37561         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37562         b_conv.is_owned = false;
37563         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
37564         return ret_conv;
37565 }
37566
37567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
37568         LDKWatchedOutput o_conv;
37569         o_conv.inner = untag_ptr(o);
37570         o_conv.is_owned = ptr_is_owned(o);
37571         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37572         o_conv.is_owned = false;
37573         int64_t ret_conv = WatchedOutput_hash(&o_conv);
37574         return ret_conv;
37575 }
37576
37577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37578         if (!ptr_is_owned(this_ptr)) return;
37579         void* this_ptr_ptr = untag_ptr(this_ptr);
37580         CHECK_ACCESS(this_ptr_ptr);
37581         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
37582         FREE(untag_ptr(this_ptr));
37583         BroadcasterInterface_free(this_ptr_conv);
37584 }
37585
37586 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37587         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
37588         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
37589         return ret_conv;
37590 }
37591
37592 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep(JNIEnv *env, jclass clz) {
37593         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_on_chain_sweep());
37594         return ret_conv;
37595 }
37596
37597 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1max_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
37598         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee());
37599         return ret_conv;
37600 }
37601
37602 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
37603         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
37604         return ret_conv;
37605 }
37606
37607 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
37608         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
37609         return ret_conv;
37610 }
37611
37612 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
37613         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_anchor_channel_fee());
37614         return ret_conv;
37615 }
37616
37617 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
37618         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_non_anchor_channel_fee());
37619         return ret_conv;
37620 }
37621
37622 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum(JNIEnv *env, jclass clz) {
37623         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_channel_close_minimum());
37624         return ret_conv;
37625 }
37626
37627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
37628         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
37629         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
37630         return ret_conv;
37631 }
37632
37633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37634         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
37635         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
37636         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
37637         return ret_conv;
37638 }
37639
37640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37641         if (!ptr_is_owned(this_ptr)) return;
37642         void* this_ptr_ptr = untag_ptr(this_ptr);
37643         CHECK_ACCESS(this_ptr_ptr);
37644         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
37645         FREE(untag_ptr(this_ptr));
37646         FeeEstimator_free(this_ptr_conv);
37647 }
37648
37649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37650         LDKMonitorUpdateId this_obj_conv;
37651         this_obj_conv.inner = untag_ptr(this_obj);
37652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37654         MonitorUpdateId_free(this_obj_conv);
37655 }
37656
37657 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
37658         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
37659         int64_t ret_ref = 0;
37660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37662         return ret_ref;
37663 }
37664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37665         LDKMonitorUpdateId arg_conv;
37666         arg_conv.inner = untag_ptr(arg);
37667         arg_conv.is_owned = ptr_is_owned(arg);
37668         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37669         arg_conv.is_owned = false;
37670         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
37671         return ret_conv;
37672 }
37673
37674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37675         LDKMonitorUpdateId orig_conv;
37676         orig_conv.inner = untag_ptr(orig);
37677         orig_conv.is_owned = ptr_is_owned(orig);
37678         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37679         orig_conv.is_owned = false;
37680         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
37681         int64_t ret_ref = 0;
37682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37684         return ret_ref;
37685 }
37686
37687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
37688         LDKMonitorUpdateId o_conv;
37689         o_conv.inner = untag_ptr(o);
37690         o_conv.is_owned = ptr_is_owned(o);
37691         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37692         o_conv.is_owned = false;
37693         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
37694         return ret_conv;
37695 }
37696
37697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37698         LDKMonitorUpdateId a_conv;
37699         a_conv.inner = untag_ptr(a);
37700         a_conv.is_owned = ptr_is_owned(a);
37701         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37702         a_conv.is_owned = false;
37703         LDKMonitorUpdateId b_conv;
37704         b_conv.inner = untag_ptr(b);
37705         b_conv.is_owned = ptr_is_owned(b);
37706         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37707         b_conv.is_owned = false;
37708         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
37709         return ret_conv;
37710 }
37711
37712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37713         if (!ptr_is_owned(this_ptr)) return;
37714         void* this_ptr_ptr = untag_ptr(this_ptr);
37715         CHECK_ACCESS(this_ptr_ptr);
37716         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
37717         FREE(untag_ptr(this_ptr));
37718         Persist_free(this_ptr_conv);
37719 }
37720
37721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37722         LDKLockedChannelMonitor this_obj_conv;
37723         this_obj_conv.inner = untag_ptr(this_obj);
37724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37726         LockedChannelMonitor_free(this_obj_conv);
37727 }
37728
37729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37730         LDKChainMonitor this_obj_conv;
37731         this_obj_conv.inner = untag_ptr(this_obj);
37732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37734         ChainMonitor_free(this_obj_conv);
37735 }
37736
37737 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) {
37738         void* chain_source_ptr = untag_ptr(chain_source);
37739         CHECK_ACCESS(chain_source_ptr);
37740         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
37741         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
37742         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
37743                 // Manually implement clone for Java trait instances
37744                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
37745                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37746                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
37747                 }
37748         }
37749         void* broadcaster_ptr = untag_ptr(broadcaster);
37750         CHECK_ACCESS(broadcaster_ptr);
37751         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
37752         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
37753                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37754                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
37755         }
37756         void* logger_ptr = untag_ptr(logger);
37757         CHECK_ACCESS(logger_ptr);
37758         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37759         if (logger_conv.free == LDKLogger_JCalls_free) {
37760                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37761                 LDKLogger_JCalls_cloned(&logger_conv);
37762         }
37763         void* feeest_ptr = untag_ptr(feeest);
37764         CHECK_ACCESS(feeest_ptr);
37765         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
37766         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
37767                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37768                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
37769         }
37770         void* persister_ptr = untag_ptr(persister);
37771         CHECK_ACCESS(persister_ptr);
37772         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
37773         if (persister_conv.free == LDKPersist_JCalls_free) {
37774                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37775                 LDKPersist_JCalls_cloned(&persister_conv);
37776         }
37777         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
37778         int64_t ret_ref = 0;
37779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37781         return ret_ref;
37782 }
37783
37784 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) {
37785         LDKChainMonitor this_arg_conv;
37786         this_arg_conv.inner = untag_ptr(this_arg);
37787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37789         this_arg_conv.is_owned = false;
37790         LDKCVec_ChannelDetailsZ ignored_channels_constr;
37791         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
37792         if (ignored_channels_constr.datalen > 0)
37793                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37794         else
37795                 ignored_channels_constr.data = NULL;
37796         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
37797         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
37798                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
37799                 LDKChannelDetails ignored_channels_conv_16_conv;
37800                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
37801                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
37802                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
37803                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
37804                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
37805         }
37806         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
37807         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
37808         int64_tArray ret_arr = NULL;
37809         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37810         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37811         for (size_t j = 0; j < ret_var.datalen; j++) {
37812                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
37813                 *ret_conv_9_copy = ret_var.data[j];
37814                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
37815                 ret_arr_ptr[j] = ret_conv_9_ref;
37816         }
37817         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37818         FREE(ret_var.data);
37819         return ret_arr;
37820 }
37821
37822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
37823         LDKChainMonitor this_arg_conv;
37824         this_arg_conv.inner = untag_ptr(this_arg);
37825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37827         this_arg_conv.is_owned = false;
37828         LDKOutPoint funding_txo_conv;
37829         funding_txo_conv.inner = untag_ptr(funding_txo);
37830         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37831         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37832         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37833         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
37834         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
37835         return tag_ptr(ret_conv, true);
37836 }
37837
37838 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
37839         LDKChainMonitor this_arg_conv;
37840         this_arg_conv.inner = untag_ptr(this_arg);
37841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37843         this_arg_conv.is_owned = false;
37844         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
37845         int64_tArray ret_arr = NULL;
37846         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37847         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37848         for (size_t k = 0; k < ret_var.datalen; k++) {
37849                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
37850                 int64_t ret_conv_10_ref = 0;
37851                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
37852                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
37853                 ret_arr_ptr[k] = ret_conv_10_ref;
37854         }
37855         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37856         FREE(ret_var.data);
37857         return ret_arr;
37858 }
37859
37860 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
37861         LDKChainMonitor this_arg_conv;
37862         this_arg_conv.inner = untag_ptr(this_arg);
37863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37865         this_arg_conv.is_owned = false;
37866         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
37867         int64_tArray ret_arr = NULL;
37868         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37869         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37870         for (size_t p = 0; p < ret_var.datalen; p++) {
37871                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37872                 *ret_conv_41_conv = ret_var.data[p];
37873                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
37874         }
37875         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37876         FREE(ret_var.data);
37877         return ret_arr;
37878 }
37879
37880 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) {
37881         LDKChainMonitor this_arg_conv;
37882         this_arg_conv.inner = untag_ptr(this_arg);
37883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37885         this_arg_conv.is_owned = false;
37886         LDKOutPoint funding_txo_conv;
37887         funding_txo_conv.inner = untag_ptr(funding_txo);
37888         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
37889         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
37890         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
37891         LDKMonitorUpdateId completed_update_id_conv;
37892         completed_update_id_conv.inner = untag_ptr(completed_update_id);
37893         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
37894         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
37895         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
37896         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
37897         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
37898         return tag_ptr(ret_conv, true);
37899 }
37900
37901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
37902         LDKChainMonitor this_arg_conv;
37903         this_arg_conv.inner = untag_ptr(this_arg);
37904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37906         this_arg_conv.is_owned = false;
37907         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
37908         int64_t ret_ref = 0;
37909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37911         return ret_ref;
37912 }
37913
37914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
37915         LDKChainMonitor this_arg_conv;
37916         this_arg_conv.inner = untag_ptr(this_arg);
37917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37919         this_arg_conv.is_owned = false;
37920         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
37921 }
37922
37923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
37924         LDKChainMonitor this_arg_conv;
37925         this_arg_conv.inner = untag_ptr(this_arg);
37926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37928         this_arg_conv.is_owned = false;
37929         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
37930         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
37931         return tag_ptr(ret_ret, true);
37932 }
37933
37934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
37935         LDKChainMonitor this_arg_conv;
37936         this_arg_conv.inner = untag_ptr(this_arg);
37937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37939         this_arg_conv.is_owned = false;
37940         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
37941         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
37942         return tag_ptr(ret_ret, true);
37943 }
37944
37945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
37946         LDKChainMonitor this_arg_conv;
37947         this_arg_conv.inner = untag_ptr(this_arg);
37948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37950         this_arg_conv.is_owned = false;
37951         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
37952         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
37953         return tag_ptr(ret_ret, true);
37954 }
37955
37956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37957         LDKChainMonitor this_arg_conv;
37958         this_arg_conv.inner = untag_ptr(this_arg);
37959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37961         this_arg_conv.is_owned = false;
37962         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
37963         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
37964         return tag_ptr(ret_ret, true);
37965 }
37966
37967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37968         LDKChannelMonitorUpdate this_obj_conv;
37969         this_obj_conv.inner = untag_ptr(this_obj);
37970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37972         ChannelMonitorUpdate_free(this_obj_conv);
37973 }
37974
37975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37976         LDKChannelMonitorUpdate this_ptr_conv;
37977         this_ptr_conv.inner = untag_ptr(this_ptr);
37978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37980         this_ptr_conv.is_owned = false;
37981         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
37982         return ret_conv;
37983 }
37984
37985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37986         LDKChannelMonitorUpdate this_ptr_conv;
37987         this_ptr_conv.inner = untag_ptr(this_ptr);
37988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37990         this_ptr_conv.is_owned = false;
37991         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
37992 }
37993
37994 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
37995         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
37996         int64_t ret_ref = 0;
37997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37999         return ret_ref;
38000 }
38001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38002         LDKChannelMonitorUpdate arg_conv;
38003         arg_conv.inner = untag_ptr(arg);
38004         arg_conv.is_owned = ptr_is_owned(arg);
38005         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38006         arg_conv.is_owned = false;
38007         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
38008         return ret_conv;
38009 }
38010
38011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38012         LDKChannelMonitorUpdate orig_conv;
38013         orig_conv.inner = untag_ptr(orig);
38014         orig_conv.is_owned = ptr_is_owned(orig);
38015         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38016         orig_conv.is_owned = false;
38017         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
38018         int64_t ret_ref = 0;
38019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38021         return ret_ref;
38022 }
38023
38024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38025         LDKChannelMonitorUpdate a_conv;
38026         a_conv.inner = untag_ptr(a);
38027         a_conv.is_owned = ptr_is_owned(a);
38028         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38029         a_conv.is_owned = false;
38030         LDKChannelMonitorUpdate b_conv;
38031         b_conv.inner = untag_ptr(b);
38032         b_conv.is_owned = ptr_is_owned(b);
38033         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38034         b_conv.is_owned = false;
38035         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
38036         return ret_conv;
38037 }
38038
38039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
38040         LDKChannelMonitorUpdate obj_conv;
38041         obj_conv.inner = untag_ptr(obj);
38042         obj_conv.is_owned = ptr_is_owned(obj);
38043         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38044         obj_conv.is_owned = false;
38045         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
38046         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38047         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38048         CVec_u8Z_free(ret_var);
38049         return ret_arr;
38050 }
38051
38052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38053         LDKu8slice ser_ref;
38054         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38055         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38056         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
38057         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
38058         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38059         return tag_ptr(ret_conv, true);
38060 }
38061
38062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38063         if (!ptr_is_owned(this_ptr)) return;
38064         void* this_ptr_ptr = untag_ptr(this_ptr);
38065         CHECK_ACCESS(this_ptr_ptr);
38066         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
38067         FREE(untag_ptr(this_ptr));
38068         MonitorEvent_free(this_ptr_conv);
38069 }
38070
38071 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
38072         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38073         *ret_copy = MonitorEvent_clone(arg);
38074         int64_t ret_ref = tag_ptr(ret_copy, true);
38075         return ret_ref;
38076 }
38077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38078         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
38079         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
38080         return ret_conv;
38081 }
38082
38083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38084         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
38085         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38086         *ret_copy = MonitorEvent_clone(orig_conv);
38087         int64_t ret_ref = tag_ptr(ret_copy, true);
38088         return ret_ref;
38089 }
38090
38091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
38092         LDKHTLCUpdate a_conv;
38093         a_conv.inner = untag_ptr(a);
38094         a_conv.is_owned = ptr_is_owned(a);
38095         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38096         a_conv = HTLCUpdate_clone(&a_conv);
38097         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38098         *ret_copy = MonitorEvent_htlcevent(a_conv);
38099         int64_t ret_ref = tag_ptr(ret_copy, true);
38100         return ret_ref;
38101 }
38102
38103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
38104         LDKOutPoint a_conv;
38105         a_conv.inner = untag_ptr(a);
38106         a_conv.is_owned = ptr_is_owned(a);
38107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38108         a_conv = OutPoint_clone(&a_conv);
38109         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38110         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
38111         int64_t ret_ref = tag_ptr(ret_copy, true);
38112         return ret_ref;
38113 }
38114
38115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
38116         LDKOutPoint funding_txo_conv;
38117         funding_txo_conv.inner = untag_ptr(funding_txo);
38118         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38119         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38120         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38121         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38122         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
38123         int64_t ret_ref = tag_ptr(ret_copy, true);
38124         return ret_ref;
38125 }
38126
38127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38128         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
38129         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
38130         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
38131         return ret_conv;
38132 }
38133
38134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
38135         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
38136         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
38137         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38138         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38139         CVec_u8Z_free(ret_var);
38140         return ret_arr;
38141 }
38142
38143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38144         LDKu8slice ser_ref;
38145         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38146         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38147         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
38148         *ret_conv = MonitorEvent_read(ser_ref);
38149         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38150         return tag_ptr(ret_conv, true);
38151 }
38152
38153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38154         LDKHTLCUpdate this_obj_conv;
38155         this_obj_conv.inner = untag_ptr(this_obj);
38156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38158         HTLCUpdate_free(this_obj_conv);
38159 }
38160
38161 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
38162         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
38163         int64_t ret_ref = 0;
38164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38166         return ret_ref;
38167 }
38168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38169         LDKHTLCUpdate arg_conv;
38170         arg_conv.inner = untag_ptr(arg);
38171         arg_conv.is_owned = ptr_is_owned(arg);
38172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38173         arg_conv.is_owned = false;
38174         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
38175         return ret_conv;
38176 }
38177
38178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38179         LDKHTLCUpdate orig_conv;
38180         orig_conv.inner = untag_ptr(orig);
38181         orig_conv.is_owned = ptr_is_owned(orig);
38182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38183         orig_conv.is_owned = false;
38184         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
38185         int64_t ret_ref = 0;
38186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38188         return ret_ref;
38189 }
38190
38191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38192         LDKHTLCUpdate a_conv;
38193         a_conv.inner = untag_ptr(a);
38194         a_conv.is_owned = ptr_is_owned(a);
38195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38196         a_conv.is_owned = false;
38197         LDKHTLCUpdate b_conv;
38198         b_conv.inner = untag_ptr(b);
38199         b_conv.is_owned = ptr_is_owned(b);
38200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38201         b_conv.is_owned = false;
38202         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
38203         return ret_conv;
38204 }
38205
38206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
38207         LDKHTLCUpdate obj_conv;
38208         obj_conv.inner = untag_ptr(obj);
38209         obj_conv.is_owned = ptr_is_owned(obj);
38210         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38211         obj_conv.is_owned = false;
38212         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
38213         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38214         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38215         CVec_u8Z_free(ret_var);
38216         return ret_arr;
38217 }
38218
38219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38220         LDKu8slice ser_ref;
38221         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38222         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38223         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
38224         *ret_conv = HTLCUpdate_read(ser_ref);
38225         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38226         return tag_ptr(ret_conv, true);
38227 }
38228
38229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38230         if (!ptr_is_owned(this_ptr)) return;
38231         void* this_ptr_ptr = untag_ptr(this_ptr);
38232         CHECK_ACCESS(this_ptr_ptr);
38233         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
38234         FREE(untag_ptr(this_ptr));
38235         Balance_free(this_ptr_conv);
38236 }
38237
38238 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
38239         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38240         *ret_copy = Balance_clone(arg);
38241         int64_t ret_ref = tag_ptr(ret_copy, true);
38242         return ret_ref;
38243 }
38244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38245         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
38246         int64_t ret_conv = Balance_clone_ptr(arg_conv);
38247         return ret_conv;
38248 }
38249
38250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38251         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
38252         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38253         *ret_copy = Balance_clone(orig_conv);
38254         int64_t ret_ref = tag_ptr(ret_copy, true);
38255         return ret_ref;
38256 }
38257
38258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
38259         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38260         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
38261         int64_t ret_ref = tag_ptr(ret_copy, true);
38262         return ret_ref;
38263 }
38264
38265 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) {
38266         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38267         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
38268         int64_t ret_ref = tag_ptr(ret_copy, true);
38269         return ret_ref;
38270 }
38271
38272 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) {
38273         LDKThirtyTwoBytes payment_hash_ref;
38274         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38275         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38276         LDKThirtyTwoBytes payment_preimage_ref;
38277         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
38278         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
38279         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38280         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
38281         int64_t ret_ref = tag_ptr(ret_copy, true);
38282         return ret_ref;
38283 }
38284
38285 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) {
38286         LDKThirtyTwoBytes payment_hash_ref;
38287         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38288         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38289         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38290         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
38291         int64_t ret_ref = tag_ptr(ret_copy, true);
38292         return ret_ref;
38293 }
38294
38295 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) {
38296         LDKThirtyTwoBytes payment_hash_ref;
38297         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38298         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38299         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38300         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
38301         int64_t ret_ref = tag_ptr(ret_copy, true);
38302         return ret_ref;
38303 }
38304
38305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
38306         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38307         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
38308         int64_t ret_ref = tag_ptr(ret_copy, true);
38309         return ret_ref;
38310 }
38311
38312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38313         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
38314         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
38315         jboolean ret_conv = Balance_eq(a_conv, b_conv);
38316         return ret_conv;
38317 }
38318
38319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
38320         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
38321         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
38322         return ret_conv;
38323 }
38324
38325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38326         LDKChannelMonitor this_obj_conv;
38327         this_obj_conv.inner = untag_ptr(this_obj);
38328         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38330         ChannelMonitor_free(this_obj_conv);
38331 }
38332
38333 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
38334         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
38335         int64_t ret_ref = 0;
38336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38338         return ret_ref;
38339 }
38340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38341         LDKChannelMonitor arg_conv;
38342         arg_conv.inner = untag_ptr(arg);
38343         arg_conv.is_owned = ptr_is_owned(arg);
38344         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38345         arg_conv.is_owned = false;
38346         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
38347         return ret_conv;
38348 }
38349
38350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38351         LDKChannelMonitor orig_conv;
38352         orig_conv.inner = untag_ptr(orig);
38353         orig_conv.is_owned = ptr_is_owned(orig);
38354         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38355         orig_conv.is_owned = false;
38356         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
38357         int64_t ret_ref = 0;
38358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38360         return ret_ref;
38361 }
38362
38363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
38364         LDKChannelMonitor obj_conv;
38365         obj_conv.inner = untag_ptr(obj);
38366         obj_conv.is_owned = ptr_is_owned(obj);
38367         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38368         obj_conv.is_owned = false;
38369         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
38370         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38371         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38372         CVec_u8Z_free(ret_var);
38373         return ret_arr;
38374 }
38375
38376 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) {
38377         LDKChannelMonitor this_arg_conv;
38378         this_arg_conv.inner = untag_ptr(this_arg);
38379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38381         this_arg_conv.is_owned = false;
38382         LDKChannelMonitorUpdate updates_conv;
38383         updates_conv.inner = untag_ptr(updates);
38384         updates_conv.is_owned = ptr_is_owned(updates);
38385         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
38386         updates_conv.is_owned = false;
38387         void* broadcaster_ptr = untag_ptr(broadcaster);
38388         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
38389         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
38390         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38391         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
38392         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
38393         void* logger_ptr = untag_ptr(logger);
38394         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
38395         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
38396         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
38397         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
38398         return tag_ptr(ret_conv, true);
38399 }
38400
38401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
38402         LDKChannelMonitor this_arg_conv;
38403         this_arg_conv.inner = untag_ptr(this_arg);
38404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38406         this_arg_conv.is_owned = false;
38407         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
38408         return ret_conv;
38409 }
38410
38411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
38412         LDKChannelMonitor this_arg_conv;
38413         this_arg_conv.inner = untag_ptr(this_arg);
38414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38416         this_arg_conv.is_owned = false;
38417         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
38418         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
38419         return tag_ptr(ret_conv, true);
38420 }
38421
38422 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
38423         LDKChannelMonitor this_arg_conv;
38424         this_arg_conv.inner = untag_ptr(this_arg);
38425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38427         this_arg_conv.is_owned = false;
38428         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
38429         int64_tArray ret_arr = NULL;
38430         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38431         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38432         for (size_t a = 0; a < ret_var.datalen; a++) {
38433                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
38434                 *ret_conv_52_conv = ret_var.data[a];
38435                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
38436         }
38437         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38438         FREE(ret_var.data);
38439         return ret_arr;
38440 }
38441
38442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
38443         LDKChannelMonitor this_arg_conv;
38444         this_arg_conv.inner = untag_ptr(this_arg);
38445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38447         this_arg_conv.is_owned = false;
38448         void* filter_ptr = untag_ptr(filter);
38449         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
38450         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
38451         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
38452 }
38453
38454 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
38455         LDKChannelMonitor this_arg_conv;
38456         this_arg_conv.inner = untag_ptr(this_arg);
38457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38459         this_arg_conv.is_owned = false;
38460         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
38461         int64_tArray ret_arr = NULL;
38462         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38463         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38464         for (size_t o = 0; o < ret_var.datalen; o++) {
38465                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
38466                 *ret_conv_14_copy = ret_var.data[o];
38467                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
38468                 ret_arr_ptr[o] = ret_conv_14_ref;
38469         }
38470         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38471         FREE(ret_var.data);
38472         return ret_arr;
38473 }
38474
38475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
38476         LDKChannelMonitor this_arg_conv;
38477         this_arg_conv.inner = untag_ptr(this_arg);
38478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38480         this_arg_conv.is_owned = false;
38481         void* handler_ptr = untag_ptr(handler);
38482         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
38483         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
38484         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
38485 }
38486
38487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
38488         LDKChannelMonitor this_arg_conv;
38489         this_arg_conv.inner = untag_ptr(this_arg);
38490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38492         this_arg_conv.is_owned = false;
38493         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
38494         int64_t ret_ref = 0;
38495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38497         return ret_ref;
38498 }
38499
38500 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) {
38501         LDKChannelMonitor this_arg_conv;
38502         this_arg_conv.inner = untag_ptr(this_arg);
38503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38505         this_arg_conv.is_owned = false;
38506         LDKChannelMonitorUpdate update_conv;
38507         update_conv.inner = untag_ptr(update);
38508         update_conv.is_owned = ptr_is_owned(update);
38509         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
38510         update_conv.is_owned = false;
38511         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
38512         int64_tArray ret_arr = NULL;
38513         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38514         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38515         for (size_t x = 0; x < ret_var.datalen; x++) {
38516                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
38517                 int64_t ret_conv_23_ref = 0;
38518                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
38519                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
38520                 ret_arr_ptr[x] = ret_conv_23_ref;
38521         }
38522         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38523         FREE(ret_var.data);
38524         return ret_arr;
38525 }
38526
38527 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) {
38528         LDKChannelMonitor this_arg_conv;
38529         this_arg_conv.inner = untag_ptr(this_arg);
38530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38532         this_arg_conv.is_owned = false;
38533         LDKTransaction justice_tx_ref;
38534         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
38535         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
38536         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
38537         justice_tx_ref.data_is_owned = true;
38538         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
38539         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
38540         return tag_ptr(ret_conv, true);
38541 }
38542
38543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
38544         LDKChannelMonitor this_arg_conv;
38545         this_arg_conv.inner = untag_ptr(this_arg);
38546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38548         this_arg_conv.is_owned = false;
38549         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38550         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
38551         return ret_arr;
38552 }
38553
38554 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
38555         LDKChannelMonitor this_arg_conv;
38556         this_arg_conv.inner = untag_ptr(this_arg);
38557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38559         this_arg_conv.is_owned = false;
38560         void* logger_ptr = untag_ptr(logger);
38561         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
38562         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
38563         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
38564         jobjectArray ret_arr = NULL;
38565         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
38566         ;
38567         for (size_t i = 0; i < ret_var.datalen; i++) {
38568                 LDKTransaction ret_conv_8_var = ret_var.data[i];
38569                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
38570                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
38571                 Transaction_free(ret_conv_8_var);
38572                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38573         }
38574         
38575         FREE(ret_var.data);
38576         return ret_arr;
38577 }
38578
38579 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) {
38580         LDKChannelMonitor this_arg_conv;
38581         this_arg_conv.inner = untag_ptr(this_arg);
38582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38584         this_arg_conv.is_owned = false;
38585         uint8_t header_arr[80];
38586         CHECK((*env)->GetArrayLength(env, header) == 80);
38587         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38588         uint8_t (*header_ref)[80] = &header_arr;
38589         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
38590         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
38591         if (txdata_constr.datalen > 0)
38592                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
38593         else
38594                 txdata_constr.data = NULL;
38595         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
38596         for (size_t c = 0; c < txdata_constr.datalen; c++) {
38597                 int64_t txdata_conv_28 = txdata_vals[c];
38598                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
38599                 CHECK_ACCESS(txdata_conv_28_ptr);
38600                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
38601                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
38602                 txdata_constr.data[c] = txdata_conv_28_conv;
38603         }
38604         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
38605         void* broadcaster_ptr = untag_ptr(broadcaster);
38606         CHECK_ACCESS(broadcaster_ptr);
38607         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38608         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38609                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38610                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38611         }
38612         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38613         CHECK_ACCESS(fee_estimator_ptr);
38614         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38615         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38616                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38617                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38618         }
38619         void* logger_ptr = untag_ptr(logger);
38620         CHECK_ACCESS(logger_ptr);
38621         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38622         if (logger_conv.free == LDKLogger_JCalls_free) {
38623                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38624                 LDKLogger_JCalls_cloned(&logger_conv);
38625         }
38626         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);
38627         int64_tArray ret_arr = NULL;
38628         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38629         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38630         for (size_t x = 0; x < ret_var.datalen; x++) {
38631                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38632                 *ret_conv_49_conv = ret_var.data[x];
38633                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38634         }
38635         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38636         FREE(ret_var.data);
38637         return ret_arr;
38638 }
38639
38640 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) {
38641         LDKChannelMonitor this_arg_conv;
38642         this_arg_conv.inner = untag_ptr(this_arg);
38643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38645         this_arg_conv.is_owned = false;
38646         uint8_t header_arr[80];
38647         CHECK((*env)->GetArrayLength(env, header) == 80);
38648         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38649         uint8_t (*header_ref)[80] = &header_arr;
38650         void* broadcaster_ptr = untag_ptr(broadcaster);
38651         CHECK_ACCESS(broadcaster_ptr);
38652         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38653         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38654                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38655                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38656         }
38657         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38658         CHECK_ACCESS(fee_estimator_ptr);
38659         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38660         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38661                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38662                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38663         }
38664         void* logger_ptr = untag_ptr(logger);
38665         CHECK_ACCESS(logger_ptr);
38666         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38667         if (logger_conv.free == LDKLogger_JCalls_free) {
38668                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38669                 LDKLogger_JCalls_cloned(&logger_conv);
38670         }
38671         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38672 }
38673
38674 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) {
38675         LDKChannelMonitor this_arg_conv;
38676         this_arg_conv.inner = untag_ptr(this_arg);
38677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38679         this_arg_conv.is_owned = false;
38680         uint8_t header_arr[80];
38681         CHECK((*env)->GetArrayLength(env, header) == 80);
38682         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38683         uint8_t (*header_ref)[80] = &header_arr;
38684         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
38685         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
38686         if (txdata_constr.datalen > 0)
38687                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
38688         else
38689                 txdata_constr.data = NULL;
38690         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
38691         for (size_t c = 0; c < txdata_constr.datalen; c++) {
38692                 int64_t txdata_conv_28 = txdata_vals[c];
38693                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
38694                 CHECK_ACCESS(txdata_conv_28_ptr);
38695                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
38696                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
38697                 txdata_constr.data[c] = txdata_conv_28_conv;
38698         }
38699         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
38700         void* broadcaster_ptr = untag_ptr(broadcaster);
38701         CHECK_ACCESS(broadcaster_ptr);
38702         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38703         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38704                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38705                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38706         }
38707         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38708         CHECK_ACCESS(fee_estimator_ptr);
38709         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38710         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38711                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38712                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38713         }
38714         void* logger_ptr = untag_ptr(logger);
38715         CHECK_ACCESS(logger_ptr);
38716         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38717         if (logger_conv.free == LDKLogger_JCalls_free) {
38718                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38719                 LDKLogger_JCalls_cloned(&logger_conv);
38720         }
38721         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);
38722         int64_tArray ret_arr = NULL;
38723         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38724         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38725         for (size_t x = 0; x < ret_var.datalen; x++) {
38726                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38727                 *ret_conv_49_conv = ret_var.data[x];
38728                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38729         }
38730         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38731         FREE(ret_var.data);
38732         return ret_arr;
38733 }
38734
38735 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) {
38736         LDKChannelMonitor this_arg_conv;
38737         this_arg_conv.inner = untag_ptr(this_arg);
38738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38740         this_arg_conv.is_owned = false;
38741         uint8_t txid_arr[32];
38742         CHECK((*env)->GetArrayLength(env, txid) == 32);
38743         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
38744         uint8_t (*txid_ref)[32] = &txid_arr;
38745         void* broadcaster_ptr = untag_ptr(broadcaster);
38746         CHECK_ACCESS(broadcaster_ptr);
38747         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38748         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38749                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38750                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38751         }
38752         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38753         CHECK_ACCESS(fee_estimator_ptr);
38754         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38755         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38756                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38757                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38758         }
38759         void* logger_ptr = untag_ptr(logger);
38760         CHECK_ACCESS(logger_ptr);
38761         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38762         if (logger_conv.free == LDKLogger_JCalls_free) {
38763                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38764                 LDKLogger_JCalls_cloned(&logger_conv);
38765         }
38766         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
38767 }
38768
38769 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) {
38770         LDKChannelMonitor this_arg_conv;
38771         this_arg_conv.inner = untag_ptr(this_arg);
38772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38774         this_arg_conv.is_owned = false;
38775         uint8_t header_arr[80];
38776         CHECK((*env)->GetArrayLength(env, header) == 80);
38777         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
38778         uint8_t (*header_ref)[80] = &header_arr;
38779         void* broadcaster_ptr = untag_ptr(broadcaster);
38780         CHECK_ACCESS(broadcaster_ptr);
38781         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38782         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38783                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38784                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38785         }
38786         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38787         CHECK_ACCESS(fee_estimator_ptr);
38788         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38789         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38790                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38791                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38792         }
38793         void* logger_ptr = untag_ptr(logger);
38794         CHECK_ACCESS(logger_ptr);
38795         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38796         if (logger_conv.free == LDKLogger_JCalls_free) {
38797                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38798                 LDKLogger_JCalls_cloned(&logger_conv);
38799         }
38800         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
38801         int64_tArray ret_arr = NULL;
38802         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38803         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38804         for (size_t x = 0; x < ret_var.datalen; x++) {
38805                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
38806                 *ret_conv_49_conv = ret_var.data[x];
38807                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38808         }
38809         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38810         FREE(ret_var.data);
38811         return ret_arr;
38812 }
38813
38814 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
38815         LDKChannelMonitor this_arg_conv;
38816         this_arg_conv.inner = untag_ptr(this_arg);
38817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38819         this_arg_conv.is_owned = false;
38820         LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
38821         int64_tArray ret_arr = NULL;
38822         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38823         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38824         for (size_t x = 0; x < ret_var.datalen; x++) {
38825                 LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ), "LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ");
38826                 *ret_conv_49_conv = ret_var.data[x];
38827                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
38828         }
38829         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38830         FREE(ret_var.data);
38831         return ret_arr;
38832 }
38833
38834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
38835         LDKChannelMonitor this_arg_conv;
38836         this_arg_conv.inner = untag_ptr(this_arg);
38837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38839         this_arg_conv.is_owned = false;
38840         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
38841         int64_t ret_ref = 0;
38842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38844         return ret_ref;
38845 }
38846
38847 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) {
38848         LDKChannelMonitor this_arg_conv;
38849         this_arg_conv.inner = untag_ptr(this_arg);
38850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38852         this_arg_conv.is_owned = false;
38853         void* broadcaster_ptr = untag_ptr(broadcaster);
38854         CHECK_ACCESS(broadcaster_ptr);
38855         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38856         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38857                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38858                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38859         }
38860         void* fee_estimator_ptr = untag_ptr(fee_estimator);
38861         CHECK_ACCESS(fee_estimator_ptr);
38862         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
38863         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
38864                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38865                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
38866         }
38867         void* logger_ptr = untag_ptr(logger);
38868         CHECK_ACCESS(logger_ptr);
38869         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38870         if (logger_conv.free == LDKLogger_JCalls_free) {
38871                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38872                 LDKLogger_JCalls_cloned(&logger_conv);
38873         }
38874         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
38875 }
38876
38877 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) {
38878         LDKChannelMonitor this_arg_conv;
38879         this_arg_conv.inner = untag_ptr(this_arg);
38880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38882         this_arg_conv.is_owned = false;
38883         LDKTransaction tx_ref;
38884         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
38885         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
38886         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
38887         tx_ref.data_is_owned = true;
38888         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
38889         int64_tArray ret_arr = NULL;
38890         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38891         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38892         for (size_t b = 0; b < ret_var.datalen; b++) {
38893                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
38894                 *ret_conv_27_copy = ret_var.data[b];
38895                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
38896                 ret_arr_ptr[b] = ret_conv_27_ref;
38897         }
38898         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38899         FREE(ret_var.data);
38900         return ret_arr;
38901 }
38902
38903 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
38904         LDKChannelMonitor this_arg_conv;
38905         this_arg_conv.inner = untag_ptr(this_arg);
38906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38908         this_arg_conv.is_owned = false;
38909         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
38910         int64_tArray ret_arr = NULL;
38911         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38912         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38913         for (size_t j = 0; j < ret_var.datalen; j++) {
38914                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38915                 *ret_conv_9_copy = ret_var.data[j];
38916                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
38917                 ret_arr_ptr[j] = ret_conv_9_ref;
38918         }
38919         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38920         FREE(ret_var.data);
38921         return ret_arr;
38922 }
38923
38924 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) {
38925         LDKu8slice ser_ref;
38926         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38927         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38928         void* arg_a_ptr = untag_ptr(arg_a);
38929         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
38930         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
38931         void* arg_b_ptr = untag_ptr(arg_b);
38932         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
38933         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
38934         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
38935         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
38936         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38937         return tag_ptr(ret_conv, true);
38938 }
38939
38940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38941         LDKOutPoint this_obj_conv;
38942         this_obj_conv.inner = untag_ptr(this_obj);
38943         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38945         OutPoint_free(this_obj_conv);
38946 }
38947
38948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38949         LDKOutPoint this_ptr_conv;
38950         this_ptr_conv.inner = untag_ptr(this_ptr);
38951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38953         this_ptr_conv.is_owned = false;
38954         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38955         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
38956         return ret_arr;
38957 }
38958
38959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38960         LDKOutPoint this_ptr_conv;
38961         this_ptr_conv.inner = untag_ptr(this_ptr);
38962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38964         this_ptr_conv.is_owned = false;
38965         LDKThirtyTwoBytes val_ref;
38966         CHECK((*env)->GetArrayLength(env, val) == 32);
38967         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38968         OutPoint_set_txid(&this_ptr_conv, val_ref);
38969 }
38970
38971 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
38972         LDKOutPoint this_ptr_conv;
38973         this_ptr_conv.inner = untag_ptr(this_ptr);
38974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38976         this_ptr_conv.is_owned = false;
38977         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
38978         return ret_conv;
38979 }
38980
38981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38982         LDKOutPoint this_ptr_conv;
38983         this_ptr_conv.inner = untag_ptr(this_ptr);
38984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38986         this_ptr_conv.is_owned = false;
38987         OutPoint_set_index(&this_ptr_conv, val);
38988 }
38989
38990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
38991         LDKThirtyTwoBytes txid_arg_ref;
38992         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38993         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38994         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
38995         int64_t ret_ref = 0;
38996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38998         return ret_ref;
38999 }
39000
39001 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
39002         LDKOutPoint ret_var = OutPoint_clone(arg);
39003         int64_t ret_ref = 0;
39004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39006         return ret_ref;
39007 }
39008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39009         LDKOutPoint arg_conv;
39010         arg_conv.inner = untag_ptr(arg);
39011         arg_conv.is_owned = ptr_is_owned(arg);
39012         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39013         arg_conv.is_owned = false;
39014         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
39015         return ret_conv;
39016 }
39017
39018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39019         LDKOutPoint orig_conv;
39020         orig_conv.inner = untag_ptr(orig);
39021         orig_conv.is_owned = ptr_is_owned(orig);
39022         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39023         orig_conv.is_owned = false;
39024         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
39025         int64_t ret_ref = 0;
39026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39028         return ret_ref;
39029 }
39030
39031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39032         LDKOutPoint a_conv;
39033         a_conv.inner = untag_ptr(a);
39034         a_conv.is_owned = ptr_is_owned(a);
39035         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39036         a_conv.is_owned = false;
39037         LDKOutPoint b_conv;
39038         b_conv.inner = untag_ptr(b);
39039         b_conv.is_owned = ptr_is_owned(b);
39040         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39041         b_conv.is_owned = false;
39042         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
39043         return ret_conv;
39044 }
39045
39046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
39047         LDKOutPoint o_conv;
39048         o_conv.inner = untag_ptr(o);
39049         o_conv.is_owned = ptr_is_owned(o);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39051         o_conv.is_owned = false;
39052         int64_t ret_conv = OutPoint_hash(&o_conv);
39053         return ret_conv;
39054 }
39055
39056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
39057         LDKOutPoint this_arg_conv;
39058         this_arg_conv.inner = untag_ptr(this_arg);
39059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39061         this_arg_conv.is_owned = false;
39062         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39063         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
39064         return ret_arr;
39065 }
39066
39067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
39068         LDKOutPoint obj_conv;
39069         obj_conv.inner = untag_ptr(obj);
39070         obj_conv.is_owned = ptr_is_owned(obj);
39071         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39072         obj_conv.is_owned = false;
39073         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
39074         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39075         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39076         CVec_u8Z_free(ret_var);
39077         return ret_arr;
39078 }
39079
39080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39081         LDKu8slice ser_ref;
39082         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39083         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39084         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
39085         *ret_conv = OutPoint_read(ser_ref);
39086         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39087         return tag_ptr(ret_conv, true);
39088 }
39089
39090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39091         if (!ptr_is_owned(this_ptr)) return;
39092         void* this_ptr_ptr = untag_ptr(this_ptr);
39093         CHECK_ACCESS(this_ptr_ptr);
39094         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
39095         FREE(untag_ptr(this_ptr));
39096         FailureCode_free(this_ptr_conv);
39097 }
39098
39099 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
39100         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39101         *ret_copy = FailureCode_clone(arg);
39102         int64_t ret_ref = tag_ptr(ret_copy, true);
39103         return ret_ref;
39104 }
39105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39106         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
39107         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
39108         return ret_conv;
39109 }
39110
39111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39112         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
39113         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39114         *ret_copy = FailureCode_clone(orig_conv);
39115         int64_t ret_ref = tag_ptr(ret_copy, true);
39116         return ret_ref;
39117 }
39118
39119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
39120         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39121         *ret_copy = FailureCode_temporary_node_failure();
39122         int64_t ret_ref = tag_ptr(ret_copy, true);
39123         return ret_ref;
39124 }
39125
39126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
39127         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39128         *ret_copy = FailureCode_required_node_feature_missing();
39129         int64_t ret_ref = tag_ptr(ret_copy, true);
39130         return ret_ref;
39131 }
39132
39133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
39134         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39135         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
39136         int64_t ret_ref = tag_ptr(ret_copy, true);
39137         return ret_ref;
39138 }
39139
39140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
39141         void* a_ptr = untag_ptr(a);
39142         CHECK_ACCESS(a_ptr);
39143         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
39144         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
39145         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
39146         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
39147         int64_t ret_ref = tag_ptr(ret_copy, true);
39148         return ret_ref;
39149 }
39150
39151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39152         LDKChannelManager this_obj_conv;
39153         this_obj_conv.inner = untag_ptr(this_obj);
39154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39156         ChannelManager_free(this_obj_conv);
39157 }
39158
39159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39160         LDKChainParameters this_obj_conv;
39161         this_obj_conv.inner = untag_ptr(this_obj);
39162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39164         ChainParameters_free(this_obj_conv);
39165 }
39166
39167 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
39168         LDKChainParameters this_ptr_conv;
39169         this_ptr_conv.inner = untag_ptr(this_ptr);
39170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39172         this_ptr_conv.is_owned = false;
39173         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
39174         return ret_conv;
39175 }
39176
39177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
39178         LDKChainParameters this_ptr_conv;
39179         this_ptr_conv.inner = untag_ptr(this_ptr);
39180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39182         this_ptr_conv.is_owned = false;
39183         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
39184         ChainParameters_set_network(&this_ptr_conv, val_conv);
39185 }
39186
39187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
39188         LDKChainParameters this_ptr_conv;
39189         this_ptr_conv.inner = untag_ptr(this_ptr);
39190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39192         this_ptr_conv.is_owned = false;
39193         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
39194         int64_t ret_ref = 0;
39195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39197         return ret_ref;
39198 }
39199
39200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39201         LDKChainParameters this_ptr_conv;
39202         this_ptr_conv.inner = untag_ptr(this_ptr);
39203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39205         this_ptr_conv.is_owned = false;
39206         LDKBestBlock val_conv;
39207         val_conv.inner = untag_ptr(val);
39208         val_conv.is_owned = ptr_is_owned(val);
39209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39210         val_conv = BestBlock_clone(&val_conv);
39211         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
39212 }
39213
39214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
39215         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
39216         LDKBestBlock best_block_arg_conv;
39217         best_block_arg_conv.inner = untag_ptr(best_block_arg);
39218         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
39219         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
39220         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
39221         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
39222         int64_t ret_ref = 0;
39223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39225         return ret_ref;
39226 }
39227
39228 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
39229         LDKChainParameters ret_var = ChainParameters_clone(arg);
39230         int64_t ret_ref = 0;
39231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39233         return ret_ref;
39234 }
39235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39236         LDKChainParameters arg_conv;
39237         arg_conv.inner = untag_ptr(arg);
39238         arg_conv.is_owned = ptr_is_owned(arg);
39239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39240         arg_conv.is_owned = false;
39241         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
39242         return ret_conv;
39243 }
39244
39245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39246         LDKChainParameters orig_conv;
39247         orig_conv.inner = untag_ptr(orig);
39248         orig_conv.is_owned = ptr_is_owned(orig);
39249         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39250         orig_conv.is_owned = false;
39251         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
39252         int64_t ret_ref = 0;
39253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39255         return ret_ref;
39256 }
39257
39258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39259         LDKCounterpartyForwardingInfo this_obj_conv;
39260         this_obj_conv.inner = untag_ptr(this_obj);
39261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39263         CounterpartyForwardingInfo_free(this_obj_conv);
39264 }
39265
39266 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39267         LDKCounterpartyForwardingInfo this_ptr_conv;
39268         this_ptr_conv.inner = untag_ptr(this_ptr);
39269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39271         this_ptr_conv.is_owned = false;
39272         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
39273         return ret_conv;
39274 }
39275
39276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39277         LDKCounterpartyForwardingInfo this_ptr_conv;
39278         this_ptr_conv.inner = untag_ptr(this_ptr);
39279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39281         this_ptr_conv.is_owned = false;
39282         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
39283 }
39284
39285 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
39286         LDKCounterpartyForwardingInfo this_ptr_conv;
39287         this_ptr_conv.inner = untag_ptr(this_ptr);
39288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39290         this_ptr_conv.is_owned = false;
39291         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
39292         return ret_conv;
39293 }
39294
39295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39296         LDKCounterpartyForwardingInfo this_ptr_conv;
39297         this_ptr_conv.inner = untag_ptr(this_ptr);
39298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39300         this_ptr_conv.is_owned = false;
39301         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
39302 }
39303
39304 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39305         LDKCounterpartyForwardingInfo this_ptr_conv;
39306         this_ptr_conv.inner = untag_ptr(this_ptr);
39307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39309         this_ptr_conv.is_owned = false;
39310         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
39311         return ret_conv;
39312 }
39313
39314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39315         LDKCounterpartyForwardingInfo this_ptr_conv;
39316         this_ptr_conv.inner = untag_ptr(this_ptr);
39317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39319         this_ptr_conv.is_owned = false;
39320         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
39321 }
39322
39323 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) {
39324         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
39325         int64_t ret_ref = 0;
39326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39328         return ret_ref;
39329 }
39330
39331 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
39332         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
39333         int64_t ret_ref = 0;
39334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39336         return ret_ref;
39337 }
39338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39339         LDKCounterpartyForwardingInfo arg_conv;
39340         arg_conv.inner = untag_ptr(arg);
39341         arg_conv.is_owned = ptr_is_owned(arg);
39342         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39343         arg_conv.is_owned = false;
39344         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
39345         return ret_conv;
39346 }
39347
39348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39349         LDKCounterpartyForwardingInfo orig_conv;
39350         orig_conv.inner = untag_ptr(orig);
39351         orig_conv.is_owned = ptr_is_owned(orig);
39352         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39353         orig_conv.is_owned = false;
39354         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
39355         int64_t ret_ref = 0;
39356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39358         return ret_ref;
39359 }
39360
39361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39362         LDKChannelCounterparty this_obj_conv;
39363         this_obj_conv.inner = untag_ptr(this_obj);
39364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39366         ChannelCounterparty_free(this_obj_conv);
39367 }
39368
39369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39370         LDKChannelCounterparty this_ptr_conv;
39371         this_ptr_conv.inner = untag_ptr(this_ptr);
39372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39374         this_ptr_conv.is_owned = false;
39375         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39376         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
39377         return ret_arr;
39378 }
39379
39380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39381         LDKChannelCounterparty this_ptr_conv;
39382         this_ptr_conv.inner = untag_ptr(this_ptr);
39383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39385         this_ptr_conv.is_owned = false;
39386         LDKPublicKey val_ref;
39387         CHECK((*env)->GetArrayLength(env, val) == 33);
39388         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39389         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
39390 }
39391
39392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
39393         LDKChannelCounterparty this_ptr_conv;
39394         this_ptr_conv.inner = untag_ptr(this_ptr);
39395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39397         this_ptr_conv.is_owned = false;
39398         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
39399         int64_t ret_ref = 0;
39400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39402         return ret_ref;
39403 }
39404
39405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39406         LDKChannelCounterparty this_ptr_conv;
39407         this_ptr_conv.inner = untag_ptr(this_ptr);
39408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39410         this_ptr_conv.is_owned = false;
39411         LDKInitFeatures val_conv;
39412         val_conv.inner = untag_ptr(val);
39413         val_conv.is_owned = ptr_is_owned(val);
39414         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39415         val_conv = InitFeatures_clone(&val_conv);
39416         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
39417 }
39418
39419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
39420         LDKChannelCounterparty this_ptr_conv;
39421         this_ptr_conv.inner = untag_ptr(this_ptr);
39422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39424         this_ptr_conv.is_owned = false;
39425         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
39426         return ret_conv;
39427 }
39428
39429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39430         LDKChannelCounterparty this_ptr_conv;
39431         this_ptr_conv.inner = untag_ptr(this_ptr);
39432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39434         this_ptr_conv.is_owned = false;
39435         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
39436 }
39437
39438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
39439         LDKChannelCounterparty this_ptr_conv;
39440         this_ptr_conv.inner = untag_ptr(this_ptr);
39441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39443         this_ptr_conv.is_owned = false;
39444         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
39445         int64_t ret_ref = 0;
39446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39448         return ret_ref;
39449 }
39450
39451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39452         LDKChannelCounterparty this_ptr_conv;
39453         this_ptr_conv.inner = untag_ptr(this_ptr);
39454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39456         this_ptr_conv.is_owned = false;
39457         LDKCounterpartyForwardingInfo val_conv;
39458         val_conv.inner = untag_ptr(val);
39459         val_conv.is_owned = ptr_is_owned(val);
39460         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39461         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
39462         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
39463 }
39464
39465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39466         LDKChannelCounterparty this_ptr_conv;
39467         this_ptr_conv.inner = untag_ptr(this_ptr);
39468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39470         this_ptr_conv.is_owned = false;
39471         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39472         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
39473         int64_t ret_ref = tag_ptr(ret_copy, true);
39474         return ret_ref;
39475 }
39476
39477 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) {
39478         LDKChannelCounterparty this_ptr_conv;
39479         this_ptr_conv.inner = untag_ptr(this_ptr);
39480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39482         this_ptr_conv.is_owned = false;
39483         void* val_ptr = untag_ptr(val);
39484         CHECK_ACCESS(val_ptr);
39485         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39486         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39487         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
39488 }
39489
39490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39491         LDKChannelCounterparty this_ptr_conv;
39492         this_ptr_conv.inner = untag_ptr(this_ptr);
39493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39495         this_ptr_conv.is_owned = false;
39496         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39497         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
39498         int64_t ret_ref = tag_ptr(ret_copy, true);
39499         return ret_ref;
39500 }
39501
39502 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) {
39503         LDKChannelCounterparty this_ptr_conv;
39504         this_ptr_conv.inner = untag_ptr(this_ptr);
39505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39507         this_ptr_conv.is_owned = false;
39508         void* val_ptr = untag_ptr(val);
39509         CHECK_ACCESS(val_ptr);
39510         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39511         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39512         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
39513 }
39514
39515 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) {
39516         LDKPublicKey node_id_arg_ref;
39517         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
39518         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
39519         LDKInitFeatures features_arg_conv;
39520         features_arg_conv.inner = untag_ptr(features_arg);
39521         features_arg_conv.is_owned = ptr_is_owned(features_arg);
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
39523         features_arg_conv = InitFeatures_clone(&features_arg_conv);
39524         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
39525         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
39526         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
39527         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
39528         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
39529         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
39530         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
39531         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
39532         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
39533         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
39534         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
39535         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
39536         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
39537         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);
39538         int64_t ret_ref = 0;
39539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39541         return ret_ref;
39542 }
39543
39544 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
39545         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
39546         int64_t ret_ref = 0;
39547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39549         return ret_ref;
39550 }
39551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39552         LDKChannelCounterparty arg_conv;
39553         arg_conv.inner = untag_ptr(arg);
39554         arg_conv.is_owned = ptr_is_owned(arg);
39555         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39556         arg_conv.is_owned = false;
39557         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
39558         return ret_conv;
39559 }
39560
39561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39562         LDKChannelCounterparty orig_conv;
39563         orig_conv.inner = untag_ptr(orig);
39564         orig_conv.is_owned = ptr_is_owned(orig);
39565         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39566         orig_conv.is_owned = false;
39567         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
39568         int64_t ret_ref = 0;
39569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39571         return ret_ref;
39572 }
39573
39574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39575         LDKChannelDetails this_obj_conv;
39576         this_obj_conv.inner = untag_ptr(this_obj);
39577         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39579         ChannelDetails_free(this_obj_conv);
39580 }
39581
39582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39583         LDKChannelDetails this_ptr_conv;
39584         this_ptr_conv.inner = untag_ptr(this_ptr);
39585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39587         this_ptr_conv.is_owned = false;
39588         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39589         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
39590         return ret_arr;
39591 }
39592
39593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39594         LDKChannelDetails this_ptr_conv;
39595         this_ptr_conv.inner = untag_ptr(this_ptr);
39596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39598         this_ptr_conv.is_owned = false;
39599         LDKThirtyTwoBytes val_ref;
39600         CHECK((*env)->GetArrayLength(env, val) == 32);
39601         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39602         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
39603 }
39604
39605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
39606         LDKChannelDetails this_ptr_conv;
39607         this_ptr_conv.inner = untag_ptr(this_ptr);
39608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39610         this_ptr_conv.is_owned = false;
39611         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
39612         int64_t ret_ref = 0;
39613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39615         return ret_ref;
39616 }
39617
39618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39619         LDKChannelDetails this_ptr_conv;
39620         this_ptr_conv.inner = untag_ptr(this_ptr);
39621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39623         this_ptr_conv.is_owned = false;
39624         LDKChannelCounterparty val_conv;
39625         val_conv.inner = untag_ptr(val);
39626         val_conv.is_owned = ptr_is_owned(val);
39627         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39628         val_conv = ChannelCounterparty_clone(&val_conv);
39629         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
39630 }
39631
39632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
39633         LDKChannelDetails this_ptr_conv;
39634         this_ptr_conv.inner = untag_ptr(this_ptr);
39635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39637         this_ptr_conv.is_owned = false;
39638         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
39639         int64_t ret_ref = 0;
39640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39642         return ret_ref;
39643 }
39644
39645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39646         LDKChannelDetails this_ptr_conv;
39647         this_ptr_conv.inner = untag_ptr(this_ptr);
39648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39650         this_ptr_conv.is_owned = false;
39651         LDKOutPoint val_conv;
39652         val_conv.inner = untag_ptr(val);
39653         val_conv.is_owned = ptr_is_owned(val);
39654         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39655         val_conv = OutPoint_clone(&val_conv);
39656         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
39657 }
39658
39659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
39660         LDKChannelDetails this_ptr_conv;
39661         this_ptr_conv.inner = untag_ptr(this_ptr);
39662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39664         this_ptr_conv.is_owned = false;
39665         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
39666         int64_t ret_ref = 0;
39667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39669         return ret_ref;
39670 }
39671
39672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39673         LDKChannelDetails this_ptr_conv;
39674         this_ptr_conv.inner = untag_ptr(this_ptr);
39675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39677         this_ptr_conv.is_owned = false;
39678         LDKChannelTypeFeatures val_conv;
39679         val_conv.inner = untag_ptr(val);
39680         val_conv.is_owned = ptr_is_owned(val);
39681         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39682         val_conv = ChannelTypeFeatures_clone(&val_conv);
39683         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
39684 }
39685
39686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39687         LDKChannelDetails this_ptr_conv;
39688         this_ptr_conv.inner = untag_ptr(this_ptr);
39689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39691         this_ptr_conv.is_owned = false;
39692         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39693         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
39694         int64_t ret_ref = tag_ptr(ret_copy, true);
39695         return ret_ref;
39696 }
39697
39698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39699         LDKChannelDetails this_ptr_conv;
39700         this_ptr_conv.inner = untag_ptr(this_ptr);
39701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39703         this_ptr_conv.is_owned = false;
39704         void* val_ptr = untag_ptr(val);
39705         CHECK_ACCESS(val_ptr);
39706         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39707         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39708         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
39709 }
39710
39711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
39712         LDKChannelDetails this_ptr_conv;
39713         this_ptr_conv.inner = untag_ptr(this_ptr);
39714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39716         this_ptr_conv.is_owned = false;
39717         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39718         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
39719         int64_t ret_ref = tag_ptr(ret_copy, true);
39720         return ret_ref;
39721 }
39722
39723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39724         LDKChannelDetails this_ptr_conv;
39725         this_ptr_conv.inner = untag_ptr(this_ptr);
39726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39728         this_ptr_conv.is_owned = false;
39729         void* val_ptr = untag_ptr(val);
39730         CHECK_ACCESS(val_ptr);
39731         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39732         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39733         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
39734 }
39735
39736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
39737         LDKChannelDetails this_ptr_conv;
39738         this_ptr_conv.inner = untag_ptr(this_ptr);
39739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39741         this_ptr_conv.is_owned = false;
39742         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39743         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
39744         int64_t ret_ref = tag_ptr(ret_copy, true);
39745         return ret_ref;
39746 }
39747
39748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39749         LDKChannelDetails this_ptr_conv;
39750         this_ptr_conv.inner = untag_ptr(this_ptr);
39751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39753         this_ptr_conv.is_owned = false;
39754         void* val_ptr = untag_ptr(val);
39755         CHECK_ACCESS(val_ptr);
39756         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39757         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39758         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
39759 }
39760
39761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
39762         LDKChannelDetails this_ptr_conv;
39763         this_ptr_conv.inner = untag_ptr(this_ptr);
39764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39766         this_ptr_conv.is_owned = false;
39767         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
39768         return ret_conv;
39769 }
39770
39771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39772         LDKChannelDetails this_ptr_conv;
39773         this_ptr_conv.inner = untag_ptr(this_ptr);
39774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39776         this_ptr_conv.is_owned = false;
39777         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
39778 }
39779
39780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
39781         LDKChannelDetails this_ptr_conv;
39782         this_ptr_conv.inner = untag_ptr(this_ptr);
39783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39785         this_ptr_conv.is_owned = false;
39786         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39787         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
39788         int64_t ret_ref = tag_ptr(ret_copy, true);
39789         return ret_ref;
39790 }
39791
39792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39793         LDKChannelDetails this_ptr_conv;
39794         this_ptr_conv.inner = untag_ptr(this_ptr);
39795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39797         this_ptr_conv.is_owned = false;
39798         void* val_ptr = untag_ptr(val);
39799         CHECK_ACCESS(val_ptr);
39800         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39801         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39802         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
39803 }
39804
39805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39806         LDKChannelDetails this_ptr_conv;
39807         this_ptr_conv.inner = untag_ptr(this_ptr);
39808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39810         this_ptr_conv.is_owned = false;
39811         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
39812         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
39813         return ret_arr;
39814 }
39815
39816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39817         LDKChannelDetails this_ptr_conv;
39818         this_ptr_conv.inner = untag_ptr(this_ptr);
39819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39821         this_ptr_conv.is_owned = false;
39822         LDKU128 val_ref;
39823         CHECK((*env)->GetArrayLength(env, val) == 16);
39824         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
39825         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
39826 }
39827
39828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
39829         LDKChannelDetails this_ptr_conv;
39830         this_ptr_conv.inner = untag_ptr(this_ptr);
39831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39833         this_ptr_conv.is_owned = false;
39834         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39835         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
39836         int64_t ret_ref = tag_ptr(ret_copy, true);
39837         return ret_ref;
39838 }
39839
39840 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) {
39841         LDKChannelDetails this_ptr_conv;
39842         this_ptr_conv.inner = untag_ptr(this_ptr);
39843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39845         this_ptr_conv.is_owned = false;
39846         void* val_ptr = untag_ptr(val);
39847         CHECK_ACCESS(val_ptr);
39848         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39849         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39850         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
39851 }
39852
39853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39854         LDKChannelDetails this_ptr_conv;
39855         this_ptr_conv.inner = untag_ptr(this_ptr);
39856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39858         this_ptr_conv.is_owned = false;
39859         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
39860         return ret_conv;
39861 }
39862
39863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39864         LDKChannelDetails this_ptr_conv;
39865         this_ptr_conv.inner = untag_ptr(this_ptr);
39866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39868         this_ptr_conv.is_owned = false;
39869         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
39870 }
39871
39872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39873         LDKChannelDetails this_ptr_conv;
39874         this_ptr_conv.inner = untag_ptr(this_ptr);
39875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39877         this_ptr_conv.is_owned = false;
39878         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
39879         return ret_conv;
39880 }
39881
39882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39883         LDKChannelDetails this_ptr_conv;
39884         this_ptr_conv.inner = untag_ptr(this_ptr);
39885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39887         this_ptr_conv.is_owned = false;
39888         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
39889 }
39890
39891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39892         LDKChannelDetails this_ptr_conv;
39893         this_ptr_conv.inner = untag_ptr(this_ptr);
39894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39896         this_ptr_conv.is_owned = false;
39897         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
39898         return ret_conv;
39899 }
39900
39901 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) {
39902         LDKChannelDetails this_ptr_conv;
39903         this_ptr_conv.inner = untag_ptr(this_ptr);
39904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39906         this_ptr_conv.is_owned = false;
39907         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
39908 }
39909
39910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39911         LDKChannelDetails this_ptr_conv;
39912         this_ptr_conv.inner = untag_ptr(this_ptr);
39913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39915         this_ptr_conv.is_owned = false;
39916         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
39917         return ret_conv;
39918 }
39919
39920 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) {
39921         LDKChannelDetails this_ptr_conv;
39922         this_ptr_conv.inner = untag_ptr(this_ptr);
39923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39925         this_ptr_conv.is_owned = false;
39926         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
39927 }
39928
39929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39930         LDKChannelDetails this_ptr_conv;
39931         this_ptr_conv.inner = untag_ptr(this_ptr);
39932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39934         this_ptr_conv.is_owned = false;
39935         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
39936         return ret_conv;
39937 }
39938
39939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39940         LDKChannelDetails this_ptr_conv;
39941         this_ptr_conv.inner = untag_ptr(this_ptr);
39942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39944         this_ptr_conv.is_owned = false;
39945         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
39946 }
39947
39948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
39949         LDKChannelDetails this_ptr_conv;
39950         this_ptr_conv.inner = untag_ptr(this_ptr);
39951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39953         this_ptr_conv.is_owned = false;
39954         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39955         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
39956         int64_t ret_ref = tag_ptr(ret_copy, true);
39957         return ret_ref;
39958 }
39959
39960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39961         LDKChannelDetails this_ptr_conv;
39962         this_ptr_conv.inner = untag_ptr(this_ptr);
39963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39965         this_ptr_conv.is_owned = false;
39966         void* val_ptr = untag_ptr(val);
39967         CHECK_ACCESS(val_ptr);
39968         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39969         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39970         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
39971 }
39972
39973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
39974         LDKChannelDetails this_ptr_conv;
39975         this_ptr_conv.inner = untag_ptr(this_ptr);
39976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39978         this_ptr_conv.is_owned = false;
39979         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39980         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
39981         int64_t ret_ref = tag_ptr(ret_copy, true);
39982         return ret_ref;
39983 }
39984
39985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39986         LDKChannelDetails this_ptr_conv;
39987         this_ptr_conv.inner = untag_ptr(this_ptr);
39988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39990         this_ptr_conv.is_owned = false;
39991         void* val_ptr = untag_ptr(val);
39992         CHECK_ACCESS(val_ptr);
39993         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39994         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39995         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
39996 }
39997
39998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
39999         LDKChannelDetails this_ptr_conv;
40000         this_ptr_conv.inner = untag_ptr(this_ptr);
40001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40003         this_ptr_conv.is_owned = false;
40004         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
40005         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
40006         int64_t ret_ref = tag_ptr(ret_copy, true);
40007         return ret_ref;
40008 }
40009
40010 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) {
40011         LDKChannelDetails this_ptr_conv;
40012         this_ptr_conv.inner = untag_ptr(this_ptr);
40013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40015         this_ptr_conv.is_owned = false;
40016         void* val_ptr = untag_ptr(val);
40017         CHECK_ACCESS(val_ptr);
40018         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
40019         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
40020         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
40021 }
40022
40023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
40024         LDKChannelDetails this_ptr_conv;
40025         this_ptr_conv.inner = untag_ptr(this_ptr);
40026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40028         this_ptr_conv.is_owned = false;
40029         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
40030         return ret_conv;
40031 }
40032
40033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40034         LDKChannelDetails this_ptr_conv;
40035         this_ptr_conv.inner = untag_ptr(this_ptr);
40036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40038         this_ptr_conv.is_owned = false;
40039         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
40040 }
40041
40042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
40043         LDKChannelDetails this_ptr_conv;
40044         this_ptr_conv.inner = untag_ptr(this_ptr);
40045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40047         this_ptr_conv.is_owned = false;
40048         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
40049         return ret_conv;
40050 }
40051
40052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40053         LDKChannelDetails this_ptr_conv;
40054         this_ptr_conv.inner = untag_ptr(this_ptr);
40055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40057         this_ptr_conv.is_owned = false;
40058         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
40059 }
40060
40061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
40062         LDKChannelDetails this_ptr_conv;
40063         this_ptr_conv.inner = untag_ptr(this_ptr);
40064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40066         this_ptr_conv.is_owned = false;
40067         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
40068         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
40069         int64_t ret_ref = tag_ptr(ret_copy, true);
40070         return ret_ref;
40071 }
40072
40073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40074         LDKChannelDetails this_ptr_conv;
40075         this_ptr_conv.inner = untag_ptr(this_ptr);
40076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40078         this_ptr_conv.is_owned = false;
40079         void* val_ptr = untag_ptr(val);
40080         CHECK_ACCESS(val_ptr);
40081         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
40082         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
40083         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
40084 }
40085
40086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
40087         LDKChannelDetails this_ptr_conv;
40088         this_ptr_conv.inner = untag_ptr(this_ptr);
40089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40091         this_ptr_conv.is_owned = false;
40092         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
40093         return ret_conv;
40094 }
40095
40096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40097         LDKChannelDetails this_ptr_conv;
40098         this_ptr_conv.inner = untag_ptr(this_ptr);
40099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40101         this_ptr_conv.is_owned = false;
40102         ChannelDetails_set_is_usable(&this_ptr_conv, val);
40103 }
40104
40105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
40106         LDKChannelDetails this_ptr_conv;
40107         this_ptr_conv.inner = untag_ptr(this_ptr);
40108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40110         this_ptr_conv.is_owned = false;
40111         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
40112         return ret_conv;
40113 }
40114
40115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40116         LDKChannelDetails this_ptr_conv;
40117         this_ptr_conv.inner = untag_ptr(this_ptr);
40118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40120         this_ptr_conv.is_owned = false;
40121         ChannelDetails_set_is_public(&this_ptr_conv, val);
40122 }
40123
40124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40125         LDKChannelDetails this_ptr_conv;
40126         this_ptr_conv.inner = untag_ptr(this_ptr);
40127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40129         this_ptr_conv.is_owned = false;
40130         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40131         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
40132         int64_t ret_ref = tag_ptr(ret_copy, true);
40133         return ret_ref;
40134 }
40135
40136 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) {
40137         LDKChannelDetails this_ptr_conv;
40138         this_ptr_conv.inner = untag_ptr(this_ptr);
40139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40141         this_ptr_conv.is_owned = false;
40142         void* val_ptr = untag_ptr(val);
40143         CHECK_ACCESS(val_ptr);
40144         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40145         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40146         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
40147 }
40148
40149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40150         LDKChannelDetails this_ptr_conv;
40151         this_ptr_conv.inner = untag_ptr(this_ptr);
40152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40154         this_ptr_conv.is_owned = false;
40155         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40156         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
40157         int64_t ret_ref = tag_ptr(ret_copy, true);
40158         return ret_ref;
40159 }
40160
40161 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) {
40162         LDKChannelDetails this_ptr_conv;
40163         this_ptr_conv.inner = untag_ptr(this_ptr);
40164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40166         this_ptr_conv.is_owned = false;
40167         void* val_ptr = untag_ptr(val);
40168         CHECK_ACCESS(val_ptr);
40169         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40170         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40171         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
40172 }
40173
40174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
40175         LDKChannelDetails this_ptr_conv;
40176         this_ptr_conv.inner = untag_ptr(this_ptr);
40177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40179         this_ptr_conv.is_owned = false;
40180         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
40181         int64_t ret_ref = 0;
40182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40184         return ret_ref;
40185 }
40186
40187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40188         LDKChannelDetails this_ptr_conv;
40189         this_ptr_conv.inner = untag_ptr(this_ptr);
40190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40192         this_ptr_conv.is_owned = false;
40193         LDKChannelConfig val_conv;
40194         val_conv.inner = untag_ptr(val);
40195         val_conv.is_owned = ptr_is_owned(val);
40196         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40197         val_conv = ChannelConfig_clone(&val_conv);
40198         ChannelDetails_set_config(&this_ptr_conv, val_conv);
40199 }
40200
40201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t outbound_scid_alias_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t feerate_sat_per_1000_weight_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t next_outbound_htlc_minimum_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t confirmations_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, int64_t channel_shutdown_state_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
40202         LDKThirtyTwoBytes channel_id_arg_ref;
40203         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
40204         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
40205         LDKChannelCounterparty counterparty_arg_conv;
40206         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
40207         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
40208         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
40209         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
40210         LDKOutPoint funding_txo_arg_conv;
40211         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
40212         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
40213         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
40214         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
40215         LDKChannelTypeFeatures channel_type_arg_conv;
40216         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
40217         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
40218         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
40219         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
40220         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
40221         CHECK_ACCESS(short_channel_id_arg_ptr);
40222         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
40223         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
40224         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
40225         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
40226         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
40227         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
40228         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
40229         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
40230         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
40231         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
40232         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
40233         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
40234         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
40235         LDKU128 user_channel_id_arg_ref;
40236         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
40237         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
40238         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
40239         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
40240         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
40241         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
40242         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
40243         CHECK_ACCESS(confirmations_required_arg_ptr);
40244         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
40245         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
40246         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
40247         CHECK_ACCESS(confirmations_arg_ptr);
40248         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
40249         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
40250         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
40251         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
40252         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
40253         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
40254         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
40255         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
40256         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
40257         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
40258         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
40259         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
40260         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
40261         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
40262         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
40263         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
40264         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
40265         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
40266         LDKChannelConfig config_arg_conv;
40267         config_arg_conv.inner = untag_ptr(config_arg);
40268         config_arg_conv.is_owned = ptr_is_owned(config_arg);
40269         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
40270         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
40271         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, feerate_sat_per_1000_weight_arg_conv, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg_conv, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
40272         int64_t ret_ref = 0;
40273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40275         return ret_ref;
40276 }
40277
40278 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
40279         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
40280         int64_t ret_ref = 0;
40281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40283         return ret_ref;
40284 }
40285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40286         LDKChannelDetails arg_conv;
40287         arg_conv.inner = untag_ptr(arg);
40288         arg_conv.is_owned = ptr_is_owned(arg);
40289         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40290         arg_conv.is_owned = false;
40291         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
40292         return ret_conv;
40293 }
40294
40295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40296         LDKChannelDetails orig_conv;
40297         orig_conv.inner = untag_ptr(orig);
40298         orig_conv.is_owned = ptr_is_owned(orig);
40299         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40300         orig_conv.is_owned = false;
40301         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
40302         int64_t ret_ref = 0;
40303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40305         return ret_ref;
40306 }
40307
40308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
40309         LDKChannelDetails this_arg_conv;
40310         this_arg_conv.inner = untag_ptr(this_arg);
40311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40313         this_arg_conv.is_owned = false;
40314         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40315         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
40316         int64_t ret_ref = tag_ptr(ret_copy, true);
40317         return ret_ref;
40318 }
40319
40320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
40321         LDKChannelDetails this_arg_conv;
40322         this_arg_conv.inner = untag_ptr(this_arg);
40323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40325         this_arg_conv.is_owned = false;
40326         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40327         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
40328         int64_t ret_ref = tag_ptr(ret_copy, true);
40329         return ret_ref;
40330 }
40331
40332 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40333         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
40334         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
40335         return ret_conv;
40336 }
40337
40338 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
40339         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
40340         return ret_conv;
40341 }
40342
40343 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
40344         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
40345         return ret_conv;
40346 }
40347
40348 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
40349         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
40350         return ret_conv;
40351 }
40352
40353 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
40354         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
40355         return ret_conv;
40356 }
40357
40358 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
40359         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
40360         return ret_conv;
40361 }
40362
40363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40364         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
40365         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
40366         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
40367         return ret_conv;
40368 }
40369
40370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40371         if (!ptr_is_owned(this_ptr)) return;
40372         void* this_ptr_ptr = untag_ptr(this_ptr);
40373         CHECK_ACCESS(this_ptr_ptr);
40374         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
40375         FREE(untag_ptr(this_ptr));
40376         RecentPaymentDetails_free(this_ptr_conv);
40377 }
40378
40379 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
40380         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40381         *ret_copy = RecentPaymentDetails_clone(arg);
40382         int64_t ret_ref = tag_ptr(ret_copy, true);
40383         return ret_ref;
40384 }
40385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40386         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
40387         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
40388         return ret_conv;
40389 }
40390
40391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40392         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
40393         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40394         *ret_copy = RecentPaymentDetails_clone(orig_conv);
40395         int64_t ret_ref = tag_ptr(ret_copy, true);
40396         return ret_ref;
40397 }
40398
40399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
40400         LDKThirtyTwoBytes payment_id_ref;
40401         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40402         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40403         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40404         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
40405         int64_t ret_ref = tag_ptr(ret_copy, true);
40406         return ret_ref;
40407 }
40408
40409 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) {
40410         LDKThirtyTwoBytes payment_id_ref;
40411         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40412         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40413         LDKThirtyTwoBytes payment_hash_ref;
40414         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40415         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40416         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40417         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
40418         int64_t ret_ref = tag_ptr(ret_copy, true);
40419         return ret_ref;
40420 }
40421
40422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
40423         LDKThirtyTwoBytes payment_id_ref;
40424         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40425         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40426         void* payment_hash_ptr = untag_ptr(payment_hash);
40427         CHECK_ACCESS(payment_hash_ptr);
40428         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
40429         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
40430         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40431         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
40432         int64_t ret_ref = tag_ptr(ret_copy, true);
40433         return ret_ref;
40434 }
40435
40436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
40437         LDKThirtyTwoBytes payment_id_ref;
40438         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40439         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40440         LDKThirtyTwoBytes payment_hash_ref;
40441         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40442         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40443         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40444         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
40445         int64_t ret_ref = tag_ptr(ret_copy, true);
40446         return ret_ref;
40447 }
40448
40449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40450         LDKPhantomRouteHints this_obj_conv;
40451         this_obj_conv.inner = untag_ptr(this_obj);
40452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40454         PhantomRouteHints_free(this_obj_conv);
40455 }
40456
40457 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
40458         LDKPhantomRouteHints this_ptr_conv;
40459         this_ptr_conv.inner = untag_ptr(this_ptr);
40460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40462         this_ptr_conv.is_owned = false;
40463         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
40464         int64_tArray ret_arr = NULL;
40465         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40466         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40467         for (size_t q = 0; q < ret_var.datalen; q++) {
40468                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40469                 int64_t ret_conv_16_ref = 0;
40470                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40471                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40472                 ret_arr_ptr[q] = ret_conv_16_ref;
40473         }
40474         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40475         FREE(ret_var.data);
40476         return ret_arr;
40477 }
40478
40479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40480         LDKPhantomRouteHints this_ptr_conv;
40481         this_ptr_conv.inner = untag_ptr(this_ptr);
40482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40484         this_ptr_conv.is_owned = false;
40485         LDKCVec_ChannelDetailsZ val_constr;
40486         val_constr.datalen = (*env)->GetArrayLength(env, val);
40487         if (val_constr.datalen > 0)
40488                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
40489         else
40490                 val_constr.data = NULL;
40491         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40492         for (size_t q = 0; q < val_constr.datalen; q++) {
40493                 int64_t val_conv_16 = val_vals[q];
40494                 LDKChannelDetails val_conv_16_conv;
40495                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
40496                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
40497                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
40498                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
40499                 val_constr.data[q] = val_conv_16_conv;
40500         }
40501         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40502         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
40503 }
40504
40505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
40506         LDKPhantomRouteHints this_ptr_conv;
40507         this_ptr_conv.inner = untag_ptr(this_ptr);
40508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40510         this_ptr_conv.is_owned = false;
40511         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
40512         return ret_conv;
40513 }
40514
40515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40516         LDKPhantomRouteHints this_ptr_conv;
40517         this_ptr_conv.inner = untag_ptr(this_ptr);
40518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40520         this_ptr_conv.is_owned = false;
40521         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
40522 }
40523
40524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40525         LDKPhantomRouteHints this_ptr_conv;
40526         this_ptr_conv.inner = untag_ptr(this_ptr);
40527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40529         this_ptr_conv.is_owned = false;
40530         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40531         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
40532         return ret_arr;
40533 }
40534
40535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40536         LDKPhantomRouteHints this_ptr_conv;
40537         this_ptr_conv.inner = untag_ptr(this_ptr);
40538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40540         this_ptr_conv.is_owned = false;
40541         LDKPublicKey val_ref;
40542         CHECK((*env)->GetArrayLength(env, val) == 33);
40543         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40544         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
40545 }
40546
40547 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) {
40548         LDKCVec_ChannelDetailsZ channels_arg_constr;
40549         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
40550         if (channels_arg_constr.datalen > 0)
40551                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
40552         else
40553                 channels_arg_constr.data = NULL;
40554         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
40555         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
40556                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
40557                 LDKChannelDetails channels_arg_conv_16_conv;
40558                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
40559                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
40560                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
40561                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
40562                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
40563         }
40564         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
40565         LDKPublicKey real_node_pubkey_arg_ref;
40566         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
40567         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
40568         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
40569         int64_t ret_ref = 0;
40570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40572         return ret_ref;
40573 }
40574
40575 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
40576         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
40577         int64_t ret_ref = 0;
40578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40580         return ret_ref;
40581 }
40582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40583         LDKPhantomRouteHints arg_conv;
40584         arg_conv.inner = untag_ptr(arg);
40585         arg_conv.is_owned = ptr_is_owned(arg);
40586         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40587         arg_conv.is_owned = false;
40588         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
40589         return ret_conv;
40590 }
40591
40592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40593         LDKPhantomRouteHints orig_conv;
40594         orig_conv.inner = untag_ptr(orig);
40595         orig_conv.is_owned = ptr_is_owned(orig);
40596         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40597         orig_conv.is_owned = false;
40598         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
40599         int64_t ret_ref = 0;
40600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40602         return ret_ref;
40603 }
40604
40605 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) {
40606         void* fee_est_ptr = untag_ptr(fee_est);
40607         CHECK_ACCESS(fee_est_ptr);
40608         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
40609         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
40610                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40611                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
40612         }
40613         void* chain_monitor_ptr = untag_ptr(chain_monitor);
40614         CHECK_ACCESS(chain_monitor_ptr);
40615         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
40616         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
40617                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40618                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
40619         }
40620         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
40621         CHECK_ACCESS(tx_broadcaster_ptr);
40622         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
40623         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40624                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40625                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
40626         }
40627         void* router_ptr = untag_ptr(router);
40628         CHECK_ACCESS(router_ptr);
40629         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
40630         if (router_conv.free == LDKRouter_JCalls_free) {
40631                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40632                 LDKRouter_JCalls_cloned(&router_conv);
40633         }
40634         void* logger_ptr = untag_ptr(logger);
40635         CHECK_ACCESS(logger_ptr);
40636         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40637         if (logger_conv.free == LDKLogger_JCalls_free) {
40638                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40639                 LDKLogger_JCalls_cloned(&logger_conv);
40640         }
40641         void* entropy_source_ptr = untag_ptr(entropy_source);
40642         CHECK_ACCESS(entropy_source_ptr);
40643         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
40644         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
40645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40646                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
40647         }
40648         void* node_signer_ptr = untag_ptr(node_signer);
40649         CHECK_ACCESS(node_signer_ptr);
40650         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
40651         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
40652                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40653                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
40654         }
40655         void* signer_provider_ptr = untag_ptr(signer_provider);
40656         CHECK_ACCESS(signer_provider_ptr);
40657         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
40658         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
40659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40660                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
40661         }
40662         LDKUserConfig config_conv;
40663         config_conv.inner = untag_ptr(config);
40664         config_conv.is_owned = ptr_is_owned(config);
40665         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
40666         config_conv = UserConfig_clone(&config_conv);
40667         LDKChainParameters params_conv;
40668         params_conv.inner = untag_ptr(params);
40669         params_conv.is_owned = ptr_is_owned(params);
40670         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
40671         params_conv = ChainParameters_clone(&params_conv);
40672         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);
40673         int64_t ret_ref = 0;
40674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40676         return ret_ref;
40677 }
40678
40679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
40680         LDKChannelManager this_arg_conv;
40681         this_arg_conv.inner = untag_ptr(this_arg);
40682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40684         this_arg_conv.is_owned = false;
40685         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
40686         int64_t ret_ref = 0;
40687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40689         return ret_ref;
40690 }
40691
40692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int8_tArray user_channel_id, int64_t override_config) {
40693         LDKChannelManager this_arg_conv;
40694         this_arg_conv.inner = untag_ptr(this_arg);
40695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40697         this_arg_conv.is_owned = false;
40698         LDKPublicKey their_network_key_ref;
40699         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
40700         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
40701         LDKU128 user_channel_id_ref;
40702         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
40703         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
40704         LDKUserConfig override_config_conv;
40705         override_config_conv.inner = untag_ptr(override_config);
40706         override_config_conv.is_owned = ptr_is_owned(override_config);
40707         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
40708         override_config_conv = UserConfig_clone(&override_config_conv);
40709         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
40710         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
40711         return tag_ptr(ret_conv, true);
40712 }
40713
40714 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40715         LDKChannelManager this_arg_conv;
40716         this_arg_conv.inner = untag_ptr(this_arg);
40717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40719         this_arg_conv.is_owned = false;
40720         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
40721         int64_tArray ret_arr = NULL;
40722         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40723         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40724         for (size_t q = 0; q < ret_var.datalen; q++) {
40725                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40726                 int64_t ret_conv_16_ref = 0;
40727                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40728                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40729                 ret_arr_ptr[q] = ret_conv_16_ref;
40730         }
40731         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40732         FREE(ret_var.data);
40733         return ret_arr;
40734 }
40735
40736 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40737         LDKChannelManager this_arg_conv;
40738         this_arg_conv.inner = untag_ptr(this_arg);
40739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40741         this_arg_conv.is_owned = false;
40742         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
40743         int64_tArray ret_arr = NULL;
40744         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40745         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40746         for (size_t q = 0; q < ret_var.datalen; q++) {
40747                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40748                 int64_t ret_conv_16_ref = 0;
40749                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40750                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40751                 ret_arr_ptr[q] = ret_conv_16_ref;
40752         }
40753         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40754         FREE(ret_var.data);
40755         return ret_arr;
40756 }
40757
40758 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) {
40759         LDKChannelManager this_arg_conv;
40760         this_arg_conv.inner = untag_ptr(this_arg);
40761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40763         this_arg_conv.is_owned = false;
40764         LDKPublicKey counterparty_node_id_ref;
40765         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40766         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40767         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
40768         int64_tArray ret_arr = NULL;
40769         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40770         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40771         for (size_t q = 0; q < ret_var.datalen; q++) {
40772                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
40773                 int64_t ret_conv_16_ref = 0;
40774                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
40775                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
40776                 ret_arr_ptr[q] = ret_conv_16_ref;
40777         }
40778         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40779         FREE(ret_var.data);
40780         return ret_arr;
40781 }
40782
40783 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
40784         LDKChannelManager this_arg_conv;
40785         this_arg_conv.inner = untag_ptr(this_arg);
40786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40788         this_arg_conv.is_owned = false;
40789         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
40790         int64_tArray ret_arr = NULL;
40791         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40792         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40793         for (size_t w = 0; w < ret_var.datalen; w++) {
40794                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
40795                 *ret_conv_22_copy = ret_var.data[w];
40796                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
40797                 ret_arr_ptr[w] = ret_conv_22_ref;
40798         }
40799         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40800         FREE(ret_var.data);
40801         return ret_arr;
40802 }
40803
40804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
40805         LDKChannelManager this_arg_conv;
40806         this_arg_conv.inner = untag_ptr(this_arg);
40807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40809         this_arg_conv.is_owned = false;
40810         uint8_t channel_id_arr[32];
40811         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40812         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40813         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40814         LDKPublicKey counterparty_node_id_ref;
40815         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40816         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40817         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40818         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40819         return tag_ptr(ret_conv, true);
40820 }
40821
40822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1feerate_1and_1script(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
40823         LDKChannelManager this_arg_conv;
40824         this_arg_conv.inner = untag_ptr(this_arg);
40825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40827         this_arg_conv.is_owned = false;
40828         uint8_t channel_id_arr[32];
40829         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40830         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40831         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40832         LDKPublicKey counterparty_node_id_ref;
40833         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40834         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40835         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
40836         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
40837         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
40838         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
40839         LDKShutdownScript shutdown_script_conv;
40840         shutdown_script_conv.inner = untag_ptr(shutdown_script);
40841         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
40842         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
40843         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
40844         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40845         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
40846         return tag_ptr(ret_conv, true);
40847 }
40848
40849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
40850         LDKChannelManager this_arg_conv;
40851         this_arg_conv.inner = untag_ptr(this_arg);
40852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40854         this_arg_conv.is_owned = false;
40855         uint8_t channel_id_arr[32];
40856         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40857         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40858         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40859         LDKPublicKey counterparty_node_id_ref;
40860         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40861         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40862         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40863         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40864         return tag_ptr(ret_conv, true);
40865 }
40866
40867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
40868         LDKChannelManager this_arg_conv;
40869         this_arg_conv.inner = untag_ptr(this_arg);
40870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40872         this_arg_conv.is_owned = false;
40873         uint8_t channel_id_arr[32];
40874         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
40875         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
40876         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
40877         LDKPublicKey counterparty_node_id_ref;
40878         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
40879         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
40880         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40881         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
40882         return tag_ptr(ret_conv, true);
40883 }
40884
40885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
40886         LDKChannelManager this_arg_conv;
40887         this_arg_conv.inner = untag_ptr(this_arg);
40888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40890         this_arg_conv.is_owned = false;
40891         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
40892 }
40893
40894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
40895         LDKChannelManager this_arg_conv;
40896         this_arg_conv.inner = untag_ptr(this_arg);
40897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40899         this_arg_conv.is_owned = false;
40900         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
40901 }
40902
40903 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) {
40904         LDKChannelManager this_arg_conv;
40905         this_arg_conv.inner = untag_ptr(this_arg);
40906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40908         this_arg_conv.is_owned = false;
40909         LDKRoute route_conv;
40910         route_conv.inner = untag_ptr(route);
40911         route_conv.is_owned = ptr_is_owned(route);
40912         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
40913         route_conv.is_owned = false;
40914         LDKThirtyTwoBytes payment_hash_ref;
40915         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40916         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40917         LDKRecipientOnionFields recipient_onion_conv;
40918         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40919         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40920         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40921         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40922         LDKThirtyTwoBytes payment_id_ref;
40923         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40924         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40925         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
40926         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
40927         return tag_ptr(ret_conv, true);
40928 }
40929
40930 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) {
40931         LDKChannelManager this_arg_conv;
40932         this_arg_conv.inner = untag_ptr(this_arg);
40933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40935         this_arg_conv.is_owned = false;
40936         LDKThirtyTwoBytes payment_hash_ref;
40937         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40938         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40939         LDKRecipientOnionFields recipient_onion_conv;
40940         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40941         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40942         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40943         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40944         LDKThirtyTwoBytes payment_id_ref;
40945         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40946         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40947         LDKRouteParameters route_params_conv;
40948         route_params_conv.inner = untag_ptr(route_params);
40949         route_params_conv.is_owned = ptr_is_owned(route_params);
40950         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
40951         route_params_conv = RouteParameters_clone(&route_params_conv);
40952         void* retry_strategy_ptr = untag_ptr(retry_strategy);
40953         CHECK_ACCESS(retry_strategy_ptr);
40954         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
40955         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
40956         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
40957         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
40958         return tag_ptr(ret_conv, true);
40959 }
40960
40961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
40962         LDKChannelManager this_arg_conv;
40963         this_arg_conv.inner = untag_ptr(this_arg);
40964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40966         this_arg_conv.is_owned = false;
40967         LDKThirtyTwoBytes payment_id_ref;
40968         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40969         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40970         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
40971 }
40972
40973 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) {
40974         LDKChannelManager this_arg_conv;
40975         this_arg_conv.inner = untag_ptr(this_arg);
40976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40978         this_arg_conv.is_owned = false;
40979         LDKRoute route_conv;
40980         route_conv.inner = untag_ptr(route);
40981         route_conv.is_owned = ptr_is_owned(route);
40982         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
40983         route_conv.is_owned = false;
40984         void* payment_preimage_ptr = untag_ptr(payment_preimage);
40985         CHECK_ACCESS(payment_preimage_ptr);
40986         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
40987         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
40988         LDKRecipientOnionFields recipient_onion_conv;
40989         recipient_onion_conv.inner = untag_ptr(recipient_onion);
40990         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
40991         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
40992         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
40993         LDKThirtyTwoBytes payment_id_ref;
40994         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
40995         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
40996         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
40997         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
40998         return tag_ptr(ret_conv, true);
40999 }
41000
41001 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) {
41002         LDKChannelManager this_arg_conv;
41003         this_arg_conv.inner = untag_ptr(this_arg);
41004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41006         this_arg_conv.is_owned = false;
41007         void* payment_preimage_ptr = untag_ptr(payment_preimage);
41008         CHECK_ACCESS(payment_preimage_ptr);
41009         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
41010         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
41011         LDKRecipientOnionFields recipient_onion_conv;
41012         recipient_onion_conv.inner = untag_ptr(recipient_onion);
41013         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
41014         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
41015         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
41016         LDKThirtyTwoBytes payment_id_ref;
41017         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
41018         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
41019         LDKRouteParameters route_params_conv;
41020         route_params_conv.inner = untag_ptr(route_params);
41021         route_params_conv.is_owned = ptr_is_owned(route_params);
41022         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41023         route_params_conv = RouteParameters_clone(&route_params_conv);
41024         void* retry_strategy_ptr = untag_ptr(retry_strategy);
41025         CHECK_ACCESS(retry_strategy_ptr);
41026         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
41027         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
41028         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
41029         *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);
41030         return tag_ptr(ret_conv, true);
41031 }
41032
41033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
41034         LDKChannelManager this_arg_conv;
41035         this_arg_conv.inner = untag_ptr(this_arg);
41036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41038         this_arg_conv.is_owned = false;
41039         LDKPath path_conv;
41040         path_conv.inner = untag_ptr(path);
41041         path_conv.is_owned = ptr_is_owned(path);
41042         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
41043         path_conv = Path_clone(&path_conv);
41044         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
41045         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
41046         return tag_ptr(ret_conv, true);
41047 }
41048
41049 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) {
41050         LDKChannelManager this_arg_conv;
41051         this_arg_conv.inner = untag_ptr(this_arg);
41052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41054         this_arg_conv.is_owned = false;
41055         LDKPublicKey node_id_ref;
41056         CHECK((*env)->GetArrayLength(env, node_id) == 33);
41057         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
41058         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
41059         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
41060         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
41061         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
41062         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
41063         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
41064         return tag_ptr(ret_conv, true);
41065 }
41066
41067 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) {
41068         LDKChannelManager this_arg_conv;
41069         this_arg_conv.inner = untag_ptr(this_arg);
41070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41072         this_arg_conv.is_owned = false;
41073         LDKRouteParameters route_params_conv;
41074         route_params_conv.inner = untag_ptr(route_params);
41075         route_params_conv.is_owned = ptr_is_owned(route_params);
41076         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41077         route_params_conv = RouteParameters_clone(&route_params_conv);
41078         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
41079         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
41080         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
41081         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
41082         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
41083         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
41084         return tag_ptr(ret_conv, true);
41085 }
41086
41087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
41088         LDKChannelManager this_arg_conv;
41089         this_arg_conv.inner = untag_ptr(this_arg);
41090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41092         this_arg_conv.is_owned = false;
41093         uint8_t temporary_channel_id_arr[32];
41094         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
41095         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
41096         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
41097         LDKPublicKey counterparty_node_id_ref;
41098         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41099         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41100         LDKTransaction funding_transaction_ref;
41101         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
41102         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
41103         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
41104         funding_transaction_ref.data_is_owned = true;
41105         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41106         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
41107         return tag_ptr(ret_conv, true);
41108 }
41109
41110 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) {
41111         LDKChannelManager this_arg_conv;
41112         this_arg_conv.inner = untag_ptr(this_arg);
41113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41115         this_arg_conv.is_owned = false;
41116         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
41117         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
41118         if (temporary_channels_constr.datalen > 0)
41119                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
41120         else
41121                 temporary_channels_constr.data = NULL;
41122         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
41123         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
41124                 int64_t temporary_channels_conv_35 = temporary_channels_vals[j];
41125                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
41126                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
41127                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
41128                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
41129                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
41130         }
41131         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
41132         LDKTransaction funding_transaction_ref;
41133         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
41134         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
41135         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
41136         funding_transaction_ref.data_is_owned = true;
41137         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41138         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
41139         return tag_ptr(ret_conv, true);
41140 }
41141
41142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1partial_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config_update) {
41143         LDKChannelManager this_arg_conv;
41144         this_arg_conv.inner = untag_ptr(this_arg);
41145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41147         this_arg_conv.is_owned = false;
41148         LDKPublicKey counterparty_node_id_ref;
41149         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41150         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41151         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
41152         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
41153         if (channel_ids_constr.datalen > 0)
41154                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
41155         else
41156                 channel_ids_constr.data = NULL;
41157         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
41158                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
41159                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
41160                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
41161                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
41162                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
41163         }
41164         LDKChannelConfigUpdate config_update_conv;
41165         config_update_conv.inner = untag_ptr(config_update);
41166         config_update_conv.is_owned = ptr_is_owned(config_update);
41167         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
41168         config_update_conv.is_owned = false;
41169         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41170         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
41171         return tag_ptr(ret_conv, true);
41172 }
41173
41174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config) {
41175         LDKChannelManager this_arg_conv;
41176         this_arg_conv.inner = untag_ptr(this_arg);
41177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41179         this_arg_conv.is_owned = false;
41180         LDKPublicKey counterparty_node_id_ref;
41181         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41182         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41183         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
41184         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
41185         if (channel_ids_constr.datalen > 0)
41186                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
41187         else
41188                 channel_ids_constr.data = NULL;
41189         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
41190                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
41191                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
41192                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
41193                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
41194                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
41195         }
41196         LDKChannelConfig config_conv;
41197         config_conv.inner = untag_ptr(config);
41198         config_conv.is_owned = ptr_is_owned(config);
41199         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41200         config_conv.is_owned = false;
41201         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41202         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
41203         return tag_ptr(ret_conv, true);
41204 }
41205
41206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
41207         LDKChannelManager this_arg_conv;
41208         this_arg_conv.inner = untag_ptr(this_arg);
41209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41211         this_arg_conv.is_owned = false;
41212         LDKThirtyTwoBytes intercept_id_ref;
41213         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
41214         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
41215         uint8_t next_hop_channel_id_arr[32];
41216         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
41217         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
41218         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
41219         LDKPublicKey next_node_id_ref;
41220         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
41221         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
41222         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41223         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat);
41224         return tag_ptr(ret_conv, true);
41225 }
41226
41227 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) {
41228         LDKChannelManager this_arg_conv;
41229         this_arg_conv.inner = untag_ptr(this_arg);
41230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41232         this_arg_conv.is_owned = false;
41233         LDKThirtyTwoBytes intercept_id_ref;
41234         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
41235         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
41236         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41237         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
41238         return tag_ptr(ret_conv, true);
41239 }
41240
41241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
41242         LDKChannelManager this_arg_conv;
41243         this_arg_conv.inner = untag_ptr(this_arg);
41244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41246         this_arg_conv.is_owned = false;
41247         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
41248 }
41249
41250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
41251         LDKChannelManager this_arg_conv;
41252         this_arg_conv.inner = untag_ptr(this_arg);
41253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41255         this_arg_conv.is_owned = false;
41256         ChannelManager_timer_tick_occurred(&this_arg_conv);
41257 }
41258
41259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
41260         LDKChannelManager this_arg_conv;
41261         this_arg_conv.inner = untag_ptr(this_arg);
41262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41264         this_arg_conv.is_owned = false;
41265         uint8_t payment_hash_arr[32];
41266         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41267         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
41268         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
41269         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
41270 }
41271
41272 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) {
41273         LDKChannelManager this_arg_conv;
41274         this_arg_conv.inner = untag_ptr(this_arg);
41275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41277         this_arg_conv.is_owned = false;
41278         uint8_t payment_hash_arr[32];
41279         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41280         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
41281         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
41282         void* failure_code_ptr = untag_ptr(failure_code);
41283         CHECK_ACCESS(failure_code_ptr);
41284         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
41285         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
41286         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
41287 }
41288
41289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
41290         LDKChannelManager this_arg_conv;
41291         this_arg_conv.inner = untag_ptr(this_arg);
41292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41294         this_arg_conv.is_owned = false;
41295         LDKThirtyTwoBytes payment_preimage_ref;
41296         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
41297         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
41298         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
41299 }
41300
41301 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) {
41302         LDKChannelManager this_arg_conv;
41303         this_arg_conv.inner = untag_ptr(this_arg);
41304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41306         this_arg_conv.is_owned = false;
41307         LDKThirtyTwoBytes payment_preimage_ref;
41308         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
41309         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
41310         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
41311 }
41312
41313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
41314         LDKChannelManager this_arg_conv;
41315         this_arg_conv.inner = untag_ptr(this_arg);
41316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41318         this_arg_conv.is_owned = false;
41319         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41320         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
41321         return ret_arr;
41322 }
41323
41324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
41325         LDKChannelManager this_arg_conv;
41326         this_arg_conv.inner = untag_ptr(this_arg);
41327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41329         this_arg_conv.is_owned = false;
41330         uint8_t temporary_channel_id_arr[32];
41331         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
41332         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
41333         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
41334         LDKPublicKey counterparty_node_id_ref;
41335         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41336         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41337         LDKU128 user_channel_id_ref;
41338         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
41339         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
41340         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41341         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
41342         return tag_ptr(ret_conv, true);
41343 }
41344
41345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel_1from_1trusted_1peer_10conf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
41346         LDKChannelManager this_arg_conv;
41347         this_arg_conv.inner = untag_ptr(this_arg);
41348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41350         this_arg_conv.is_owned = false;
41351         uint8_t temporary_channel_id_arr[32];
41352         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
41353         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
41354         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
41355         LDKPublicKey counterparty_node_id_ref;
41356         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
41357         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
41358         LDKU128 user_channel_id_ref;
41359         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
41360         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
41361         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41362         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
41363         return tag_ptr(ret_conv, true);
41364 }
41365
41366 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) {
41367         LDKChannelManager this_arg_conv;
41368         this_arg_conv.inner = untag_ptr(this_arg);
41369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41371         this_arg_conv.is_owned = false;
41372         LDKOffer offer_conv;
41373         offer_conv.inner = untag_ptr(offer);
41374         offer_conv.is_owned = ptr_is_owned(offer);
41375         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
41376         offer_conv.is_owned = false;
41377         void* quantity_ptr = untag_ptr(quantity);
41378         CHECK_ACCESS(quantity_ptr);
41379         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
41380         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
41381         void* amount_msats_ptr = untag_ptr(amount_msats);
41382         CHECK_ACCESS(amount_msats_ptr);
41383         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
41384         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
41385         void* payer_note_ptr = untag_ptr(payer_note);
41386         CHECK_ACCESS(payer_note_ptr);
41387         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
41388         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
41389         LDKThirtyTwoBytes payment_id_ref;
41390         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
41391         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
41392         void* retry_strategy_ptr = untag_ptr(retry_strategy);
41393         CHECK_ACCESS(retry_strategy_ptr);
41394         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
41395         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
41396         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
41397         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
41398         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
41399         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
41400         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
41401         *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);
41402         return tag_ptr(ret_conv, true);
41403 }
41404
41405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t refund) {
41406         LDKChannelManager this_arg_conv;
41407         this_arg_conv.inner = untag_ptr(this_arg);
41408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41410         this_arg_conv.is_owned = false;
41411         LDKRefund refund_conv;
41412         refund_conv.inner = untag_ptr(refund);
41413         refund_conv.is_owned = ptr_is_owned(refund);
41414         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
41415         refund_conv.is_owned = false;
41416         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
41417         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
41418         return tag_ptr(ret_conv, true);
41419 }
41420
41421 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) {
41422         LDKChannelManager this_arg_conv;
41423         this_arg_conv.inner = untag_ptr(this_arg);
41424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41426         this_arg_conv.is_owned = false;
41427         void* min_value_msat_ptr = untag_ptr(min_value_msat);
41428         CHECK_ACCESS(min_value_msat_ptr);
41429         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
41430         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
41431         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
41432         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
41433         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
41434         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
41435         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
41436         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
41437         return tag_ptr(ret_conv, true);
41438 }
41439
41440 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) {
41441         LDKChannelManager this_arg_conv;
41442         this_arg_conv.inner = untag_ptr(this_arg);
41443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41445         this_arg_conv.is_owned = false;
41446         LDKThirtyTwoBytes payment_hash_ref;
41447         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41448         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
41449         void* min_value_msat_ptr = untag_ptr(min_value_msat);
41450         CHECK_ACCESS(min_value_msat_ptr);
41451         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
41452         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
41453         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
41454         CHECK_ACCESS(min_final_cltv_expiry_ptr);
41455         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
41456         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
41457         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
41458         *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);
41459         return tag_ptr(ret_conv, true);
41460 }
41461
41462 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) {
41463         LDKChannelManager this_arg_conv;
41464         this_arg_conv.inner = untag_ptr(this_arg);
41465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41467         this_arg_conv.is_owned = false;
41468         LDKThirtyTwoBytes payment_hash_ref;
41469         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
41470         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
41471         LDKThirtyTwoBytes payment_secret_ref;
41472         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
41473         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
41474         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
41475         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
41476         return tag_ptr(ret_conv, true);
41477 }
41478
41479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
41480         LDKChannelManager this_arg_conv;
41481         this_arg_conv.inner = untag_ptr(this_arg);
41482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41484         this_arg_conv.is_owned = false;
41485         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
41486         return ret_conv;
41487 }
41488
41489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
41490         LDKChannelManager this_arg_conv;
41491         this_arg_conv.inner = untag_ptr(this_arg);
41492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41494         this_arg_conv.is_owned = false;
41495         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
41496         int64_t ret_ref = 0;
41497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41499         return ret_ref;
41500 }
41501
41502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
41503         LDKChannelManager this_arg_conv;
41504         this_arg_conv.inner = untag_ptr(this_arg);
41505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41507         this_arg_conv.is_owned = false;
41508         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
41509         return ret_conv;
41510 }
41511
41512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
41513         LDKChannelManager this_arg_conv;
41514         this_arg_conv.inner = untag_ptr(this_arg);
41515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41517         this_arg_conv.is_owned = false;
41518         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
41519         int64_t ret_ref = 0;
41520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41522         return ret_ref;
41523 }
41524
41525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41526         LDKChannelManager this_arg_conv;
41527         this_arg_conv.inner = untag_ptr(this_arg);
41528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41530         this_arg_conv.is_owned = false;
41531         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41532         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
41533         return tag_ptr(ret_ret, true);
41534 }
41535
41536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41537         LDKChannelManager this_arg_conv;
41538         this_arg_conv.inner = untag_ptr(this_arg);
41539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41541         this_arg_conv.is_owned = false;
41542         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
41543         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
41544         return tag_ptr(ret_ret, true);
41545 }
41546
41547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
41548         LDKChannelManager this_arg_conv;
41549         this_arg_conv.inner = untag_ptr(this_arg);
41550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41552         this_arg_conv.is_owned = false;
41553         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
41554         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
41555         return tag_ptr(ret_ret, true);
41556 }
41557
41558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
41559         LDKChannelManager this_arg_conv;
41560         this_arg_conv.inner = untag_ptr(this_arg);
41561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41563         this_arg_conv.is_owned = false;
41564         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
41565         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
41566         return tag_ptr(ret_ret, true);
41567 }
41568
41569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
41570         LDKChannelManager this_arg_conv;
41571         this_arg_conv.inner = untag_ptr(this_arg);
41572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41574         this_arg_conv.is_owned = false;
41575         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
41576         int64_t ret_ref = 0;
41577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41579         return ret_ref;
41580 }
41581
41582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
41583         LDKChannelManager this_arg_conv;
41584         this_arg_conv.inner = untag_ptr(this_arg);
41585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41587         this_arg_conv.is_owned = false;
41588         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
41589         return ret_conv;
41590 }
41591
41592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
41593         LDKChannelManager this_arg_conv;
41594         this_arg_conv.inner = untag_ptr(this_arg);
41595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41597         this_arg_conv.is_owned = false;
41598         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
41599         int64_t ret_ref = 0;
41600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41602         return ret_ref;
41603 }
41604
41605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41606         LDKChannelManager this_arg_conv;
41607         this_arg_conv.inner = untag_ptr(this_arg);
41608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41610         this_arg_conv.is_owned = false;
41611         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
41612         int64_t ret_ref = 0;
41613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41615         return ret_ref;
41616 }
41617
41618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41619         LDKChannelManager this_arg_conv;
41620         this_arg_conv.inner = untag_ptr(this_arg);
41621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41623         this_arg_conv.is_owned = false;
41624         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
41625         int64_t ret_ref = 0;
41626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41628         return ret_ref;
41629 }
41630
41631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41632         LDKChannelManager this_arg_conv;
41633         this_arg_conv.inner = untag_ptr(this_arg);
41634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41636         this_arg_conv.is_owned = false;
41637         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
41638         int64_t ret_ref = 0;
41639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41641         return ret_ref;
41642 }
41643
41644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41645         LDKChannelManager this_arg_conv;
41646         this_arg_conv.inner = untag_ptr(this_arg);
41647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41649         this_arg_conv.is_owned = false;
41650         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
41651         int64_t ret_ref = 0;
41652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41654         return ret_ref;
41655 }
41656
41657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41658         LDKChannelManager this_arg_conv;
41659         this_arg_conv.inner = untag_ptr(this_arg);
41660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41662         this_arg_conv.is_owned = false;
41663         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
41664         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
41665         return tag_ptr(ret_ret, true);
41666 }
41667
41668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41669         LDKChannelManager this_arg_conv;
41670         this_arg_conv.inner = untag_ptr(this_arg);
41671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41673         this_arg_conv.is_owned = false;
41674         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
41675         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
41676         return tag_ptr(ret_ret, true);
41677 }
41678
41679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
41680         LDKUserConfig config_conv;
41681         config_conv.inner = untag_ptr(config);
41682         config_conv.is_owned = ptr_is_owned(config);
41683         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41684         config_conv.is_owned = false;
41685         LDKInitFeatures ret_var = provided_init_features(&config_conv);
41686         int64_t ret_ref = 0;
41687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41689         return ret_ref;
41690 }
41691
41692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41693         LDKCounterpartyForwardingInfo obj_conv;
41694         obj_conv.inner = untag_ptr(obj);
41695         obj_conv.is_owned = ptr_is_owned(obj);
41696         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41697         obj_conv.is_owned = false;
41698         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
41699         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41700         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41701         CVec_u8Z_free(ret_var);
41702         return ret_arr;
41703 }
41704
41705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41706         LDKu8slice ser_ref;
41707         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41708         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41709         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
41710         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
41711         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41712         return tag_ptr(ret_conv, true);
41713 }
41714
41715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
41716         LDKChannelCounterparty obj_conv;
41717         obj_conv.inner = untag_ptr(obj);
41718         obj_conv.is_owned = ptr_is_owned(obj);
41719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41720         obj_conv.is_owned = false;
41721         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
41722         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41723         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41724         CVec_u8Z_free(ret_var);
41725         return ret_arr;
41726 }
41727
41728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41729         LDKu8slice ser_ref;
41730         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41731         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41732         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
41733         *ret_conv = ChannelCounterparty_read(ser_ref);
41734         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41735         return tag_ptr(ret_conv, true);
41736 }
41737
41738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
41739         LDKChannelDetails obj_conv;
41740         obj_conv.inner = untag_ptr(obj);
41741         obj_conv.is_owned = ptr_is_owned(obj);
41742         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41743         obj_conv.is_owned = false;
41744         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
41745         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41746         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41747         CVec_u8Z_free(ret_var);
41748         return ret_arr;
41749 }
41750
41751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41752         LDKu8slice ser_ref;
41753         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41754         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41755         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
41756         *ret_conv = ChannelDetails_read(ser_ref);
41757         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41758         return tag_ptr(ret_conv, true);
41759 }
41760
41761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
41762         LDKPhantomRouteHints obj_conv;
41763         obj_conv.inner = untag_ptr(obj);
41764         obj_conv.is_owned = ptr_is_owned(obj);
41765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41766         obj_conv.is_owned = false;
41767         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
41768         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41769         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41770         CVec_u8Z_free(ret_var);
41771         return ret_arr;
41772 }
41773
41774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41775         LDKu8slice ser_ref;
41776         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41777         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41778         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
41779         *ret_conv = PhantomRouteHints_read(ser_ref);
41780         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41781         return tag_ptr(ret_conv, true);
41782 }
41783
41784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
41785         LDKChannelManager obj_conv;
41786         obj_conv.inner = untag_ptr(obj);
41787         obj_conv.is_owned = ptr_is_owned(obj);
41788         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41789         obj_conv.is_owned = false;
41790         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
41791         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41792         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41793         CVec_u8Z_free(ret_var);
41794         return ret_arr;
41795 }
41796
41797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
41798         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
41799         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
41800         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41801         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41802         CVec_u8Z_free(ret_var);
41803         return ret_arr;
41804 }
41805
41806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41807         LDKu8slice ser_ref;
41808         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41809         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41810         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
41811         *ret_conv = ChannelShutdownState_read(ser_ref);
41812         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41813         return tag_ptr(ret_conv, true);
41814 }
41815
41816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41817         LDKChannelManagerReadArgs this_obj_conv;
41818         this_obj_conv.inner = untag_ptr(this_obj);
41819         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41821         ChannelManagerReadArgs_free(this_obj_conv);
41822 }
41823
41824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
41825         LDKChannelManagerReadArgs this_ptr_conv;
41826         this_ptr_conv.inner = untag_ptr(this_ptr);
41827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41829         this_ptr_conv.is_owned = false;
41830         // WARNING: This object doesn't live past this scope, needs clone!
41831         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
41832         return ret_ret;
41833 }
41834
41835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41836         LDKChannelManagerReadArgs this_ptr_conv;
41837         this_ptr_conv.inner = untag_ptr(this_ptr);
41838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41840         this_ptr_conv.is_owned = false;
41841         void* val_ptr = untag_ptr(val);
41842         CHECK_ACCESS(val_ptr);
41843         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
41844         if (val_conv.free == LDKEntropySource_JCalls_free) {
41845                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41846                 LDKEntropySource_JCalls_cloned(&val_conv);
41847         }
41848         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
41849 }
41850
41851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
41852         LDKChannelManagerReadArgs this_ptr_conv;
41853         this_ptr_conv.inner = untag_ptr(this_ptr);
41854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41856         this_ptr_conv.is_owned = false;
41857         // WARNING: This object doesn't live past this scope, needs clone!
41858         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
41859         return ret_ret;
41860 }
41861
41862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41863         LDKChannelManagerReadArgs this_ptr_conv;
41864         this_ptr_conv.inner = untag_ptr(this_ptr);
41865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41867         this_ptr_conv.is_owned = false;
41868         void* val_ptr = untag_ptr(val);
41869         CHECK_ACCESS(val_ptr);
41870         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
41871         if (val_conv.free == LDKNodeSigner_JCalls_free) {
41872                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41873                 LDKNodeSigner_JCalls_cloned(&val_conv);
41874         }
41875         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
41876 }
41877
41878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
41879         LDKChannelManagerReadArgs this_ptr_conv;
41880         this_ptr_conv.inner = untag_ptr(this_ptr);
41881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41883         this_ptr_conv.is_owned = false;
41884         // WARNING: This object doesn't live past this scope, needs clone!
41885         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
41886         return ret_ret;
41887 }
41888
41889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41890         LDKChannelManagerReadArgs this_ptr_conv;
41891         this_ptr_conv.inner = untag_ptr(this_ptr);
41892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41894         this_ptr_conv.is_owned = false;
41895         void* val_ptr = untag_ptr(val);
41896         CHECK_ACCESS(val_ptr);
41897         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
41898         if (val_conv.free == LDKSignerProvider_JCalls_free) {
41899                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41900                 LDKSignerProvider_JCalls_cloned(&val_conv);
41901         }
41902         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
41903 }
41904
41905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
41906         LDKChannelManagerReadArgs this_ptr_conv;
41907         this_ptr_conv.inner = untag_ptr(this_ptr);
41908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41910         this_ptr_conv.is_owned = false;
41911         // WARNING: This object doesn't live past this scope, needs clone!
41912         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
41913         return ret_ret;
41914 }
41915
41916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41917         LDKChannelManagerReadArgs this_ptr_conv;
41918         this_ptr_conv.inner = untag_ptr(this_ptr);
41919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41921         this_ptr_conv.is_owned = false;
41922         void* val_ptr = untag_ptr(val);
41923         CHECK_ACCESS(val_ptr);
41924         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
41925         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
41926                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41927                 LDKFeeEstimator_JCalls_cloned(&val_conv);
41928         }
41929         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
41930 }
41931
41932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
41933         LDKChannelManagerReadArgs this_ptr_conv;
41934         this_ptr_conv.inner = untag_ptr(this_ptr);
41935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41937         this_ptr_conv.is_owned = false;
41938         // WARNING: This object doesn't live past this scope, needs clone!
41939         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
41940         return ret_ret;
41941 }
41942
41943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41944         LDKChannelManagerReadArgs this_ptr_conv;
41945         this_ptr_conv.inner = untag_ptr(this_ptr);
41946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41948         this_ptr_conv.is_owned = false;
41949         void* val_ptr = untag_ptr(val);
41950         CHECK_ACCESS(val_ptr);
41951         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
41952         if (val_conv.free == LDKWatch_JCalls_free) {
41953                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41954                 LDKWatch_JCalls_cloned(&val_conv);
41955         }
41956         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
41957 }
41958
41959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
41960         LDKChannelManagerReadArgs this_ptr_conv;
41961         this_ptr_conv.inner = untag_ptr(this_ptr);
41962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41964         this_ptr_conv.is_owned = false;
41965         // WARNING: This object doesn't live past this scope, needs clone!
41966         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
41967         return ret_ret;
41968 }
41969
41970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41971         LDKChannelManagerReadArgs this_ptr_conv;
41972         this_ptr_conv.inner = untag_ptr(this_ptr);
41973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41975         this_ptr_conv.is_owned = false;
41976         void* val_ptr = untag_ptr(val);
41977         CHECK_ACCESS(val_ptr);
41978         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
41979         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
41980                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41981                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
41982         }
41983         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
41984 }
41985
41986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
41987         LDKChannelManagerReadArgs this_ptr_conv;
41988         this_ptr_conv.inner = untag_ptr(this_ptr);
41989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41991         this_ptr_conv.is_owned = false;
41992         // WARNING: This object doesn't live past this scope, needs clone!
41993         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
41994         return ret_ret;
41995 }
41996
41997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41998         LDKChannelManagerReadArgs this_ptr_conv;
41999         this_ptr_conv.inner = untag_ptr(this_ptr);
42000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42002         this_ptr_conv.is_owned = false;
42003         void* val_ptr = untag_ptr(val);
42004         CHECK_ACCESS(val_ptr);
42005         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
42006         if (val_conv.free == LDKRouter_JCalls_free) {
42007                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42008                 LDKRouter_JCalls_cloned(&val_conv);
42009         }
42010         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
42011 }
42012
42013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
42014         LDKChannelManagerReadArgs this_ptr_conv;
42015         this_ptr_conv.inner = untag_ptr(this_ptr);
42016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42018         this_ptr_conv.is_owned = false;
42019         // WARNING: This object doesn't live past this scope, needs clone!
42020         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
42021         return ret_ret;
42022 }
42023
42024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42025         LDKChannelManagerReadArgs this_ptr_conv;
42026         this_ptr_conv.inner = untag_ptr(this_ptr);
42027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42029         this_ptr_conv.is_owned = false;
42030         void* val_ptr = untag_ptr(val);
42031         CHECK_ACCESS(val_ptr);
42032         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
42033         if (val_conv.free == LDKLogger_JCalls_free) {
42034                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42035                 LDKLogger_JCalls_cloned(&val_conv);
42036         }
42037         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
42038 }
42039
42040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
42041         LDKChannelManagerReadArgs this_ptr_conv;
42042         this_ptr_conv.inner = untag_ptr(this_ptr);
42043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42045         this_ptr_conv.is_owned = false;
42046         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
42047         int64_t ret_ref = 0;
42048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42050         return ret_ref;
42051 }
42052
42053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42054         LDKChannelManagerReadArgs this_ptr_conv;
42055         this_ptr_conv.inner = untag_ptr(this_ptr);
42056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42058         this_ptr_conv.is_owned = false;
42059         LDKUserConfig val_conv;
42060         val_conv.inner = untag_ptr(val);
42061         val_conv.is_owned = ptr_is_owned(val);
42062         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42063         val_conv = UserConfig_clone(&val_conv);
42064         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
42065 }
42066
42067 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) {
42068         void* entropy_source_ptr = untag_ptr(entropy_source);
42069         CHECK_ACCESS(entropy_source_ptr);
42070         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
42071         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
42072                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42073                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
42074         }
42075         void* node_signer_ptr = untag_ptr(node_signer);
42076         CHECK_ACCESS(node_signer_ptr);
42077         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
42078         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
42079                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42080                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
42081         }
42082         void* signer_provider_ptr = untag_ptr(signer_provider);
42083         CHECK_ACCESS(signer_provider_ptr);
42084         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
42085         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
42086                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42087                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
42088         }
42089         void* fee_estimator_ptr = untag_ptr(fee_estimator);
42090         CHECK_ACCESS(fee_estimator_ptr);
42091         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
42092         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
42093                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42094                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
42095         }
42096         void* chain_monitor_ptr = untag_ptr(chain_monitor);
42097         CHECK_ACCESS(chain_monitor_ptr);
42098         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
42099         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
42100                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42101                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
42102         }
42103         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
42104         CHECK_ACCESS(tx_broadcaster_ptr);
42105         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
42106         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
42107                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42108                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
42109         }
42110         void* router_ptr = untag_ptr(router);
42111         CHECK_ACCESS(router_ptr);
42112         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
42113         if (router_conv.free == LDKRouter_JCalls_free) {
42114                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42115                 LDKRouter_JCalls_cloned(&router_conv);
42116         }
42117         void* logger_ptr = untag_ptr(logger);
42118         CHECK_ACCESS(logger_ptr);
42119         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42120         if (logger_conv.free == LDKLogger_JCalls_free) {
42121                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42122                 LDKLogger_JCalls_cloned(&logger_conv);
42123         }
42124         LDKUserConfig default_config_conv;
42125         default_config_conv.inner = untag_ptr(default_config);
42126         default_config_conv.is_owned = ptr_is_owned(default_config);
42127         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
42128         default_config_conv = UserConfig_clone(&default_config_conv);
42129         LDKCVec_ChannelMonitorZ channel_monitors_constr;
42130         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
42131         if (channel_monitors_constr.datalen > 0)
42132                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
42133         else
42134                 channel_monitors_constr.data = NULL;
42135         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
42136         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
42137                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
42138                 LDKChannelMonitor channel_monitors_conv_16_conv;
42139                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
42140                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
42141                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
42142                 channel_monitors_conv_16_conv.is_owned = false;
42143                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
42144         }
42145         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
42146         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);
42147         int64_t ret_ref = 0;
42148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42150         return ret_ref;
42151 }
42152
42153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
42154         LDKu8slice ser_ref;
42155         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42156         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42157         LDKChannelManagerReadArgs arg_conv;
42158         arg_conv.inner = untag_ptr(arg);
42159         arg_conv.is_owned = ptr_is_owned(arg);
42160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42161         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
42162         
42163         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
42164         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
42165         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42166         return tag_ptr(ret_conv, true);
42167 }
42168
42169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42170         LDKExpandedKey this_obj_conv;
42171         this_obj_conv.inner = untag_ptr(this_obj);
42172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42174         ExpandedKey_free(this_obj_conv);
42175 }
42176
42177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
42178         uint8_t key_material_arr[32];
42179         CHECK((*env)->GetArrayLength(env, key_material) == 32);
42180         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
42181         uint8_t (*key_material_ref)[32] = &key_material_arr;
42182         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
42183         int64_t ret_ref = 0;
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42186         return ret_ref;
42187 }
42188
42189 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) {
42190         LDKExpandedKey keys_conv;
42191         keys_conv.inner = untag_ptr(keys);
42192         keys_conv.is_owned = ptr_is_owned(keys);
42193         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
42194         keys_conv.is_owned = false;
42195         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42196         CHECK_ACCESS(min_value_msat_ptr);
42197         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42198         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42199         void* entropy_source_ptr = untag_ptr(entropy_source);
42200         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
42201         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
42202         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
42203         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
42204         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
42205         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
42206         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
42207         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
42208         return tag_ptr(ret_conv, true);
42209 }
42210
42211 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) {
42212         LDKExpandedKey keys_conv;
42213         keys_conv.inner = untag_ptr(keys);
42214         keys_conv.is_owned = ptr_is_owned(keys);
42215         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
42216         keys_conv.is_owned = false;
42217         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42218         CHECK_ACCESS(min_value_msat_ptr);
42219         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42220         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42221         LDKThirtyTwoBytes payment_hash_ref;
42222         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
42223         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
42224         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
42225         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
42226         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
42227         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
42228         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
42229         *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);
42230         return tag_ptr(ret_conv, true);
42231 }
42232
42233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42234         if (!ptr_is_owned(this_ptr)) return;
42235         void* this_ptr_ptr = untag_ptr(this_ptr);
42236         CHECK_ACCESS(this_ptr_ptr);
42237         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
42238         FREE(untag_ptr(this_ptr));
42239         DecodeError_free(this_ptr_conv);
42240 }
42241
42242 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
42243         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42244         *ret_copy = DecodeError_clone(arg);
42245         int64_t ret_ref = tag_ptr(ret_copy, true);
42246         return ret_ref;
42247 }
42248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42249         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
42250         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
42251         return ret_conv;
42252 }
42253
42254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42255         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
42256         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42257         *ret_copy = DecodeError_clone(orig_conv);
42258         int64_t ret_ref = tag_ptr(ret_copy, true);
42259         return ret_ref;
42260 }
42261
42262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
42263         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42264         *ret_copy = DecodeError_unknown_version();
42265         int64_t ret_ref = tag_ptr(ret_copy, true);
42266         return ret_ref;
42267 }
42268
42269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
42270         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42271         *ret_copy = DecodeError_unknown_required_feature();
42272         int64_t ret_ref = tag_ptr(ret_copy, true);
42273         return ret_ref;
42274 }
42275
42276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
42277         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42278         *ret_copy = DecodeError_invalid_value();
42279         int64_t ret_ref = tag_ptr(ret_copy, true);
42280         return ret_ref;
42281 }
42282
42283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
42284         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42285         *ret_copy = DecodeError_short_read();
42286         int64_t ret_ref = tag_ptr(ret_copy, true);
42287         return ret_ref;
42288 }
42289
42290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
42291         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42292         *ret_copy = DecodeError_bad_length_descriptor();
42293         int64_t ret_ref = tag_ptr(ret_copy, true);
42294         return ret_ref;
42295 }
42296
42297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
42298         LDKIOError a_conv = LDKIOError_from_java(env, a);
42299         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42300         *ret_copy = DecodeError_io(a_conv);
42301         int64_t ret_ref = tag_ptr(ret_copy, true);
42302         return ret_ref;
42303 }
42304
42305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
42306         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
42307         *ret_copy = DecodeError_unsupported_compression();
42308         int64_t ret_ref = tag_ptr(ret_copy, true);
42309         return ret_ref;
42310 }
42311
42312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42313         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
42314         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
42315         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
42316         return ret_conv;
42317 }
42318
42319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42320         LDKInit this_obj_conv;
42321         this_obj_conv.inner = untag_ptr(this_obj);
42322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42324         Init_free(this_obj_conv);
42325 }
42326
42327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42328         LDKInit this_ptr_conv;
42329         this_ptr_conv.inner = untag_ptr(this_ptr);
42330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42332         this_ptr_conv.is_owned = false;
42333         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
42334         int64_t ret_ref = 0;
42335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42337         return ret_ref;
42338 }
42339
42340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42341         LDKInit 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         LDKInitFeatures val_conv;
42347         val_conv.inner = untag_ptr(val);
42348         val_conv.is_owned = ptr_is_owned(val);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42350         val_conv = InitFeatures_clone(&val_conv);
42351         Init_set_features(&this_ptr_conv, val_conv);
42352 }
42353
42354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
42355         LDKInit this_ptr_conv;
42356         this_ptr_conv.inner = untag_ptr(this_ptr);
42357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42359         this_ptr_conv.is_owned = false;
42360         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
42361         *ret_copy = Init_get_networks(&this_ptr_conv);
42362         int64_t ret_ref = tag_ptr(ret_copy, true);
42363         return ret_ref;
42364 }
42365
42366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42367         LDKInit this_ptr_conv;
42368         this_ptr_conv.inner = untag_ptr(this_ptr);
42369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42371         this_ptr_conv.is_owned = false;
42372         void* val_ptr = untag_ptr(val);
42373         CHECK_ACCESS(val_ptr);
42374         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
42375         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
42376         Init_set_networks(&this_ptr_conv, val_conv);
42377 }
42378
42379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
42380         LDKInit 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         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
42386         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
42387         int64_t ret_ref = tag_ptr(ret_copy, true);
42388         return ret_ref;
42389 }
42390
42391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42392         LDKInit 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         void* val_ptr = untag_ptr(val);
42398         CHECK_ACCESS(val_ptr);
42399         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
42400         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
42401         Init_set_remote_network_address(&this_ptr_conv, val_conv);
42402 }
42403
42404 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) {
42405         LDKInitFeatures features_arg_conv;
42406         features_arg_conv.inner = untag_ptr(features_arg);
42407         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42408         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42409         features_arg_conv = InitFeatures_clone(&features_arg_conv);
42410         void* networks_arg_ptr = untag_ptr(networks_arg);
42411         CHECK_ACCESS(networks_arg_ptr);
42412         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
42413         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
42414         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
42415         CHECK_ACCESS(remote_network_address_arg_ptr);
42416         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
42417         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
42418         int64_t ret_ref = 0;
42419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42421         return ret_ref;
42422 }
42423
42424 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
42425         LDKInit ret_var = Init_clone(arg);
42426         int64_t ret_ref = 0;
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42429         return ret_ref;
42430 }
42431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42432         LDKInit arg_conv;
42433         arg_conv.inner = untag_ptr(arg);
42434         arg_conv.is_owned = ptr_is_owned(arg);
42435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42436         arg_conv.is_owned = false;
42437         int64_t ret_conv = Init_clone_ptr(&arg_conv);
42438         return ret_conv;
42439 }
42440
42441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42442         LDKInit orig_conv;
42443         orig_conv.inner = untag_ptr(orig);
42444         orig_conv.is_owned = ptr_is_owned(orig);
42445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42446         orig_conv.is_owned = false;
42447         LDKInit ret_var = Init_clone(&orig_conv);
42448         int64_t ret_ref = 0;
42449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42451         return ret_ref;
42452 }
42453
42454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42455         LDKInit a_conv;
42456         a_conv.inner = untag_ptr(a);
42457         a_conv.is_owned = ptr_is_owned(a);
42458         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42459         a_conv.is_owned = false;
42460         LDKInit b_conv;
42461         b_conv.inner = untag_ptr(b);
42462         b_conv.is_owned = ptr_is_owned(b);
42463         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42464         b_conv.is_owned = false;
42465         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
42466         return ret_conv;
42467 }
42468
42469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42470         LDKErrorMessage this_obj_conv;
42471         this_obj_conv.inner = untag_ptr(this_obj);
42472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42474         ErrorMessage_free(this_obj_conv);
42475 }
42476
42477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42478         LDKErrorMessage this_ptr_conv;
42479         this_ptr_conv.inner = untag_ptr(this_ptr);
42480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42482         this_ptr_conv.is_owned = false;
42483         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42484         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
42485         return ret_arr;
42486 }
42487
42488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42489         LDKErrorMessage this_ptr_conv;
42490         this_ptr_conv.inner = untag_ptr(this_ptr);
42491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42493         this_ptr_conv.is_owned = false;
42494         LDKThirtyTwoBytes val_ref;
42495         CHECK((*env)->GetArrayLength(env, val) == 32);
42496         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42497         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
42498 }
42499
42500 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
42501         LDKErrorMessage this_ptr_conv;
42502         this_ptr_conv.inner = untag_ptr(this_ptr);
42503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42505         this_ptr_conv.is_owned = false;
42506         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
42507         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42508         Str_free(ret_str);
42509         return ret_conv;
42510 }
42511
42512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42513         LDKErrorMessage this_ptr_conv;
42514         this_ptr_conv.inner = untag_ptr(this_ptr);
42515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42517         this_ptr_conv.is_owned = false;
42518         LDKStr val_conv = java_to_owned_str(env, val);
42519         ErrorMessage_set_data(&this_ptr_conv, val_conv);
42520 }
42521
42522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
42523         LDKThirtyTwoBytes channel_id_arg_ref;
42524         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42525         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42526         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
42527         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
42528         int64_t ret_ref = 0;
42529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42531         return ret_ref;
42532 }
42533
42534 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
42535         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
42536         int64_t ret_ref = 0;
42537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42539         return ret_ref;
42540 }
42541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42542         LDKErrorMessage arg_conv;
42543         arg_conv.inner = untag_ptr(arg);
42544         arg_conv.is_owned = ptr_is_owned(arg);
42545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42546         arg_conv.is_owned = false;
42547         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
42548         return ret_conv;
42549 }
42550
42551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42552         LDKErrorMessage orig_conv;
42553         orig_conv.inner = untag_ptr(orig);
42554         orig_conv.is_owned = ptr_is_owned(orig);
42555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42556         orig_conv.is_owned = false;
42557         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
42558         int64_t ret_ref = 0;
42559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42561         return ret_ref;
42562 }
42563
42564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42565         LDKErrorMessage a_conv;
42566         a_conv.inner = untag_ptr(a);
42567         a_conv.is_owned = ptr_is_owned(a);
42568         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42569         a_conv.is_owned = false;
42570         LDKErrorMessage b_conv;
42571         b_conv.inner = untag_ptr(b);
42572         b_conv.is_owned = ptr_is_owned(b);
42573         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42574         b_conv.is_owned = false;
42575         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
42576         return ret_conv;
42577 }
42578
42579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42580         LDKWarningMessage this_obj_conv;
42581         this_obj_conv.inner = untag_ptr(this_obj);
42582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42584         WarningMessage_free(this_obj_conv);
42585 }
42586
42587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42588         LDKWarningMessage this_ptr_conv;
42589         this_ptr_conv.inner = untag_ptr(this_ptr);
42590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42592         this_ptr_conv.is_owned = false;
42593         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42594         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
42595         return ret_arr;
42596 }
42597
42598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42599         LDKWarningMessage 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         LDKThirtyTwoBytes val_ref;
42605         CHECK((*env)->GetArrayLength(env, val) == 32);
42606         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42607         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
42608 }
42609
42610 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
42611         LDKWarningMessage this_ptr_conv;
42612         this_ptr_conv.inner = untag_ptr(this_ptr);
42613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42615         this_ptr_conv.is_owned = false;
42616         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
42617         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42618         Str_free(ret_str);
42619         return ret_conv;
42620 }
42621
42622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42623         LDKWarningMessage this_ptr_conv;
42624         this_ptr_conv.inner = untag_ptr(this_ptr);
42625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42627         this_ptr_conv.is_owned = false;
42628         LDKStr val_conv = java_to_owned_str(env, val);
42629         WarningMessage_set_data(&this_ptr_conv, val_conv);
42630 }
42631
42632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
42633         LDKThirtyTwoBytes channel_id_arg_ref;
42634         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42635         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42636         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
42637         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
42638         int64_t ret_ref = 0;
42639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42641         return ret_ref;
42642 }
42643
42644 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
42645         LDKWarningMessage ret_var = WarningMessage_clone(arg);
42646         int64_t ret_ref = 0;
42647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42649         return ret_ref;
42650 }
42651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42652         LDKWarningMessage arg_conv;
42653         arg_conv.inner = untag_ptr(arg);
42654         arg_conv.is_owned = ptr_is_owned(arg);
42655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42656         arg_conv.is_owned = false;
42657         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
42658         return ret_conv;
42659 }
42660
42661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42662         LDKWarningMessage orig_conv;
42663         orig_conv.inner = untag_ptr(orig);
42664         orig_conv.is_owned = ptr_is_owned(orig);
42665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42666         orig_conv.is_owned = false;
42667         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
42668         int64_t ret_ref = 0;
42669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42671         return ret_ref;
42672 }
42673
42674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42675         LDKWarningMessage a_conv;
42676         a_conv.inner = untag_ptr(a);
42677         a_conv.is_owned = ptr_is_owned(a);
42678         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42679         a_conv.is_owned = false;
42680         LDKWarningMessage b_conv;
42681         b_conv.inner = untag_ptr(b);
42682         b_conv.is_owned = ptr_is_owned(b);
42683         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42684         b_conv.is_owned = false;
42685         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
42686         return ret_conv;
42687 }
42688
42689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42690         LDKPing this_obj_conv;
42691         this_obj_conv.inner = untag_ptr(this_obj);
42692         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42694         Ping_free(this_obj_conv);
42695 }
42696
42697 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42698         LDKPing this_ptr_conv;
42699         this_ptr_conv.inner = untag_ptr(this_ptr);
42700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42702         this_ptr_conv.is_owned = false;
42703         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
42704         return ret_conv;
42705 }
42706
42707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42708         LDKPing this_ptr_conv;
42709         this_ptr_conv.inner = untag_ptr(this_ptr);
42710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42712         this_ptr_conv.is_owned = false;
42713         Ping_set_ponglen(&this_ptr_conv, val);
42714 }
42715
42716 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42717         LDKPing this_ptr_conv;
42718         this_ptr_conv.inner = untag_ptr(this_ptr);
42719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42721         this_ptr_conv.is_owned = false;
42722         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
42723         return ret_conv;
42724 }
42725
42726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42727         LDKPing this_ptr_conv;
42728         this_ptr_conv.inner = untag_ptr(this_ptr);
42729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42731         this_ptr_conv.is_owned = false;
42732         Ping_set_byteslen(&this_ptr_conv, val);
42733 }
42734
42735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
42736         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
42737         int64_t ret_ref = 0;
42738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42740         return ret_ref;
42741 }
42742
42743 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
42744         LDKPing ret_var = Ping_clone(arg);
42745         int64_t ret_ref = 0;
42746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42748         return ret_ref;
42749 }
42750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42751         LDKPing arg_conv;
42752         arg_conv.inner = untag_ptr(arg);
42753         arg_conv.is_owned = ptr_is_owned(arg);
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42755         arg_conv.is_owned = false;
42756         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
42757         return ret_conv;
42758 }
42759
42760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42761         LDKPing orig_conv;
42762         orig_conv.inner = untag_ptr(orig);
42763         orig_conv.is_owned = ptr_is_owned(orig);
42764         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42765         orig_conv.is_owned = false;
42766         LDKPing ret_var = Ping_clone(&orig_conv);
42767         int64_t ret_ref = 0;
42768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42770         return ret_ref;
42771 }
42772
42773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42774         LDKPing a_conv;
42775         a_conv.inner = untag_ptr(a);
42776         a_conv.is_owned = ptr_is_owned(a);
42777         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42778         a_conv.is_owned = false;
42779         LDKPing b_conv;
42780         b_conv.inner = untag_ptr(b);
42781         b_conv.is_owned = ptr_is_owned(b);
42782         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42783         b_conv.is_owned = false;
42784         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
42785         return ret_conv;
42786 }
42787
42788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42789         LDKPong this_obj_conv;
42790         this_obj_conv.inner = untag_ptr(this_obj);
42791         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42793         Pong_free(this_obj_conv);
42794 }
42795
42796 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
42797         LDKPong this_ptr_conv;
42798         this_ptr_conv.inner = untag_ptr(this_ptr);
42799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42801         this_ptr_conv.is_owned = false;
42802         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
42803         return ret_conv;
42804 }
42805
42806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42807         LDKPong this_ptr_conv;
42808         this_ptr_conv.inner = untag_ptr(this_ptr);
42809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42811         this_ptr_conv.is_owned = false;
42812         Pong_set_byteslen(&this_ptr_conv, val);
42813 }
42814
42815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
42816         LDKPong ret_var = Pong_new(byteslen_arg);
42817         int64_t ret_ref = 0;
42818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42820         return ret_ref;
42821 }
42822
42823 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
42824         LDKPong ret_var = Pong_clone(arg);
42825         int64_t ret_ref = 0;
42826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42828         return ret_ref;
42829 }
42830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42831         LDKPong arg_conv;
42832         arg_conv.inner = untag_ptr(arg);
42833         arg_conv.is_owned = ptr_is_owned(arg);
42834         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42835         arg_conv.is_owned = false;
42836         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
42837         return ret_conv;
42838 }
42839
42840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42841         LDKPong orig_conv;
42842         orig_conv.inner = untag_ptr(orig);
42843         orig_conv.is_owned = ptr_is_owned(orig);
42844         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42845         orig_conv.is_owned = false;
42846         LDKPong ret_var = Pong_clone(&orig_conv);
42847         int64_t ret_ref = 0;
42848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42850         return ret_ref;
42851 }
42852
42853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42854         LDKPong a_conv;
42855         a_conv.inner = untag_ptr(a);
42856         a_conv.is_owned = ptr_is_owned(a);
42857         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42858         a_conv.is_owned = false;
42859         LDKPong b_conv;
42860         b_conv.inner = untag_ptr(b);
42861         b_conv.is_owned = ptr_is_owned(b);
42862         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42863         b_conv.is_owned = false;
42864         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
42865         return ret_conv;
42866 }
42867
42868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42869         LDKOpenChannel this_obj_conv;
42870         this_obj_conv.inner = untag_ptr(this_obj);
42871         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42873         OpenChannel_free(this_obj_conv);
42874 }
42875
42876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
42877         LDKOpenChannel this_ptr_conv;
42878         this_ptr_conv.inner = untag_ptr(this_ptr);
42879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42881         this_ptr_conv.is_owned = false;
42882         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42883         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
42884         return ret_arr;
42885 }
42886
42887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42888         LDKOpenChannel this_ptr_conv;
42889         this_ptr_conv.inner = untag_ptr(this_ptr);
42890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42892         this_ptr_conv.is_owned = false;
42893         LDKThirtyTwoBytes val_ref;
42894         CHECK((*env)->GetArrayLength(env, val) == 32);
42895         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42896         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
42897 }
42898
42899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42900         LDKOpenChannel 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42906         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
42907         return ret_arr;
42908 }
42909
42910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42911         LDKOpenChannel this_ptr_conv;
42912         this_ptr_conv.inner = untag_ptr(this_ptr);
42913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42915         this_ptr_conv.is_owned = false;
42916         LDKThirtyTwoBytes val_ref;
42917         CHECK((*env)->GetArrayLength(env, val) == 32);
42918         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42919         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
42920 }
42921
42922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42923         LDKOpenChannel this_ptr_conv;
42924         this_ptr_conv.inner = untag_ptr(this_ptr);
42925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42927         this_ptr_conv.is_owned = false;
42928         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
42929         return ret_conv;
42930 }
42931
42932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42933         LDKOpenChannel this_ptr_conv;
42934         this_ptr_conv.inner = untag_ptr(this_ptr);
42935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42937         this_ptr_conv.is_owned = false;
42938         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
42939 }
42940
42941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42942         LDKOpenChannel this_ptr_conv;
42943         this_ptr_conv.inner = untag_ptr(this_ptr);
42944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42946         this_ptr_conv.is_owned = false;
42947         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
42948         return ret_conv;
42949 }
42950
42951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42952         LDKOpenChannel this_ptr_conv;
42953         this_ptr_conv.inner = untag_ptr(this_ptr);
42954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42956         this_ptr_conv.is_owned = false;
42957         OpenChannel_set_push_msat(&this_ptr_conv, val);
42958 }
42959
42960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42961         LDKOpenChannel this_ptr_conv;
42962         this_ptr_conv.inner = untag_ptr(this_ptr);
42963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42965         this_ptr_conv.is_owned = false;
42966         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
42967         return ret_conv;
42968 }
42969
42970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42971         LDKOpenChannel this_ptr_conv;
42972         this_ptr_conv.inner = untag_ptr(this_ptr);
42973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42975         this_ptr_conv.is_owned = false;
42976         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
42977 }
42978
42979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42980         LDKOpenChannel this_ptr_conv;
42981         this_ptr_conv.inner = untag_ptr(this_ptr);
42982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42984         this_ptr_conv.is_owned = false;
42985         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42986         return ret_conv;
42987 }
42988
42989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42990         LDKOpenChannel this_ptr_conv;
42991         this_ptr_conv.inner = untag_ptr(this_ptr);
42992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42994         this_ptr_conv.is_owned = false;
42995         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42996 }
42997
42998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42999         LDKOpenChannel this_ptr_conv;
43000         this_ptr_conv.inner = untag_ptr(this_ptr);
43001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43003         this_ptr_conv.is_owned = false;
43004         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
43005         return ret_conv;
43006 }
43007
43008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43009         LDKOpenChannel this_ptr_conv;
43010         this_ptr_conv.inner = untag_ptr(this_ptr);
43011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43013         this_ptr_conv.is_owned = false;
43014         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
43015 }
43016
43017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43018         LDKOpenChannel this_ptr_conv;
43019         this_ptr_conv.inner = untag_ptr(this_ptr);
43020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43022         this_ptr_conv.is_owned = false;
43023         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
43024         return ret_conv;
43025 }
43026
43027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43028         LDKOpenChannel this_ptr_conv;
43029         this_ptr_conv.inner = untag_ptr(this_ptr);
43030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43032         this_ptr_conv.is_owned = false;
43033         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
43034 }
43035
43036 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
43037         LDKOpenChannel this_ptr_conv;
43038         this_ptr_conv.inner = untag_ptr(this_ptr);
43039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43041         this_ptr_conv.is_owned = false;
43042         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
43043         return ret_conv;
43044 }
43045
43046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43047         LDKOpenChannel this_ptr_conv;
43048         this_ptr_conv.inner = untag_ptr(this_ptr);
43049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43051         this_ptr_conv.is_owned = false;
43052         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
43053 }
43054
43055 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43056         LDKOpenChannel this_ptr_conv;
43057         this_ptr_conv.inner = untag_ptr(this_ptr);
43058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43060         this_ptr_conv.is_owned = false;
43061         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
43062         return ret_conv;
43063 }
43064
43065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43066         LDKOpenChannel this_ptr_conv;
43067         this_ptr_conv.inner = untag_ptr(this_ptr);
43068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43070         this_ptr_conv.is_owned = false;
43071         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
43072 }
43073
43074 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43075         LDKOpenChannel this_ptr_conv;
43076         this_ptr_conv.inner = untag_ptr(this_ptr);
43077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43079         this_ptr_conv.is_owned = false;
43080         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
43081         return ret_conv;
43082 }
43083
43084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43085         LDKOpenChannel this_ptr_conv;
43086         this_ptr_conv.inner = untag_ptr(this_ptr);
43087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43089         this_ptr_conv.is_owned = false;
43090         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
43091 }
43092
43093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43094         LDKOpenChannel this_ptr_conv;
43095         this_ptr_conv.inner = untag_ptr(this_ptr);
43096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43098         this_ptr_conv.is_owned = false;
43099         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43100         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
43101         return ret_arr;
43102 }
43103
43104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43105         LDKOpenChannel this_ptr_conv;
43106         this_ptr_conv.inner = untag_ptr(this_ptr);
43107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43109         this_ptr_conv.is_owned = false;
43110         LDKPublicKey val_ref;
43111         CHECK((*env)->GetArrayLength(env, val) == 33);
43112         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43113         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
43114 }
43115
43116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43117         LDKOpenChannel this_ptr_conv;
43118         this_ptr_conv.inner = untag_ptr(this_ptr);
43119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43121         this_ptr_conv.is_owned = false;
43122         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43123         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43124         return ret_arr;
43125 }
43126
43127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43128         LDKOpenChannel this_ptr_conv;
43129         this_ptr_conv.inner = untag_ptr(this_ptr);
43130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43132         this_ptr_conv.is_owned = false;
43133         LDKPublicKey val_ref;
43134         CHECK((*env)->GetArrayLength(env, val) == 33);
43135         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43136         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
43137 }
43138
43139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43140         LDKOpenChannel this_ptr_conv;
43141         this_ptr_conv.inner = untag_ptr(this_ptr);
43142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43144         this_ptr_conv.is_owned = false;
43145         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43146         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
43147         return ret_arr;
43148 }
43149
43150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43151         LDKOpenChannel this_ptr_conv;
43152         this_ptr_conv.inner = untag_ptr(this_ptr);
43153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43155         this_ptr_conv.is_owned = false;
43156         LDKPublicKey val_ref;
43157         CHECK((*env)->GetArrayLength(env, val) == 33);
43158         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43159         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
43160 }
43161
43162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43163         LDKOpenChannel this_ptr_conv;
43164         this_ptr_conv.inner = untag_ptr(this_ptr);
43165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43167         this_ptr_conv.is_owned = false;
43168         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43169         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43170         return ret_arr;
43171 }
43172
43173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43174         LDKOpenChannel this_ptr_conv;
43175         this_ptr_conv.inner = untag_ptr(this_ptr);
43176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43178         this_ptr_conv.is_owned = false;
43179         LDKPublicKey val_ref;
43180         CHECK((*env)->GetArrayLength(env, val) == 33);
43181         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43182         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43183 }
43184
43185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43186         LDKOpenChannel this_ptr_conv;
43187         this_ptr_conv.inner = untag_ptr(this_ptr);
43188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43190         this_ptr_conv.is_owned = false;
43191         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43192         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
43193         return ret_arr;
43194 }
43195
43196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43197         LDKOpenChannel this_ptr_conv;
43198         this_ptr_conv.inner = untag_ptr(this_ptr);
43199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43201         this_ptr_conv.is_owned = false;
43202         LDKPublicKey val_ref;
43203         CHECK((*env)->GetArrayLength(env, val) == 33);
43204         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43205         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
43206 }
43207
43208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43209         LDKOpenChannel this_ptr_conv;
43210         this_ptr_conv.inner = untag_ptr(this_ptr);
43211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43213         this_ptr_conv.is_owned = false;
43214         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43215         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
43216         return ret_arr;
43217 }
43218
43219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43220         LDKOpenChannel this_ptr_conv;
43221         this_ptr_conv.inner = untag_ptr(this_ptr);
43222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43224         this_ptr_conv.is_owned = false;
43225         LDKPublicKey val_ref;
43226         CHECK((*env)->GetArrayLength(env, val) == 33);
43227         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43228         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43229 }
43230
43231 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
43232         LDKOpenChannel this_ptr_conv;
43233         this_ptr_conv.inner = untag_ptr(this_ptr);
43234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43236         this_ptr_conv.is_owned = false;
43237         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
43238         return ret_conv;
43239 }
43240
43241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
43242         LDKOpenChannel this_ptr_conv;
43243         this_ptr_conv.inner = untag_ptr(this_ptr);
43244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43246         this_ptr_conv.is_owned = false;
43247         OpenChannel_set_channel_flags(&this_ptr_conv, val);
43248 }
43249
43250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43251         LDKOpenChannel this_ptr_conv;
43252         this_ptr_conv.inner = untag_ptr(this_ptr);
43253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43255         this_ptr_conv.is_owned = false;
43256         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43257         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
43258         int64_t ret_ref = tag_ptr(ret_copy, true);
43259         return ret_ref;
43260 }
43261
43262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43263         LDKOpenChannel this_ptr_conv;
43264         this_ptr_conv.inner = untag_ptr(this_ptr);
43265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43267         this_ptr_conv.is_owned = false;
43268         void* val_ptr = untag_ptr(val);
43269         CHECK_ACCESS(val_ptr);
43270         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43271         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43272         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43273 }
43274
43275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
43276         LDKOpenChannel this_ptr_conv;
43277         this_ptr_conv.inner = untag_ptr(this_ptr);
43278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43280         this_ptr_conv.is_owned = false;
43281         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
43282         int64_t ret_ref = 0;
43283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43285         return ret_ref;
43286 }
43287
43288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43289         LDKOpenChannel this_ptr_conv;
43290         this_ptr_conv.inner = untag_ptr(this_ptr);
43291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43293         this_ptr_conv.is_owned = false;
43294         LDKChannelTypeFeatures val_conv;
43295         val_conv.inner = untag_ptr(val);
43296         val_conv.is_owned = ptr_is_owned(val);
43297         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43298         val_conv = ChannelTypeFeatures_clone(&val_conv);
43299         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
43300 }
43301
43302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t push_msat_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t feerate_per_kw_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
43303         LDKThirtyTwoBytes chain_hash_arg_ref;
43304         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
43305         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
43306         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43307         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
43308         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
43309         LDKPublicKey funding_pubkey_arg_ref;
43310         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
43311         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
43312         LDKPublicKey revocation_basepoint_arg_ref;
43313         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
43314         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
43315         LDKPublicKey payment_point_arg_ref;
43316         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
43317         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
43318         LDKPublicKey delayed_payment_basepoint_arg_ref;
43319         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
43320         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
43321         LDKPublicKey htlc_basepoint_arg_ref;
43322         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
43323         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
43324         LDKPublicKey first_per_commitment_point_arg_ref;
43325         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
43326         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
43327         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43328         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43329         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43330         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43331         LDKChannelTypeFeatures channel_type_arg_conv;
43332         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43333         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43334         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43335         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43336         LDKOpenChannel ret_var = OpenChannel_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
43337         int64_t ret_ref = 0;
43338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43340         return ret_ref;
43341 }
43342
43343 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
43344         LDKOpenChannel ret_var = OpenChannel_clone(arg);
43345         int64_t ret_ref = 0;
43346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43348         return ret_ref;
43349 }
43350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43351         LDKOpenChannel arg_conv;
43352         arg_conv.inner = untag_ptr(arg);
43353         arg_conv.is_owned = ptr_is_owned(arg);
43354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43355         arg_conv.is_owned = false;
43356         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
43357         return ret_conv;
43358 }
43359
43360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43361         LDKOpenChannel orig_conv;
43362         orig_conv.inner = untag_ptr(orig);
43363         orig_conv.is_owned = ptr_is_owned(orig);
43364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43365         orig_conv.is_owned = false;
43366         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
43367         int64_t ret_ref = 0;
43368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43370         return ret_ref;
43371 }
43372
43373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43374         LDKOpenChannel a_conv;
43375         a_conv.inner = untag_ptr(a);
43376         a_conv.is_owned = ptr_is_owned(a);
43377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43378         a_conv.is_owned = false;
43379         LDKOpenChannel b_conv;
43380         b_conv.inner = untag_ptr(b);
43381         b_conv.is_owned = ptr_is_owned(b);
43382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43383         b_conv.is_owned = false;
43384         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
43385         return ret_conv;
43386 }
43387
43388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43389         LDKOpenChannelV2 this_obj_conv;
43390         this_obj_conv.inner = untag_ptr(this_obj);
43391         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43393         OpenChannelV2_free(this_obj_conv);
43394 }
43395
43396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
43397         LDKOpenChannelV2 this_ptr_conv;
43398         this_ptr_conv.inner = untag_ptr(this_ptr);
43399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43401         this_ptr_conv.is_owned = false;
43402         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43403         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_chain_hash(&this_ptr_conv));
43404         return ret_arr;
43405 }
43406
43407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43408         LDKOpenChannelV2 this_ptr_conv;
43409         this_ptr_conv.inner = untag_ptr(this_ptr);
43410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43412         this_ptr_conv.is_owned = false;
43413         LDKThirtyTwoBytes val_ref;
43414         CHECK((*env)->GetArrayLength(env, val) == 32);
43415         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43416         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
43417 }
43418
43419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43420         LDKOpenChannelV2 this_ptr_conv;
43421         this_ptr_conv.inner = untag_ptr(this_ptr);
43422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43424         this_ptr_conv.is_owned = false;
43425         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43426         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv));
43427         return ret_arr;
43428 }
43429
43430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43431         LDKOpenChannelV2 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         LDKThirtyTwoBytes val_ref;
43437         CHECK((*env)->GetArrayLength(env, val) == 32);
43438         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43439         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
43440 }
43441
43442 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) {
43443         LDKOpenChannelV2 this_ptr_conv;
43444         this_ptr_conv.inner = untag_ptr(this_ptr);
43445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43447         this_ptr_conv.is_owned = false;
43448         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
43449         return ret_conv;
43450 }
43451
43452 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) {
43453         LDKOpenChannelV2 this_ptr_conv;
43454         this_ptr_conv.inner = untag_ptr(this_ptr);
43455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43457         this_ptr_conv.is_owned = false;
43458         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
43459 }
43460
43461 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
43462         LDKOpenChannelV2 this_ptr_conv;
43463         this_ptr_conv.inner = untag_ptr(this_ptr);
43464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43466         this_ptr_conv.is_owned = false;
43467         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
43468         return ret_conv;
43469 }
43470
43471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43472         LDKOpenChannelV2 this_ptr_conv;
43473         this_ptr_conv.inner = untag_ptr(this_ptr);
43474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43476         this_ptr_conv.is_owned = false;
43477         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
43478 }
43479
43480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43481         LDKOpenChannelV2 this_ptr_conv;
43482         this_ptr_conv.inner = untag_ptr(this_ptr);
43483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43485         this_ptr_conv.is_owned = false;
43486         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
43487         return ret_conv;
43488 }
43489
43490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43491         LDKOpenChannelV2 this_ptr_conv;
43492         this_ptr_conv.inner = untag_ptr(this_ptr);
43493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43495         this_ptr_conv.is_owned = false;
43496         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
43497 }
43498
43499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43500         LDKOpenChannelV2 this_ptr_conv;
43501         this_ptr_conv.inner = untag_ptr(this_ptr);
43502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43504         this_ptr_conv.is_owned = false;
43505         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
43506         return ret_conv;
43507 }
43508
43509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43510         LDKOpenChannelV2 this_ptr_conv;
43511         this_ptr_conv.inner = untag_ptr(this_ptr);
43512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43514         this_ptr_conv.is_owned = false;
43515         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
43516 }
43517
43518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43519         LDKOpenChannelV2 this_ptr_conv;
43520         this_ptr_conv.inner = untag_ptr(this_ptr);
43521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43523         this_ptr_conv.is_owned = false;
43524         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
43525         return ret_conv;
43526 }
43527
43528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43529         LDKOpenChannelV2 this_ptr_conv;
43530         this_ptr_conv.inner = untag_ptr(this_ptr);
43531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43533         this_ptr_conv.is_owned = false;
43534         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43535 }
43536
43537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43538         LDKOpenChannelV2 this_ptr_conv;
43539         this_ptr_conv.inner = untag_ptr(this_ptr);
43540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43542         this_ptr_conv.is_owned = false;
43543         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
43544         return ret_conv;
43545 }
43546
43547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43548         LDKOpenChannelV2 this_ptr_conv;
43549         this_ptr_conv.inner = untag_ptr(this_ptr);
43550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43552         this_ptr_conv.is_owned = false;
43553         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
43554 }
43555
43556 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43557         LDKOpenChannelV2 this_ptr_conv;
43558         this_ptr_conv.inner = untag_ptr(this_ptr);
43559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43561         this_ptr_conv.is_owned = false;
43562         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
43563         return ret_conv;
43564 }
43565
43566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43567         LDKOpenChannelV2 this_ptr_conv;
43568         this_ptr_conv.inner = untag_ptr(this_ptr);
43569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43571         this_ptr_conv.is_owned = false;
43572         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
43573 }
43574
43575 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43576         LDKOpenChannelV2 this_ptr_conv;
43577         this_ptr_conv.inner = untag_ptr(this_ptr);
43578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43580         this_ptr_conv.is_owned = false;
43581         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
43582         return ret_conv;
43583 }
43584
43585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43586         LDKOpenChannelV2 this_ptr_conv;
43587         this_ptr_conv.inner = untag_ptr(this_ptr);
43588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43590         this_ptr_conv.is_owned = false;
43591         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
43592 }
43593
43594 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
43595         LDKOpenChannelV2 this_ptr_conv;
43596         this_ptr_conv.inner = untag_ptr(this_ptr);
43597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43599         this_ptr_conv.is_owned = false;
43600         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
43601         return ret_conv;
43602 }
43603
43604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43605         LDKOpenChannelV2 this_ptr_conv;
43606         this_ptr_conv.inner = untag_ptr(this_ptr);
43607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43609         this_ptr_conv.is_owned = false;
43610         OpenChannelV2_set_locktime(&this_ptr_conv, val);
43611 }
43612
43613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43614         LDKOpenChannelV2 this_ptr_conv;
43615         this_ptr_conv.inner = untag_ptr(this_ptr);
43616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43618         this_ptr_conv.is_owned = false;
43619         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43620         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
43621         return ret_arr;
43622 }
43623
43624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43625         LDKOpenChannelV2 this_ptr_conv;
43626         this_ptr_conv.inner = untag_ptr(this_ptr);
43627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43629         this_ptr_conv.is_owned = false;
43630         LDKPublicKey val_ref;
43631         CHECK((*env)->GetArrayLength(env, val) == 33);
43632         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43633         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
43634 }
43635
43636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43637         LDKOpenChannelV2 this_ptr_conv;
43638         this_ptr_conv.inner = untag_ptr(this_ptr);
43639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43641         this_ptr_conv.is_owned = false;
43642         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43643         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
43644         return ret_arr;
43645 }
43646
43647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43648         LDKOpenChannelV2 this_ptr_conv;
43649         this_ptr_conv.inner = untag_ptr(this_ptr);
43650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43652         this_ptr_conv.is_owned = false;
43653         LDKPublicKey val_ref;
43654         CHECK((*env)->GetArrayLength(env, val) == 33);
43655         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43656         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
43657 }
43658
43659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43660         LDKOpenChannelV2 this_ptr_conv;
43661         this_ptr_conv.inner = untag_ptr(this_ptr);
43662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43664         this_ptr_conv.is_owned = false;
43665         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43666         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
43667         return ret_arr;
43668 }
43669
43670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43671         LDKOpenChannelV2 this_ptr_conv;
43672         this_ptr_conv.inner = untag_ptr(this_ptr);
43673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43675         this_ptr_conv.is_owned = false;
43676         LDKPublicKey val_ref;
43677         CHECK((*env)->GetArrayLength(env, val) == 33);
43678         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43679         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43680 }
43681
43682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43683         LDKOpenChannelV2 this_ptr_conv;
43684         this_ptr_conv.inner = untag_ptr(this_ptr);
43685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43687         this_ptr_conv.is_owned = false;
43688         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43689         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
43690         return ret_arr;
43691 }
43692
43693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43694         LDKOpenChannelV2 this_ptr_conv;
43695         this_ptr_conv.inner = untag_ptr(this_ptr);
43696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43698         this_ptr_conv.is_owned = false;
43699         LDKPublicKey val_ref;
43700         CHECK((*env)->GetArrayLength(env, val) == 33);
43701         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43702         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43703 }
43704
43705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43706         LDKOpenChannelV2 this_ptr_conv;
43707         this_ptr_conv.inner = untag_ptr(this_ptr);
43708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43710         this_ptr_conv.is_owned = false;
43711         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43712         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
43713         return ret_arr;
43714 }
43715
43716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43717         LDKOpenChannelV2 this_ptr_conv;
43718         this_ptr_conv.inner = untag_ptr(this_ptr);
43719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43721         this_ptr_conv.is_owned = false;
43722         LDKPublicKey val_ref;
43723         CHECK((*env)->GetArrayLength(env, val) == 33);
43724         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43725         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
43726 }
43727
43728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43729         LDKOpenChannelV2 this_ptr_conv;
43730         this_ptr_conv.inner = untag_ptr(this_ptr);
43731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43733         this_ptr_conv.is_owned = false;
43734         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43735         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
43736         return ret_arr;
43737 }
43738
43739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43740         LDKOpenChannelV2 this_ptr_conv;
43741         this_ptr_conv.inner = untag_ptr(this_ptr);
43742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43744         this_ptr_conv.is_owned = false;
43745         LDKPublicKey val_ref;
43746         CHECK((*env)->GetArrayLength(env, val) == 33);
43747         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43748         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43749 }
43750
43751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
43752         LDKOpenChannelV2 this_ptr_conv;
43753         this_ptr_conv.inner = untag_ptr(this_ptr);
43754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43756         this_ptr_conv.is_owned = false;
43757         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43758         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
43759         return ret_arr;
43760 }
43761
43762 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) {
43763         LDKOpenChannelV2 this_ptr_conv;
43764         this_ptr_conv.inner = untag_ptr(this_ptr);
43765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43767         this_ptr_conv.is_owned = false;
43768         LDKPublicKey val_ref;
43769         CHECK((*env)->GetArrayLength(env, val) == 33);
43770         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43771         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
43772 }
43773
43774 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
43775         LDKOpenChannelV2 this_ptr_conv;
43776         this_ptr_conv.inner = untag_ptr(this_ptr);
43777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43779         this_ptr_conv.is_owned = false;
43780         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
43781         return ret_conv;
43782 }
43783
43784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
43785         LDKOpenChannelV2 this_ptr_conv;
43786         this_ptr_conv.inner = untag_ptr(this_ptr);
43787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43789         this_ptr_conv.is_owned = false;
43790         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
43791 }
43792
43793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43794         LDKOpenChannelV2 this_ptr_conv;
43795         this_ptr_conv.inner = untag_ptr(this_ptr);
43796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43798         this_ptr_conv.is_owned = false;
43799         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43800         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
43801         int64_t ret_ref = tag_ptr(ret_copy, true);
43802         return ret_ref;
43803 }
43804
43805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43806         LDKOpenChannelV2 this_ptr_conv;
43807         this_ptr_conv.inner = untag_ptr(this_ptr);
43808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43810         this_ptr_conv.is_owned = false;
43811         void* val_ptr = untag_ptr(val);
43812         CHECK_ACCESS(val_ptr);
43813         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43814         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43815         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43816 }
43817
43818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
43819         LDKOpenChannelV2 this_ptr_conv;
43820         this_ptr_conv.inner = untag_ptr(this_ptr);
43821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43823         this_ptr_conv.is_owned = false;
43824         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
43825         int64_t ret_ref = 0;
43826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43828         return ret_ref;
43829 }
43830
43831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43832         LDKOpenChannelV2 this_ptr_conv;
43833         this_ptr_conv.inner = untag_ptr(this_ptr);
43834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43836         this_ptr_conv.is_owned = false;
43837         LDKChannelTypeFeatures val_conv;
43838         val_conv.inner = untag_ptr(val);
43839         val_conv.is_owned = ptr_is_owned(val);
43840         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43841         val_conv = ChannelTypeFeatures_clone(&val_conv);
43842         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
43843 }
43844
43845 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43846         LDKOpenChannelV2 this_ptr_conv;
43847         this_ptr_conv.inner = untag_ptr(this_ptr);
43848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43850         this_ptr_conv.is_owned = false;
43851         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
43852         return ret_conv;
43853 }
43854
43855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
43856         LDKOpenChannelV2 this_ptr_conv;
43857         this_ptr_conv.inner = untag_ptr(this_ptr);
43858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43860         this_ptr_conv.is_owned = false;
43861         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
43862         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
43863 }
43864
43865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
43866         LDKThirtyTwoBytes chain_hash_arg_ref;
43867         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
43868         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
43869         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43870         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
43871         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
43872         LDKPublicKey funding_pubkey_arg_ref;
43873         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
43874         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
43875         LDKPublicKey revocation_basepoint_arg_ref;
43876         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
43877         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
43878         LDKPublicKey payment_basepoint_arg_ref;
43879         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
43880         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
43881         LDKPublicKey delayed_payment_basepoint_arg_ref;
43882         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
43883         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
43884         LDKPublicKey htlc_basepoint_arg_ref;
43885         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
43886         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
43887         LDKPublicKey first_per_commitment_point_arg_ref;
43888         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
43889         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
43890         LDKPublicKey second_per_commitment_point_arg_ref;
43891         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
43892         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
43893         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43894         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43895         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43896         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43897         LDKChannelTypeFeatures channel_type_arg_conv;
43898         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43899         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43900         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43901         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43902         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
43903         LDKOpenChannelV2 ret_var = OpenChannelV2_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
43904         int64_t ret_ref = 0;
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43907         return ret_ref;
43908 }
43909
43910 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
43911         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
43912         int64_t ret_ref = 0;
43913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43915         return ret_ref;
43916 }
43917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43918         LDKOpenChannelV2 arg_conv;
43919         arg_conv.inner = untag_ptr(arg);
43920         arg_conv.is_owned = ptr_is_owned(arg);
43921         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43922         arg_conv.is_owned = false;
43923         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
43924         return ret_conv;
43925 }
43926
43927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43928         LDKOpenChannelV2 orig_conv;
43929         orig_conv.inner = untag_ptr(orig);
43930         orig_conv.is_owned = ptr_is_owned(orig);
43931         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43932         orig_conv.is_owned = false;
43933         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
43934         int64_t ret_ref = 0;
43935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43937         return ret_ref;
43938 }
43939
43940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43941         LDKOpenChannelV2 a_conv;
43942         a_conv.inner = untag_ptr(a);
43943         a_conv.is_owned = ptr_is_owned(a);
43944         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43945         a_conv.is_owned = false;
43946         LDKOpenChannelV2 b_conv;
43947         b_conv.inner = untag_ptr(b);
43948         b_conv.is_owned = ptr_is_owned(b);
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43950         b_conv.is_owned = false;
43951         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
43952         return ret_conv;
43953 }
43954
43955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43956         LDKAcceptChannel this_obj_conv;
43957         this_obj_conv.inner = untag_ptr(this_obj);
43958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43960         AcceptChannel_free(this_obj_conv);
43961 }
43962
43963 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43964         LDKAcceptChannel this_ptr_conv;
43965         this_ptr_conv.inner = untag_ptr(this_ptr);
43966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43968         this_ptr_conv.is_owned = false;
43969         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43970         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
43971         return ret_arr;
43972 }
43973
43974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43975         LDKAcceptChannel this_ptr_conv;
43976         this_ptr_conv.inner = untag_ptr(this_ptr);
43977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43979         this_ptr_conv.is_owned = false;
43980         LDKThirtyTwoBytes val_ref;
43981         CHECK((*env)->GetArrayLength(env, val) == 32);
43982         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43983         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
43984 }
43985
43986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43987         LDKAcceptChannel this_ptr_conv;
43988         this_ptr_conv.inner = untag_ptr(this_ptr);
43989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43991         this_ptr_conv.is_owned = false;
43992         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
43993         return ret_conv;
43994 }
43995
43996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43997         LDKAcceptChannel 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         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
44003 }
44004
44005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44006         LDKAcceptChannel this_ptr_conv;
44007         this_ptr_conv.inner = untag_ptr(this_ptr);
44008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44010         this_ptr_conv.is_owned = false;
44011         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
44012         return ret_conv;
44013 }
44014
44015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44016         LDKAcceptChannel this_ptr_conv;
44017         this_ptr_conv.inner = untag_ptr(this_ptr);
44018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44020         this_ptr_conv.is_owned = false;
44021         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
44022 }
44023
44024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
44025         LDKAcceptChannel this_ptr_conv;
44026         this_ptr_conv.inner = untag_ptr(this_ptr);
44027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44029         this_ptr_conv.is_owned = false;
44030         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
44031         return ret_conv;
44032 }
44033
44034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44035         LDKAcceptChannel this_ptr_conv;
44036         this_ptr_conv.inner = untag_ptr(this_ptr);
44037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44039         this_ptr_conv.is_owned = false;
44040         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
44041 }
44042
44043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44044         LDKAcceptChannel this_ptr_conv;
44045         this_ptr_conv.inner = untag_ptr(this_ptr);
44046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44048         this_ptr_conv.is_owned = false;
44049         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
44050         return ret_conv;
44051 }
44052
44053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44054         LDKAcceptChannel this_ptr_conv;
44055         this_ptr_conv.inner = untag_ptr(this_ptr);
44056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44058         this_ptr_conv.is_owned = false;
44059         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
44060 }
44061
44062 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
44063         LDKAcceptChannel this_ptr_conv;
44064         this_ptr_conv.inner = untag_ptr(this_ptr);
44065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44067         this_ptr_conv.is_owned = false;
44068         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
44069         return ret_conv;
44070 }
44071
44072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44073         LDKAcceptChannel this_ptr_conv;
44074         this_ptr_conv.inner = untag_ptr(this_ptr);
44075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44077         this_ptr_conv.is_owned = false;
44078         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
44079 }
44080
44081 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
44082         LDKAcceptChannel this_ptr_conv;
44083         this_ptr_conv.inner = untag_ptr(this_ptr);
44084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44086         this_ptr_conv.is_owned = false;
44087         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
44088         return ret_conv;
44089 }
44090
44091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44092         LDKAcceptChannel this_ptr_conv;
44093         this_ptr_conv.inner = untag_ptr(this_ptr);
44094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44096         this_ptr_conv.is_owned = false;
44097         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
44098 }
44099
44100 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44101         LDKAcceptChannel this_ptr_conv;
44102         this_ptr_conv.inner = untag_ptr(this_ptr);
44103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44105         this_ptr_conv.is_owned = false;
44106         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
44107         return ret_conv;
44108 }
44109
44110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44111         LDKAcceptChannel this_ptr_conv;
44112         this_ptr_conv.inner = untag_ptr(this_ptr);
44113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44115         this_ptr_conv.is_owned = false;
44116         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
44117 }
44118
44119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44120         LDKAcceptChannel this_ptr_conv;
44121         this_ptr_conv.inner = untag_ptr(this_ptr);
44122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44124         this_ptr_conv.is_owned = false;
44125         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44126         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
44127         return ret_arr;
44128 }
44129
44130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44131         LDKAcceptChannel this_ptr_conv;
44132         this_ptr_conv.inner = untag_ptr(this_ptr);
44133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44135         this_ptr_conv.is_owned = false;
44136         LDKPublicKey val_ref;
44137         CHECK((*env)->GetArrayLength(env, val) == 33);
44138         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44139         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
44140 }
44141
44142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44143         LDKAcceptChannel this_ptr_conv;
44144         this_ptr_conv.inner = untag_ptr(this_ptr);
44145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44147         this_ptr_conv.is_owned = false;
44148         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44149         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
44150         return ret_arr;
44151 }
44152
44153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44154         LDKAcceptChannel this_ptr_conv;
44155         this_ptr_conv.inner = untag_ptr(this_ptr);
44156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44158         this_ptr_conv.is_owned = false;
44159         LDKPublicKey val_ref;
44160         CHECK((*env)->GetArrayLength(env, val) == 33);
44161         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44162         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
44163 }
44164
44165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44166         LDKAcceptChannel this_ptr_conv;
44167         this_ptr_conv.inner = untag_ptr(this_ptr);
44168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44170         this_ptr_conv.is_owned = false;
44171         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44172         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
44173         return ret_arr;
44174 }
44175
44176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44177         LDKAcceptChannel this_ptr_conv;
44178         this_ptr_conv.inner = untag_ptr(this_ptr);
44179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44181         this_ptr_conv.is_owned = false;
44182         LDKPublicKey val_ref;
44183         CHECK((*env)->GetArrayLength(env, val) == 33);
44184         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44185         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
44186 }
44187
44188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44189         LDKAcceptChannel this_ptr_conv;
44190         this_ptr_conv.inner = untag_ptr(this_ptr);
44191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44193         this_ptr_conv.is_owned = false;
44194         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44195         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
44196         return ret_arr;
44197 }
44198
44199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44200         LDKAcceptChannel this_ptr_conv;
44201         this_ptr_conv.inner = untag_ptr(this_ptr);
44202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44204         this_ptr_conv.is_owned = false;
44205         LDKPublicKey val_ref;
44206         CHECK((*env)->GetArrayLength(env, val) == 33);
44207         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44208         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
44209 }
44210
44211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44212         LDKAcceptChannel this_ptr_conv;
44213         this_ptr_conv.inner = untag_ptr(this_ptr);
44214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44216         this_ptr_conv.is_owned = false;
44217         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44218         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
44219         return ret_arr;
44220 }
44221
44222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44223         LDKAcceptChannel this_ptr_conv;
44224         this_ptr_conv.inner = untag_ptr(this_ptr);
44225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44227         this_ptr_conv.is_owned = false;
44228         LDKPublicKey val_ref;
44229         CHECK((*env)->GetArrayLength(env, val) == 33);
44230         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44231         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
44232 }
44233
44234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44235         LDKAcceptChannel this_ptr_conv;
44236         this_ptr_conv.inner = untag_ptr(this_ptr);
44237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44239         this_ptr_conv.is_owned = false;
44240         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44241         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
44242         return ret_arr;
44243 }
44244
44245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44246         LDKAcceptChannel this_ptr_conv;
44247         this_ptr_conv.inner = untag_ptr(this_ptr);
44248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44250         this_ptr_conv.is_owned = false;
44251         LDKPublicKey val_ref;
44252         CHECK((*env)->GetArrayLength(env, val) == 33);
44253         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44254         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
44255 }
44256
44257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44258         LDKAcceptChannel this_ptr_conv;
44259         this_ptr_conv.inner = untag_ptr(this_ptr);
44260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44262         this_ptr_conv.is_owned = false;
44263         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
44264         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
44265         int64_t ret_ref = tag_ptr(ret_copy, true);
44266         return ret_ref;
44267 }
44268
44269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44270         LDKAcceptChannel this_ptr_conv;
44271         this_ptr_conv.inner = untag_ptr(this_ptr);
44272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44274         this_ptr_conv.is_owned = false;
44275         void* val_ptr = untag_ptr(val);
44276         CHECK_ACCESS(val_ptr);
44277         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
44278         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
44279         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
44280 }
44281
44282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
44283         LDKAcceptChannel this_ptr_conv;
44284         this_ptr_conv.inner = untag_ptr(this_ptr);
44285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44287         this_ptr_conv.is_owned = false;
44288         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
44289         int64_t ret_ref = 0;
44290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44292         return ret_ref;
44293 }
44294
44295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44296         LDKAcceptChannel this_ptr_conv;
44297         this_ptr_conv.inner = untag_ptr(this_ptr);
44298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44300         this_ptr_conv.is_owned = false;
44301         LDKChannelTypeFeatures val_conv;
44302         val_conv.inner = untag_ptr(val);
44303         val_conv.is_owned = ptr_is_owned(val);
44304         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44305         val_conv = ChannelTypeFeatures_clone(&val_conv);
44306         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
44307 }
44308
44309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
44310         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44311         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44312         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44313         LDKPublicKey funding_pubkey_arg_ref;
44314         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
44315         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
44316         LDKPublicKey revocation_basepoint_arg_ref;
44317         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
44318         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
44319         LDKPublicKey payment_point_arg_ref;
44320         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
44321         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
44322         LDKPublicKey delayed_payment_basepoint_arg_ref;
44323         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
44324         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
44325         LDKPublicKey htlc_basepoint_arg_ref;
44326         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
44327         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
44328         LDKPublicKey first_per_commitment_point_arg_ref;
44329         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
44330         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
44331         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
44332         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
44333         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
44334         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
44335         LDKChannelTypeFeatures channel_type_arg_conv;
44336         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
44337         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
44338         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
44339         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
44340         LDKAcceptChannel ret_var = AcceptChannel_new(temporary_channel_id_arg_ref, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
44341         int64_t ret_ref = 0;
44342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44344         return ret_ref;
44345 }
44346
44347 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
44348         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
44349         int64_t ret_ref = 0;
44350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44352         return ret_ref;
44353 }
44354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44355         LDKAcceptChannel arg_conv;
44356         arg_conv.inner = untag_ptr(arg);
44357         arg_conv.is_owned = ptr_is_owned(arg);
44358         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44359         arg_conv.is_owned = false;
44360         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
44361         return ret_conv;
44362 }
44363
44364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44365         LDKAcceptChannel orig_conv;
44366         orig_conv.inner = untag_ptr(orig);
44367         orig_conv.is_owned = ptr_is_owned(orig);
44368         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44369         orig_conv.is_owned = false;
44370         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
44371         int64_t ret_ref = 0;
44372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44374         return ret_ref;
44375 }
44376
44377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44378         LDKAcceptChannel a_conv;
44379         a_conv.inner = untag_ptr(a);
44380         a_conv.is_owned = ptr_is_owned(a);
44381         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44382         a_conv.is_owned = false;
44383         LDKAcceptChannel b_conv;
44384         b_conv.inner = untag_ptr(b);
44385         b_conv.is_owned = ptr_is_owned(b);
44386         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44387         b_conv.is_owned = false;
44388         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
44389         return ret_conv;
44390 }
44391
44392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44393         LDKAcceptChannelV2 this_obj_conv;
44394         this_obj_conv.inner = untag_ptr(this_obj);
44395         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44397         AcceptChannelV2_free(this_obj_conv);
44398 }
44399
44400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44401         LDKAcceptChannelV2 this_ptr_conv;
44402         this_ptr_conv.inner = untag_ptr(this_ptr);
44403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44405         this_ptr_conv.is_owned = false;
44406         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44407         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv));
44408         return ret_arr;
44409 }
44410
44411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44412         LDKAcceptChannelV2 this_ptr_conv;
44413         this_ptr_conv.inner = untag_ptr(this_ptr);
44414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44416         this_ptr_conv.is_owned = false;
44417         LDKThirtyTwoBytes val_ref;
44418         CHECK((*env)->GetArrayLength(env, val) == 32);
44419         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44420         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
44421 }
44422
44423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
44424         LDKAcceptChannelV2 this_ptr_conv;
44425         this_ptr_conv.inner = untag_ptr(this_ptr);
44426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44428         this_ptr_conv.is_owned = false;
44429         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
44430         return ret_conv;
44431 }
44432
44433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44434         LDKAcceptChannelV2 this_ptr_conv;
44435         this_ptr_conv.inner = untag_ptr(this_ptr);
44436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44438         this_ptr_conv.is_owned = false;
44439         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
44440 }
44441
44442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
44443         LDKAcceptChannelV2 this_ptr_conv;
44444         this_ptr_conv.inner = untag_ptr(this_ptr);
44445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44447         this_ptr_conv.is_owned = false;
44448         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
44449         return ret_conv;
44450 }
44451
44452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44453         LDKAcceptChannelV2 this_ptr_conv;
44454         this_ptr_conv.inner = untag_ptr(this_ptr);
44455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44457         this_ptr_conv.is_owned = false;
44458         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
44459 }
44460
44461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44462         LDKAcceptChannelV2 this_ptr_conv;
44463         this_ptr_conv.inner = untag_ptr(this_ptr);
44464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44466         this_ptr_conv.is_owned = false;
44467         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
44468         return ret_conv;
44469 }
44470
44471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44472         LDKAcceptChannelV2 this_ptr_conv;
44473         this_ptr_conv.inner = untag_ptr(this_ptr);
44474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44476         this_ptr_conv.is_owned = false;
44477         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
44478 }
44479
44480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44481         LDKAcceptChannelV2 this_ptr_conv;
44482         this_ptr_conv.inner = untag_ptr(this_ptr);
44483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44485         this_ptr_conv.is_owned = false;
44486         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
44487         return ret_conv;
44488 }
44489
44490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44491         LDKAcceptChannelV2 this_ptr_conv;
44492         this_ptr_conv.inner = untag_ptr(this_ptr);
44493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44495         this_ptr_conv.is_owned = false;
44496         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
44497 }
44498
44499 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
44500         LDKAcceptChannelV2 this_ptr_conv;
44501         this_ptr_conv.inner = untag_ptr(this_ptr);
44502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44504         this_ptr_conv.is_owned = false;
44505         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
44506         return ret_conv;
44507 }
44508
44509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44510         LDKAcceptChannelV2 this_ptr_conv;
44511         this_ptr_conv.inner = untag_ptr(this_ptr);
44512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44514         this_ptr_conv.is_owned = false;
44515         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
44516 }
44517
44518 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
44519         LDKAcceptChannelV2 this_ptr_conv;
44520         this_ptr_conv.inner = untag_ptr(this_ptr);
44521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44523         this_ptr_conv.is_owned = false;
44524         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
44525         return ret_conv;
44526 }
44527
44528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44529         LDKAcceptChannelV2 this_ptr_conv;
44530         this_ptr_conv.inner = untag_ptr(this_ptr);
44531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44533         this_ptr_conv.is_owned = false;
44534         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
44535 }
44536
44537 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44538         LDKAcceptChannelV2 this_ptr_conv;
44539         this_ptr_conv.inner = untag_ptr(this_ptr);
44540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44542         this_ptr_conv.is_owned = false;
44543         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
44544         return ret_conv;
44545 }
44546
44547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44548         LDKAcceptChannelV2 this_ptr_conv;
44549         this_ptr_conv.inner = untag_ptr(this_ptr);
44550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44552         this_ptr_conv.is_owned = false;
44553         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
44554 }
44555
44556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44557         LDKAcceptChannelV2 this_ptr_conv;
44558         this_ptr_conv.inner = untag_ptr(this_ptr);
44559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44561         this_ptr_conv.is_owned = false;
44562         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44563         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
44564         return ret_arr;
44565 }
44566
44567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44568         LDKAcceptChannelV2 this_ptr_conv;
44569         this_ptr_conv.inner = untag_ptr(this_ptr);
44570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44572         this_ptr_conv.is_owned = false;
44573         LDKPublicKey val_ref;
44574         CHECK((*env)->GetArrayLength(env, val) == 33);
44575         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44576         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
44577 }
44578
44579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44580         LDKAcceptChannelV2 this_ptr_conv;
44581         this_ptr_conv.inner = untag_ptr(this_ptr);
44582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44584         this_ptr_conv.is_owned = false;
44585         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44586         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
44587         return ret_arr;
44588 }
44589
44590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44591         LDKAcceptChannelV2 this_ptr_conv;
44592         this_ptr_conv.inner = untag_ptr(this_ptr);
44593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44595         this_ptr_conv.is_owned = false;
44596         LDKPublicKey val_ref;
44597         CHECK((*env)->GetArrayLength(env, val) == 33);
44598         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44599         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
44600 }
44601
44602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44603         LDKAcceptChannelV2 this_ptr_conv;
44604         this_ptr_conv.inner = untag_ptr(this_ptr);
44605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44607         this_ptr_conv.is_owned = false;
44608         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44609         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
44610         return ret_arr;
44611 }
44612
44613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44614         LDKAcceptChannelV2 this_ptr_conv;
44615         this_ptr_conv.inner = untag_ptr(this_ptr);
44616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44618         this_ptr_conv.is_owned = false;
44619         LDKPublicKey val_ref;
44620         CHECK((*env)->GetArrayLength(env, val) == 33);
44621         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44622         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
44623 }
44624
44625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44626         LDKAcceptChannelV2 this_ptr_conv;
44627         this_ptr_conv.inner = untag_ptr(this_ptr);
44628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44630         this_ptr_conv.is_owned = false;
44631         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44632         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
44633         return ret_arr;
44634 }
44635
44636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44637         LDKAcceptChannelV2 this_ptr_conv;
44638         this_ptr_conv.inner = untag_ptr(this_ptr);
44639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44641         this_ptr_conv.is_owned = false;
44642         LDKPublicKey val_ref;
44643         CHECK((*env)->GetArrayLength(env, val) == 33);
44644         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44645         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
44646 }
44647
44648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
44649         LDKAcceptChannelV2 this_ptr_conv;
44650         this_ptr_conv.inner = untag_ptr(this_ptr);
44651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44653         this_ptr_conv.is_owned = false;
44654         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44655         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
44656         return ret_arr;
44657 }
44658
44659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44660         LDKAcceptChannelV2 this_ptr_conv;
44661         this_ptr_conv.inner = untag_ptr(this_ptr);
44662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44664         this_ptr_conv.is_owned = false;
44665         LDKPublicKey val_ref;
44666         CHECK((*env)->GetArrayLength(env, val) == 33);
44667         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44668         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
44669 }
44670
44671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44672         LDKAcceptChannelV2 this_ptr_conv;
44673         this_ptr_conv.inner = untag_ptr(this_ptr);
44674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44676         this_ptr_conv.is_owned = false;
44677         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44678         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
44679         return ret_arr;
44680 }
44681
44682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44683         LDKAcceptChannelV2 this_ptr_conv;
44684         this_ptr_conv.inner = untag_ptr(this_ptr);
44685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44687         this_ptr_conv.is_owned = false;
44688         LDKPublicKey val_ref;
44689         CHECK((*env)->GetArrayLength(env, val) == 33);
44690         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44691         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
44692 }
44693
44694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44695         LDKAcceptChannelV2 this_ptr_conv;
44696         this_ptr_conv.inner = untag_ptr(this_ptr);
44697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44699         this_ptr_conv.is_owned = false;
44700         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44701         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
44702         return ret_arr;
44703 }
44704
44705 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) {
44706         LDKAcceptChannelV2 this_ptr_conv;
44707         this_ptr_conv.inner = untag_ptr(this_ptr);
44708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44710         this_ptr_conv.is_owned = false;
44711         LDKPublicKey val_ref;
44712         CHECK((*env)->GetArrayLength(env, val) == 33);
44713         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44714         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
44715 }
44716
44717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
44718         LDKAcceptChannelV2 this_ptr_conv;
44719         this_ptr_conv.inner = untag_ptr(this_ptr);
44720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44722         this_ptr_conv.is_owned = false;
44723         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
44724         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
44725         int64_t ret_ref = tag_ptr(ret_copy, true);
44726         return ret_ref;
44727 }
44728
44729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44730         LDKAcceptChannelV2 this_ptr_conv;
44731         this_ptr_conv.inner = untag_ptr(this_ptr);
44732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44734         this_ptr_conv.is_owned = false;
44735         void* val_ptr = untag_ptr(val);
44736         CHECK_ACCESS(val_ptr);
44737         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
44738         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
44739         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
44740 }
44741
44742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
44743         LDKAcceptChannelV2 this_ptr_conv;
44744         this_ptr_conv.inner = untag_ptr(this_ptr);
44745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44747         this_ptr_conv.is_owned = false;
44748         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
44749         int64_t ret_ref = 0;
44750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44752         return ret_ref;
44753 }
44754
44755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44756         LDKAcceptChannelV2 this_ptr_conv;
44757         this_ptr_conv.inner = untag_ptr(this_ptr);
44758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44760         this_ptr_conv.is_owned = false;
44761         LDKChannelTypeFeatures val_conv;
44762         val_conv.inner = untag_ptr(val);
44763         val_conv.is_owned = ptr_is_owned(val);
44764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44765         val_conv = ChannelTypeFeatures_clone(&val_conv);
44766         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
44767 }
44768
44769 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
44770         LDKAcceptChannelV2 this_ptr_conv;
44771         this_ptr_conv.inner = untag_ptr(this_ptr);
44772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44774         this_ptr_conv.is_owned = false;
44775         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
44776         return ret_conv;
44777 }
44778
44779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
44780         LDKAcceptChannelV2 this_ptr_conv;
44781         this_ptr_conv.inner = untag_ptr(this_ptr);
44782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44784         this_ptr_conv.is_owned = false;
44785         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
44786         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
44787 }
44788
44789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
44790         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44791         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44792         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44793         LDKPublicKey funding_pubkey_arg_ref;
44794         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
44795         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
44796         LDKPublicKey revocation_basepoint_arg_ref;
44797         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
44798         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
44799         LDKPublicKey payment_basepoint_arg_ref;
44800         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
44801         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
44802         LDKPublicKey delayed_payment_basepoint_arg_ref;
44803         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
44804         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
44805         LDKPublicKey htlc_basepoint_arg_ref;
44806         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
44807         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
44808         LDKPublicKey first_per_commitment_point_arg_ref;
44809         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
44810         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
44811         LDKPublicKey second_per_commitment_point_arg_ref;
44812         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
44813         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
44814         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
44815         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
44816         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
44817         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
44818         LDKChannelTypeFeatures channel_type_arg_conv;
44819         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
44820         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
44821         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
44822         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
44823         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
44824         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(temporary_channel_id_arg_ref, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
44825         int64_t ret_ref = 0;
44826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44828         return ret_ref;
44829 }
44830
44831 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
44832         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
44833         int64_t ret_ref = 0;
44834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44836         return ret_ref;
44837 }
44838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44839         LDKAcceptChannelV2 arg_conv;
44840         arg_conv.inner = untag_ptr(arg);
44841         arg_conv.is_owned = ptr_is_owned(arg);
44842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44843         arg_conv.is_owned = false;
44844         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
44845         return ret_conv;
44846 }
44847
44848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44849         LDKAcceptChannelV2 orig_conv;
44850         orig_conv.inner = untag_ptr(orig);
44851         orig_conv.is_owned = ptr_is_owned(orig);
44852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44853         orig_conv.is_owned = false;
44854         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
44855         int64_t ret_ref = 0;
44856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44858         return ret_ref;
44859 }
44860
44861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44862         LDKAcceptChannelV2 a_conv;
44863         a_conv.inner = untag_ptr(a);
44864         a_conv.is_owned = ptr_is_owned(a);
44865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44866         a_conv.is_owned = false;
44867         LDKAcceptChannelV2 b_conv;
44868         b_conv.inner = untag_ptr(b);
44869         b_conv.is_owned = ptr_is_owned(b);
44870         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44871         b_conv.is_owned = false;
44872         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
44873         return ret_conv;
44874 }
44875
44876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44877         LDKFundingCreated this_obj_conv;
44878         this_obj_conv.inner = untag_ptr(this_obj);
44879         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44881         FundingCreated_free(this_obj_conv);
44882 }
44883
44884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44885         LDKFundingCreated this_ptr_conv;
44886         this_ptr_conv.inner = untag_ptr(this_ptr);
44887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44889         this_ptr_conv.is_owned = false;
44890         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44891         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
44892         return ret_arr;
44893 }
44894
44895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44896         LDKFundingCreated this_ptr_conv;
44897         this_ptr_conv.inner = untag_ptr(this_ptr);
44898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44900         this_ptr_conv.is_owned = false;
44901         LDKThirtyTwoBytes val_ref;
44902         CHECK((*env)->GetArrayLength(env, val) == 32);
44903         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44904         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
44905 }
44906
44907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
44908         LDKFundingCreated this_ptr_conv;
44909         this_ptr_conv.inner = untag_ptr(this_ptr);
44910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44912         this_ptr_conv.is_owned = false;
44913         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44914         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
44915         return ret_arr;
44916 }
44917
44918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44919         LDKFundingCreated this_ptr_conv;
44920         this_ptr_conv.inner = untag_ptr(this_ptr);
44921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44923         this_ptr_conv.is_owned = false;
44924         LDKThirtyTwoBytes val_ref;
44925         CHECK((*env)->GetArrayLength(env, val) == 32);
44926         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44927         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
44928 }
44929
44930 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
44931         LDKFundingCreated this_ptr_conv;
44932         this_ptr_conv.inner = untag_ptr(this_ptr);
44933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44935         this_ptr_conv.is_owned = false;
44936         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
44937         return ret_conv;
44938 }
44939
44940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44941         LDKFundingCreated this_ptr_conv;
44942         this_ptr_conv.inner = untag_ptr(this_ptr);
44943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44945         this_ptr_conv.is_owned = false;
44946         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
44947 }
44948
44949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
44950         LDKFundingCreated this_ptr_conv;
44951         this_ptr_conv.inner = untag_ptr(this_ptr);
44952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44954         this_ptr_conv.is_owned = false;
44955         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44956         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
44957         return ret_arr;
44958 }
44959
44960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44961         LDKFundingCreated this_ptr_conv;
44962         this_ptr_conv.inner = untag_ptr(this_ptr);
44963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44965         this_ptr_conv.is_owned = false;
44966         LDKECDSASignature val_ref;
44967         CHECK((*env)->GetArrayLength(env, val) == 64);
44968         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
44969         FundingCreated_set_signature(&this_ptr_conv, val_ref);
44970 }
44971
44972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
44973         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
44974         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
44975         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
44976         LDKThirtyTwoBytes funding_txid_arg_ref;
44977         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
44978         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
44979         LDKECDSASignature signature_arg_ref;
44980         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
44981         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
44982         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
44983         int64_t ret_ref = 0;
44984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44986         return ret_ref;
44987 }
44988
44989 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
44990         LDKFundingCreated ret_var = FundingCreated_clone(arg);
44991         int64_t ret_ref = 0;
44992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44994         return ret_ref;
44995 }
44996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44997         LDKFundingCreated arg_conv;
44998         arg_conv.inner = untag_ptr(arg);
44999         arg_conv.is_owned = ptr_is_owned(arg);
45000         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45001         arg_conv.is_owned = false;
45002         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
45003         return ret_conv;
45004 }
45005
45006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45007         LDKFundingCreated orig_conv;
45008         orig_conv.inner = untag_ptr(orig);
45009         orig_conv.is_owned = ptr_is_owned(orig);
45010         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45011         orig_conv.is_owned = false;
45012         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
45013         int64_t ret_ref = 0;
45014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45016         return ret_ref;
45017 }
45018
45019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45020         LDKFundingCreated a_conv;
45021         a_conv.inner = untag_ptr(a);
45022         a_conv.is_owned = ptr_is_owned(a);
45023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45024         a_conv.is_owned = false;
45025         LDKFundingCreated b_conv;
45026         b_conv.inner = untag_ptr(b);
45027         b_conv.is_owned = ptr_is_owned(b);
45028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45029         b_conv.is_owned = false;
45030         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
45031         return ret_conv;
45032 }
45033
45034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45035         LDKFundingSigned this_obj_conv;
45036         this_obj_conv.inner = untag_ptr(this_obj);
45037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45039         FundingSigned_free(this_obj_conv);
45040 }
45041
45042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45043         LDKFundingSigned this_ptr_conv;
45044         this_ptr_conv.inner = untag_ptr(this_ptr);
45045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45047         this_ptr_conv.is_owned = false;
45048         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45049         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
45050         return ret_arr;
45051 }
45052
45053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45054         LDKFundingSigned this_ptr_conv;
45055         this_ptr_conv.inner = untag_ptr(this_ptr);
45056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45058         this_ptr_conv.is_owned = false;
45059         LDKThirtyTwoBytes val_ref;
45060         CHECK((*env)->GetArrayLength(env, val) == 32);
45061         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45062         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
45063 }
45064
45065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
45066         LDKFundingSigned this_ptr_conv;
45067         this_ptr_conv.inner = untag_ptr(this_ptr);
45068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45070         this_ptr_conv.is_owned = false;
45071         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
45072         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
45073         return ret_arr;
45074 }
45075
45076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45077         LDKFundingSigned this_ptr_conv;
45078         this_ptr_conv.inner = untag_ptr(this_ptr);
45079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45081         this_ptr_conv.is_owned = false;
45082         LDKECDSASignature val_ref;
45083         CHECK((*env)->GetArrayLength(env, val) == 64);
45084         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
45085         FundingSigned_set_signature(&this_ptr_conv, val_ref);
45086 }
45087
45088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
45089         LDKThirtyTwoBytes channel_id_arg_ref;
45090         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45091         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45092         LDKECDSASignature signature_arg_ref;
45093         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
45094         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
45095         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
45096         int64_t ret_ref = 0;
45097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45099         return ret_ref;
45100 }
45101
45102 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
45103         LDKFundingSigned ret_var = FundingSigned_clone(arg);
45104         int64_t ret_ref = 0;
45105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45107         return ret_ref;
45108 }
45109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45110         LDKFundingSigned arg_conv;
45111         arg_conv.inner = untag_ptr(arg);
45112         arg_conv.is_owned = ptr_is_owned(arg);
45113         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45114         arg_conv.is_owned = false;
45115         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
45116         return ret_conv;
45117 }
45118
45119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45120         LDKFundingSigned orig_conv;
45121         orig_conv.inner = untag_ptr(orig);
45122         orig_conv.is_owned = ptr_is_owned(orig);
45123         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45124         orig_conv.is_owned = false;
45125         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
45126         int64_t ret_ref = 0;
45127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45129         return ret_ref;
45130 }
45131
45132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45133         LDKFundingSigned a_conv;
45134         a_conv.inner = untag_ptr(a);
45135         a_conv.is_owned = ptr_is_owned(a);
45136         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45137         a_conv.is_owned = false;
45138         LDKFundingSigned b_conv;
45139         b_conv.inner = untag_ptr(b);
45140         b_conv.is_owned = ptr_is_owned(b);
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45142         b_conv.is_owned = false;
45143         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
45144         return ret_conv;
45145 }
45146
45147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45148         LDKChannelReady this_obj_conv;
45149         this_obj_conv.inner = untag_ptr(this_obj);
45150         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45152         ChannelReady_free(this_obj_conv);
45153 }
45154
45155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45156         LDKChannelReady this_ptr_conv;
45157         this_ptr_conv.inner = untag_ptr(this_ptr);
45158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45160         this_ptr_conv.is_owned = false;
45161         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45162         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
45163         return ret_arr;
45164 }
45165
45166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45167         LDKChannelReady this_ptr_conv;
45168         this_ptr_conv.inner = untag_ptr(this_ptr);
45169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45171         this_ptr_conv.is_owned = false;
45172         LDKThirtyTwoBytes val_ref;
45173         CHECK((*env)->GetArrayLength(env, val) == 32);
45174         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45175         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
45176 }
45177
45178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
45179         LDKChannelReady this_ptr_conv;
45180         this_ptr_conv.inner = untag_ptr(this_ptr);
45181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45183         this_ptr_conv.is_owned = false;
45184         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45185         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
45186         return ret_arr;
45187 }
45188
45189 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) {
45190         LDKChannelReady this_ptr_conv;
45191         this_ptr_conv.inner = untag_ptr(this_ptr);
45192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45194         this_ptr_conv.is_owned = false;
45195         LDKPublicKey val_ref;
45196         CHECK((*env)->GetArrayLength(env, val) == 33);
45197         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45198         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
45199 }
45200
45201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
45202         LDKChannelReady this_ptr_conv;
45203         this_ptr_conv.inner = untag_ptr(this_ptr);
45204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45206         this_ptr_conv.is_owned = false;
45207         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45208         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
45209         int64_t ret_ref = tag_ptr(ret_copy, true);
45210         return ret_ref;
45211 }
45212
45213 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) {
45214         LDKChannelReady this_ptr_conv;
45215         this_ptr_conv.inner = untag_ptr(this_ptr);
45216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45218         this_ptr_conv.is_owned = false;
45219         void* val_ptr = untag_ptr(val);
45220         CHECK_ACCESS(val_ptr);
45221         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45222         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45223         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
45224 }
45225
45226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
45227         LDKThirtyTwoBytes channel_id_arg_ref;
45228         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45229         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45230         LDKPublicKey next_per_commitment_point_arg_ref;
45231         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
45232         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
45233         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
45234         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
45235         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
45236         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
45237         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
45238         int64_t ret_ref = 0;
45239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45241         return ret_ref;
45242 }
45243
45244 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
45245         LDKChannelReady ret_var = ChannelReady_clone(arg);
45246         int64_t ret_ref = 0;
45247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45249         return ret_ref;
45250 }
45251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45252         LDKChannelReady arg_conv;
45253         arg_conv.inner = untag_ptr(arg);
45254         arg_conv.is_owned = ptr_is_owned(arg);
45255         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45256         arg_conv.is_owned = false;
45257         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
45258         return ret_conv;
45259 }
45260
45261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45262         LDKChannelReady orig_conv;
45263         orig_conv.inner = untag_ptr(orig);
45264         orig_conv.is_owned = ptr_is_owned(orig);
45265         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45266         orig_conv.is_owned = false;
45267         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
45268         int64_t ret_ref = 0;
45269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45271         return ret_ref;
45272 }
45273
45274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45275         LDKChannelReady a_conv;
45276         a_conv.inner = untag_ptr(a);
45277         a_conv.is_owned = ptr_is_owned(a);
45278         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45279         a_conv.is_owned = false;
45280         LDKChannelReady b_conv;
45281         b_conv.inner = untag_ptr(b);
45282         b_conv.is_owned = ptr_is_owned(b);
45283         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45284         b_conv.is_owned = false;
45285         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
45286         return ret_conv;
45287 }
45288
45289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45290         LDKTxAddInput this_obj_conv;
45291         this_obj_conv.inner = untag_ptr(this_obj);
45292         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45294         TxAddInput_free(this_obj_conv);
45295 }
45296
45297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45298         LDKTxAddInput this_ptr_conv;
45299         this_ptr_conv.inner = untag_ptr(this_ptr);
45300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45302         this_ptr_conv.is_owned = false;
45303         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45304         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddInput_get_channel_id(&this_ptr_conv));
45305         return ret_arr;
45306 }
45307
45308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45309         LDKTxAddInput this_ptr_conv;
45310         this_ptr_conv.inner = untag_ptr(this_ptr);
45311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45313         this_ptr_conv.is_owned = false;
45314         LDKThirtyTwoBytes val_ref;
45315         CHECK((*env)->GetArrayLength(env, val) == 32);
45316         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45317         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
45318 }
45319
45320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45321         LDKTxAddInput this_ptr_conv;
45322         this_ptr_conv.inner = untag_ptr(this_ptr);
45323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45325         this_ptr_conv.is_owned = false;
45326         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
45327         return ret_conv;
45328 }
45329
45330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45331         LDKTxAddInput this_ptr_conv;
45332         this_ptr_conv.inner = untag_ptr(this_ptr);
45333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45335         this_ptr_conv.is_owned = false;
45336         TxAddInput_set_serial_id(&this_ptr_conv, val);
45337 }
45338
45339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
45340         LDKTxAddInput this_ptr_conv;
45341         this_ptr_conv.inner = untag_ptr(this_ptr);
45342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45344         this_ptr_conv.is_owned = false;
45345         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
45346         int64_t ret_ref = 0;
45347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45349         return ret_ref;
45350 }
45351
45352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45353         LDKTxAddInput this_ptr_conv;
45354         this_ptr_conv.inner = untag_ptr(this_ptr);
45355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45357         this_ptr_conv.is_owned = false;
45358         LDKTransactionU16LenLimited val_conv;
45359         val_conv.inner = untag_ptr(val);
45360         val_conv.is_owned = ptr_is_owned(val);
45361         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45362         val_conv = TransactionU16LenLimited_clone(&val_conv);
45363         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
45364 }
45365
45366 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
45367         LDKTxAddInput this_ptr_conv;
45368         this_ptr_conv.inner = untag_ptr(this_ptr);
45369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45371         this_ptr_conv.is_owned = false;
45372         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
45373         return ret_conv;
45374 }
45375
45376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45377         LDKTxAddInput this_ptr_conv;
45378         this_ptr_conv.inner = untag_ptr(this_ptr);
45379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45381         this_ptr_conv.is_owned = false;
45382         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
45383 }
45384
45385 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
45386         LDKTxAddInput this_ptr_conv;
45387         this_ptr_conv.inner = untag_ptr(this_ptr);
45388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45390         this_ptr_conv.is_owned = false;
45391         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
45392         return ret_conv;
45393 }
45394
45395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45396         LDKTxAddInput this_ptr_conv;
45397         this_ptr_conv.inner = untag_ptr(this_ptr);
45398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45400         this_ptr_conv.is_owned = false;
45401         TxAddInput_set_sequence(&this_ptr_conv, val);
45402 }
45403
45404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
45405         LDKThirtyTwoBytes channel_id_arg_ref;
45406         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45407         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45408         LDKTransactionU16LenLimited prevtx_arg_conv;
45409         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
45410         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
45411         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
45412         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
45413         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
45414         int64_t ret_ref = 0;
45415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45417         return ret_ref;
45418 }
45419
45420 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
45421         LDKTxAddInput ret_var = TxAddInput_clone(arg);
45422         int64_t ret_ref = 0;
45423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45425         return ret_ref;
45426 }
45427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45428         LDKTxAddInput arg_conv;
45429         arg_conv.inner = untag_ptr(arg);
45430         arg_conv.is_owned = ptr_is_owned(arg);
45431         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45432         arg_conv.is_owned = false;
45433         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
45434         return ret_conv;
45435 }
45436
45437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45438         LDKTxAddInput orig_conv;
45439         orig_conv.inner = untag_ptr(orig);
45440         orig_conv.is_owned = ptr_is_owned(orig);
45441         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45442         orig_conv.is_owned = false;
45443         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
45444         int64_t ret_ref = 0;
45445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45447         return ret_ref;
45448 }
45449
45450 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45451         LDKTxAddInput a_conv;
45452         a_conv.inner = untag_ptr(a);
45453         a_conv.is_owned = ptr_is_owned(a);
45454         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45455         a_conv.is_owned = false;
45456         LDKTxAddInput b_conv;
45457         b_conv.inner = untag_ptr(b);
45458         b_conv.is_owned = ptr_is_owned(b);
45459         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45460         b_conv.is_owned = false;
45461         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
45462         return ret_conv;
45463 }
45464
45465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45466         LDKTxAddOutput this_obj_conv;
45467         this_obj_conv.inner = untag_ptr(this_obj);
45468         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45470         TxAddOutput_free(this_obj_conv);
45471 }
45472
45473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45474         LDKTxAddOutput this_ptr_conv;
45475         this_ptr_conv.inner = untag_ptr(this_ptr);
45476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45478         this_ptr_conv.is_owned = false;
45479         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45480         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddOutput_get_channel_id(&this_ptr_conv));
45481         return ret_arr;
45482 }
45483
45484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45485         LDKTxAddOutput this_ptr_conv;
45486         this_ptr_conv.inner = untag_ptr(this_ptr);
45487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45489         this_ptr_conv.is_owned = false;
45490         LDKThirtyTwoBytes val_ref;
45491         CHECK((*env)->GetArrayLength(env, val) == 32);
45492         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45493         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
45494 }
45495
45496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45497         LDKTxAddOutput this_ptr_conv;
45498         this_ptr_conv.inner = untag_ptr(this_ptr);
45499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45501         this_ptr_conv.is_owned = false;
45502         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
45503         return ret_conv;
45504 }
45505
45506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45507         LDKTxAddOutput this_ptr_conv;
45508         this_ptr_conv.inner = untag_ptr(this_ptr);
45509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45511         this_ptr_conv.is_owned = false;
45512         TxAddOutput_set_serial_id(&this_ptr_conv, val);
45513 }
45514
45515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
45516         LDKTxAddOutput this_ptr_conv;
45517         this_ptr_conv.inner = untag_ptr(this_ptr);
45518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45520         this_ptr_conv.is_owned = false;
45521         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
45522         return ret_conv;
45523 }
45524
45525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45526         LDKTxAddOutput this_ptr_conv;
45527         this_ptr_conv.inner = untag_ptr(this_ptr);
45528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45530         this_ptr_conv.is_owned = false;
45531         TxAddOutput_set_sats(&this_ptr_conv, val);
45532 }
45533
45534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
45535         LDKTxAddOutput this_ptr_conv;
45536         this_ptr_conv.inner = untag_ptr(this_ptr);
45537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45539         this_ptr_conv.is_owned = false;
45540         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
45541         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45542         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45543         return ret_arr;
45544 }
45545
45546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45547         LDKTxAddOutput this_ptr_conv;
45548         this_ptr_conv.inner = untag_ptr(this_ptr);
45549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45551         this_ptr_conv.is_owned = false;
45552         LDKCVec_u8Z val_ref;
45553         val_ref.datalen = (*env)->GetArrayLength(env, val);
45554         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45555         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
45556         TxAddOutput_set_script(&this_ptr_conv, val_ref);
45557 }
45558
45559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
45560         LDKThirtyTwoBytes channel_id_arg_ref;
45561         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45562         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45563         LDKCVec_u8Z script_arg_ref;
45564         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
45565         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45566         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
45567         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
45568         int64_t ret_ref = 0;
45569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45571         return ret_ref;
45572 }
45573
45574 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
45575         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
45576         int64_t ret_ref = 0;
45577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45579         return ret_ref;
45580 }
45581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45582         LDKTxAddOutput arg_conv;
45583         arg_conv.inner = untag_ptr(arg);
45584         arg_conv.is_owned = ptr_is_owned(arg);
45585         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45586         arg_conv.is_owned = false;
45587         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
45588         return ret_conv;
45589 }
45590
45591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45592         LDKTxAddOutput orig_conv;
45593         orig_conv.inner = untag_ptr(orig);
45594         orig_conv.is_owned = ptr_is_owned(orig);
45595         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45596         orig_conv.is_owned = false;
45597         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
45598         int64_t ret_ref = 0;
45599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45601         return ret_ref;
45602 }
45603
45604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45605         LDKTxAddOutput a_conv;
45606         a_conv.inner = untag_ptr(a);
45607         a_conv.is_owned = ptr_is_owned(a);
45608         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45609         a_conv.is_owned = false;
45610         LDKTxAddOutput b_conv;
45611         b_conv.inner = untag_ptr(b);
45612         b_conv.is_owned = ptr_is_owned(b);
45613         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45614         b_conv.is_owned = false;
45615         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
45616         return ret_conv;
45617 }
45618
45619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45620         LDKTxRemoveInput this_obj_conv;
45621         this_obj_conv.inner = untag_ptr(this_obj);
45622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45624         TxRemoveInput_free(this_obj_conv);
45625 }
45626
45627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45628         LDKTxRemoveInput this_ptr_conv;
45629         this_ptr_conv.inner = untag_ptr(this_ptr);
45630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45632         this_ptr_conv.is_owned = false;
45633         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45634         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveInput_get_channel_id(&this_ptr_conv));
45635         return ret_arr;
45636 }
45637
45638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45639         LDKTxRemoveInput this_ptr_conv;
45640         this_ptr_conv.inner = untag_ptr(this_ptr);
45641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45643         this_ptr_conv.is_owned = false;
45644         LDKThirtyTwoBytes val_ref;
45645         CHECK((*env)->GetArrayLength(env, val) == 32);
45646         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45647         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
45648 }
45649
45650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45651         LDKTxRemoveInput this_ptr_conv;
45652         this_ptr_conv.inner = untag_ptr(this_ptr);
45653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45655         this_ptr_conv.is_owned = false;
45656         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
45657         return ret_conv;
45658 }
45659
45660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45661         LDKTxRemoveInput this_ptr_conv;
45662         this_ptr_conv.inner = untag_ptr(this_ptr);
45663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45665         this_ptr_conv.is_owned = false;
45666         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
45667 }
45668
45669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
45670         LDKThirtyTwoBytes channel_id_arg_ref;
45671         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45672         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45673         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
45674         int64_t ret_ref = 0;
45675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45677         return ret_ref;
45678 }
45679
45680 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
45681         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
45682         int64_t ret_ref = 0;
45683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45685         return ret_ref;
45686 }
45687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45688         LDKTxRemoveInput arg_conv;
45689         arg_conv.inner = untag_ptr(arg);
45690         arg_conv.is_owned = ptr_is_owned(arg);
45691         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45692         arg_conv.is_owned = false;
45693         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
45694         return ret_conv;
45695 }
45696
45697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45698         LDKTxRemoveInput orig_conv;
45699         orig_conv.inner = untag_ptr(orig);
45700         orig_conv.is_owned = ptr_is_owned(orig);
45701         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45702         orig_conv.is_owned = false;
45703         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
45704         int64_t ret_ref = 0;
45705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45707         return ret_ref;
45708 }
45709
45710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45711         LDKTxRemoveInput a_conv;
45712         a_conv.inner = untag_ptr(a);
45713         a_conv.is_owned = ptr_is_owned(a);
45714         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45715         a_conv.is_owned = false;
45716         LDKTxRemoveInput b_conv;
45717         b_conv.inner = untag_ptr(b);
45718         b_conv.is_owned = ptr_is_owned(b);
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45720         b_conv.is_owned = false;
45721         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
45722         return ret_conv;
45723 }
45724
45725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45726         LDKTxRemoveOutput this_obj_conv;
45727         this_obj_conv.inner = untag_ptr(this_obj);
45728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45730         TxRemoveOutput_free(this_obj_conv);
45731 }
45732
45733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45734         LDKTxRemoveOutput this_ptr_conv;
45735         this_ptr_conv.inner = untag_ptr(this_ptr);
45736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45738         this_ptr_conv.is_owned = false;
45739         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45740         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveOutput_get_channel_id(&this_ptr_conv));
45741         return ret_arr;
45742 }
45743
45744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45745         LDKTxRemoveOutput this_ptr_conv;
45746         this_ptr_conv.inner = untag_ptr(this_ptr);
45747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45749         this_ptr_conv.is_owned = false;
45750         LDKThirtyTwoBytes val_ref;
45751         CHECK((*env)->GetArrayLength(env, val) == 32);
45752         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45753         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
45754 }
45755
45756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45757         LDKTxRemoveOutput this_ptr_conv;
45758         this_ptr_conv.inner = untag_ptr(this_ptr);
45759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45761         this_ptr_conv.is_owned = false;
45762         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
45763         return ret_conv;
45764 }
45765
45766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45767         LDKTxRemoveOutput this_ptr_conv;
45768         this_ptr_conv.inner = untag_ptr(this_ptr);
45769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45771         this_ptr_conv.is_owned = false;
45772         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
45773 }
45774
45775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
45776         LDKThirtyTwoBytes channel_id_arg_ref;
45777         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45778         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45779         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
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 TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
45787         LDKTxRemoveOutput ret_var = TxRemoveOutput_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_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45794         LDKTxRemoveOutput 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 = TxRemoveOutput_clone_ptr(&arg_conv);
45800         return ret_conv;
45801 }
45802
45803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45804         LDKTxRemoveOutput 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         LDKTxRemoveOutput ret_var = TxRemoveOutput_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 jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45817         LDKTxRemoveOutput a_conv;
45818         a_conv.inner = untag_ptr(a);
45819         a_conv.is_owned = ptr_is_owned(a);
45820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45821         a_conv.is_owned = false;
45822         LDKTxRemoveOutput b_conv;
45823         b_conv.inner = untag_ptr(b);
45824         b_conv.is_owned = ptr_is_owned(b);
45825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45826         b_conv.is_owned = false;
45827         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
45828         return ret_conv;
45829 }
45830
45831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45832         LDKTxComplete this_obj_conv;
45833         this_obj_conv.inner = untag_ptr(this_obj);
45834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45836         TxComplete_free(this_obj_conv);
45837 }
45838
45839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45840         LDKTxComplete this_ptr_conv;
45841         this_ptr_conv.inner = untag_ptr(this_ptr);
45842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45844         this_ptr_conv.is_owned = false;
45845         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45846         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxComplete_get_channel_id(&this_ptr_conv));
45847         return ret_arr;
45848 }
45849
45850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45851         LDKTxComplete this_ptr_conv;
45852         this_ptr_conv.inner = untag_ptr(this_ptr);
45853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45855         this_ptr_conv.is_owned = false;
45856         LDKThirtyTwoBytes val_ref;
45857         CHECK((*env)->GetArrayLength(env, val) == 32);
45858         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45859         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
45860 }
45861
45862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
45863         LDKThirtyTwoBytes channel_id_arg_ref;
45864         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45865         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45866         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
45867         int64_t ret_ref = 0;
45868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45870         return ret_ref;
45871 }
45872
45873 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
45874         LDKTxComplete ret_var = TxComplete_clone(arg);
45875         int64_t ret_ref = 0;
45876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45878         return ret_ref;
45879 }
45880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45881         LDKTxComplete arg_conv;
45882         arg_conv.inner = untag_ptr(arg);
45883         arg_conv.is_owned = ptr_is_owned(arg);
45884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45885         arg_conv.is_owned = false;
45886         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
45887         return ret_conv;
45888 }
45889
45890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45891         LDKTxComplete orig_conv;
45892         orig_conv.inner = untag_ptr(orig);
45893         orig_conv.is_owned = ptr_is_owned(orig);
45894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45895         orig_conv.is_owned = false;
45896         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
45897         int64_t ret_ref = 0;
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45900         return ret_ref;
45901 }
45902
45903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45904         LDKTxComplete a_conv;
45905         a_conv.inner = untag_ptr(a);
45906         a_conv.is_owned = ptr_is_owned(a);
45907         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45908         a_conv.is_owned = false;
45909         LDKTxComplete b_conv;
45910         b_conv.inner = untag_ptr(b);
45911         b_conv.is_owned = ptr_is_owned(b);
45912         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45913         b_conv.is_owned = false;
45914         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
45915         return ret_conv;
45916 }
45917
45918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45919         LDKTxSignatures this_obj_conv;
45920         this_obj_conv.inner = untag_ptr(this_obj);
45921         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45923         TxSignatures_free(this_obj_conv);
45924 }
45925
45926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45927         LDKTxSignatures this_ptr_conv;
45928         this_ptr_conv.inner = untag_ptr(this_ptr);
45929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45931         this_ptr_conv.is_owned = false;
45932         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45933         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_channel_id(&this_ptr_conv));
45934         return ret_arr;
45935 }
45936
45937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45938         LDKTxSignatures this_ptr_conv;
45939         this_ptr_conv.inner = untag_ptr(this_ptr);
45940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45942         this_ptr_conv.is_owned = false;
45943         LDKThirtyTwoBytes val_ref;
45944         CHECK((*env)->GetArrayLength(env, val) == 32);
45945         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45946         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
45947 }
45948
45949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
45950         LDKTxSignatures this_ptr_conv;
45951         this_ptr_conv.inner = untag_ptr(this_ptr);
45952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45954         this_ptr_conv.is_owned = false;
45955         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45956         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
45957         return ret_arr;
45958 }
45959
45960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45961         LDKTxSignatures this_ptr_conv;
45962         this_ptr_conv.inner = untag_ptr(this_ptr);
45963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45965         this_ptr_conv.is_owned = false;
45966         LDKThirtyTwoBytes val_ref;
45967         CHECK((*env)->GetArrayLength(env, val) == 32);
45968         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45969         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
45970 }
45971
45972 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
45973         LDKTxSignatures this_ptr_conv;
45974         this_ptr_conv.inner = untag_ptr(this_ptr);
45975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45977         this_ptr_conv.is_owned = false;
45978         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
45979         jobjectArray ret_arr = NULL;
45980         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
45981         ;
45982         for (size_t i = 0; i < ret_var.datalen; i++) {
45983                 LDKWitness ret_conv_8_var = ret_var.data[i];
45984                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
45985                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
45986                 Witness_free(ret_conv_8_var);
45987                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
45988         }
45989         
45990         FREE(ret_var.data);
45991         return ret_arr;
45992 }
45993
45994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
45995         LDKTxSignatures this_ptr_conv;
45996         this_ptr_conv.inner = untag_ptr(this_ptr);
45997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45999         this_ptr_conv.is_owned = false;
46000         LDKCVec_WitnessZ val_constr;
46001         val_constr.datalen = (*env)->GetArrayLength(env, val);
46002         if (val_constr.datalen > 0)
46003                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
46004         else
46005                 val_constr.data = NULL;
46006         for (size_t i = 0; i < val_constr.datalen; i++) {
46007                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
46008                 LDKWitness val_conv_8_ref;
46009                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
46010                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
46011                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
46012                 val_conv_8_ref.data_is_owned = true;
46013                 val_constr.data[i] = val_conv_8_ref;
46014         }
46015         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
46016 }
46017
46018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray tx_hash_arg, jobjectArray witnesses_arg) {
46019         LDKThirtyTwoBytes channel_id_arg_ref;
46020         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46021         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46022         LDKThirtyTwoBytes tx_hash_arg_ref;
46023         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
46024         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
46025         LDKCVec_WitnessZ witnesses_arg_constr;
46026         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
46027         if (witnesses_arg_constr.datalen > 0)
46028                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
46029         else
46030                 witnesses_arg_constr.data = NULL;
46031         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
46032                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
46033                 LDKWitness witnesses_arg_conv_8_ref;
46034                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
46035                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
46036                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
46037                 witnesses_arg_conv_8_ref.data_is_owned = true;
46038                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
46039         }
46040         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
46041         int64_t ret_ref = 0;
46042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46044         return ret_ref;
46045 }
46046
46047 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
46048         LDKTxSignatures ret_var = TxSignatures_clone(arg);
46049         int64_t ret_ref = 0;
46050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46052         return ret_ref;
46053 }
46054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46055         LDKTxSignatures arg_conv;
46056         arg_conv.inner = untag_ptr(arg);
46057         arg_conv.is_owned = ptr_is_owned(arg);
46058         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46059         arg_conv.is_owned = false;
46060         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
46061         return ret_conv;
46062 }
46063
46064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46065         LDKTxSignatures orig_conv;
46066         orig_conv.inner = untag_ptr(orig);
46067         orig_conv.is_owned = ptr_is_owned(orig);
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46069         orig_conv.is_owned = false;
46070         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
46071         int64_t ret_ref = 0;
46072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46074         return ret_ref;
46075 }
46076
46077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46078         LDKTxSignatures a_conv;
46079         a_conv.inner = untag_ptr(a);
46080         a_conv.is_owned = ptr_is_owned(a);
46081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46082         a_conv.is_owned = false;
46083         LDKTxSignatures b_conv;
46084         b_conv.inner = untag_ptr(b);
46085         b_conv.is_owned = ptr_is_owned(b);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46087         b_conv.is_owned = false;
46088         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
46089         return ret_conv;
46090 }
46091
46092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46093         LDKTxInitRbf this_obj_conv;
46094         this_obj_conv.inner = untag_ptr(this_obj);
46095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46097         TxInitRbf_free(this_obj_conv);
46098 }
46099
46100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46101         LDKTxInitRbf this_ptr_conv;
46102         this_ptr_conv.inner = untag_ptr(this_ptr);
46103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46105         this_ptr_conv.is_owned = false;
46106         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46107         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxInitRbf_get_channel_id(&this_ptr_conv));
46108         return ret_arr;
46109 }
46110
46111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46112         LDKTxInitRbf this_ptr_conv;
46113         this_ptr_conv.inner = untag_ptr(this_ptr);
46114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46116         this_ptr_conv.is_owned = false;
46117         LDKThirtyTwoBytes val_ref;
46118         CHECK((*env)->GetArrayLength(env, val) == 32);
46119         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46120         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
46121 }
46122
46123 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
46124         LDKTxInitRbf this_ptr_conv;
46125         this_ptr_conv.inner = untag_ptr(this_ptr);
46126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46128         this_ptr_conv.is_owned = false;
46129         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
46130         return ret_conv;
46131 }
46132
46133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46134         LDKTxInitRbf this_ptr_conv;
46135         this_ptr_conv.inner = untag_ptr(this_ptr);
46136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46138         this_ptr_conv.is_owned = false;
46139         TxInitRbf_set_locktime(&this_ptr_conv, val);
46140 }
46141
46142 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
46143         LDKTxInitRbf this_ptr_conv;
46144         this_ptr_conv.inner = untag_ptr(this_ptr);
46145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46147         this_ptr_conv.is_owned = false;
46148         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
46149         return ret_conv;
46150 }
46151
46152 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) {
46153         LDKTxInitRbf 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         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
46159 }
46160
46161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
46162         LDKTxInitRbf this_ptr_conv;
46163         this_ptr_conv.inner = untag_ptr(this_ptr);
46164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46166         this_ptr_conv.is_owned = false;
46167         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
46168         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
46169         int64_t ret_ref = tag_ptr(ret_copy, true);
46170         return ret_ref;
46171 }
46172
46173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46174         LDKTxInitRbf this_ptr_conv;
46175         this_ptr_conv.inner = untag_ptr(this_ptr);
46176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46178         this_ptr_conv.is_owned = false;
46179         void* val_ptr = untag_ptr(val);
46180         CHECK_ACCESS(val_ptr);
46181         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
46182         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
46183         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
46184 }
46185
46186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
46187         LDKThirtyTwoBytes channel_id_arg_ref;
46188         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46189         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46190         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
46191         CHECK_ACCESS(funding_output_contribution_arg_ptr);
46192         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
46193         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
46194         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
46195         int64_t ret_ref = 0;
46196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46198         return ret_ref;
46199 }
46200
46201 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
46202         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
46203         int64_t ret_ref = 0;
46204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46206         return ret_ref;
46207 }
46208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46209         LDKTxInitRbf arg_conv;
46210         arg_conv.inner = untag_ptr(arg);
46211         arg_conv.is_owned = ptr_is_owned(arg);
46212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46213         arg_conv.is_owned = false;
46214         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
46215         return ret_conv;
46216 }
46217
46218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46219         LDKTxInitRbf orig_conv;
46220         orig_conv.inner = untag_ptr(orig);
46221         orig_conv.is_owned = ptr_is_owned(orig);
46222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46223         orig_conv.is_owned = false;
46224         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
46225         int64_t ret_ref = 0;
46226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46228         return ret_ref;
46229 }
46230
46231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46232         LDKTxInitRbf a_conv;
46233         a_conv.inner = untag_ptr(a);
46234         a_conv.is_owned = ptr_is_owned(a);
46235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46236         a_conv.is_owned = false;
46237         LDKTxInitRbf b_conv;
46238         b_conv.inner = untag_ptr(b);
46239         b_conv.is_owned = ptr_is_owned(b);
46240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46241         b_conv.is_owned = false;
46242         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
46243         return ret_conv;
46244 }
46245
46246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46247         LDKTxAckRbf this_obj_conv;
46248         this_obj_conv.inner = untag_ptr(this_obj);
46249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46251         TxAckRbf_free(this_obj_conv);
46252 }
46253
46254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46255         LDKTxAckRbf this_ptr_conv;
46256         this_ptr_conv.inner = untag_ptr(this_ptr);
46257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46259         this_ptr_conv.is_owned = false;
46260         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46261         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAckRbf_get_channel_id(&this_ptr_conv));
46262         return ret_arr;
46263 }
46264
46265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46266         LDKTxAckRbf this_ptr_conv;
46267         this_ptr_conv.inner = untag_ptr(this_ptr);
46268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46270         this_ptr_conv.is_owned = false;
46271         LDKThirtyTwoBytes val_ref;
46272         CHECK((*env)->GetArrayLength(env, val) == 32);
46273         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46274         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
46275 }
46276
46277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
46278         LDKTxAckRbf this_ptr_conv;
46279         this_ptr_conv.inner = untag_ptr(this_ptr);
46280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46282         this_ptr_conv.is_owned = false;
46283         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
46284         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
46285         int64_t ret_ref = tag_ptr(ret_copy, true);
46286         return ret_ref;
46287 }
46288
46289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46290         LDKTxAckRbf this_ptr_conv;
46291         this_ptr_conv.inner = untag_ptr(this_ptr);
46292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46294         this_ptr_conv.is_owned = false;
46295         void* val_ptr = untag_ptr(val);
46296         CHECK_ACCESS(val_ptr);
46297         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
46298         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
46299         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
46300 }
46301
46302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t funding_output_contribution_arg) {
46303         LDKThirtyTwoBytes channel_id_arg_ref;
46304         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46305         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46306         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
46307         CHECK_ACCESS(funding_output_contribution_arg_ptr);
46308         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
46309         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
46310         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
46311         int64_t ret_ref = 0;
46312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46314         return ret_ref;
46315 }
46316
46317 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
46318         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
46319         int64_t ret_ref = 0;
46320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46322         return ret_ref;
46323 }
46324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46325         LDKTxAckRbf arg_conv;
46326         arg_conv.inner = untag_ptr(arg);
46327         arg_conv.is_owned = ptr_is_owned(arg);
46328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46329         arg_conv.is_owned = false;
46330         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
46331         return ret_conv;
46332 }
46333
46334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46335         LDKTxAckRbf orig_conv;
46336         orig_conv.inner = untag_ptr(orig);
46337         orig_conv.is_owned = ptr_is_owned(orig);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46339         orig_conv.is_owned = false;
46340         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
46341         int64_t ret_ref = 0;
46342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46344         return ret_ref;
46345 }
46346
46347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46348         LDKTxAckRbf a_conv;
46349         a_conv.inner = untag_ptr(a);
46350         a_conv.is_owned = ptr_is_owned(a);
46351         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46352         a_conv.is_owned = false;
46353         LDKTxAckRbf b_conv;
46354         b_conv.inner = untag_ptr(b);
46355         b_conv.is_owned = ptr_is_owned(b);
46356         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46357         b_conv.is_owned = false;
46358         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
46359         return ret_conv;
46360 }
46361
46362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46363         LDKTxAbort this_obj_conv;
46364         this_obj_conv.inner = untag_ptr(this_obj);
46365         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46367         TxAbort_free(this_obj_conv);
46368 }
46369
46370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46371         LDKTxAbort this_ptr_conv;
46372         this_ptr_conv.inner = untag_ptr(this_ptr);
46373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46375         this_ptr_conv.is_owned = false;
46376         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46377         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAbort_get_channel_id(&this_ptr_conv));
46378         return ret_arr;
46379 }
46380
46381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46382         LDKTxAbort this_ptr_conv;
46383         this_ptr_conv.inner = untag_ptr(this_ptr);
46384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46386         this_ptr_conv.is_owned = false;
46387         LDKThirtyTwoBytes val_ref;
46388         CHECK((*env)->GetArrayLength(env, val) == 32);
46389         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46390         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
46391 }
46392
46393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46394         LDKTxAbort this_ptr_conv;
46395         this_ptr_conv.inner = untag_ptr(this_ptr);
46396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46398         this_ptr_conv.is_owned = false;
46399         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
46400         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46401         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46402         CVec_u8Z_free(ret_var);
46403         return ret_arr;
46404 }
46405
46406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46407         LDKTxAbort this_ptr_conv;
46408         this_ptr_conv.inner = untag_ptr(this_ptr);
46409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46411         this_ptr_conv.is_owned = false;
46412         LDKCVec_u8Z val_ref;
46413         val_ref.datalen = (*env)->GetArrayLength(env, val);
46414         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
46415         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
46416         TxAbort_set_data(&this_ptr_conv, val_ref);
46417 }
46418
46419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
46420         LDKThirtyTwoBytes channel_id_arg_ref;
46421         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46422         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46423         LDKCVec_u8Z data_arg_ref;
46424         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
46425         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46426         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
46427         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
46428         int64_t ret_ref = 0;
46429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46431         return ret_ref;
46432 }
46433
46434 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
46435         LDKTxAbort ret_var = TxAbort_clone(arg);
46436         int64_t ret_ref = 0;
46437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46439         return ret_ref;
46440 }
46441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46442         LDKTxAbort arg_conv;
46443         arg_conv.inner = untag_ptr(arg);
46444         arg_conv.is_owned = ptr_is_owned(arg);
46445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46446         arg_conv.is_owned = false;
46447         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
46448         return ret_conv;
46449 }
46450
46451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46452         LDKTxAbort orig_conv;
46453         orig_conv.inner = untag_ptr(orig);
46454         orig_conv.is_owned = ptr_is_owned(orig);
46455         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46456         orig_conv.is_owned = false;
46457         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
46458         int64_t ret_ref = 0;
46459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46461         return ret_ref;
46462 }
46463
46464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46465         LDKTxAbort a_conv;
46466         a_conv.inner = untag_ptr(a);
46467         a_conv.is_owned = ptr_is_owned(a);
46468         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46469         a_conv.is_owned = false;
46470         LDKTxAbort b_conv;
46471         b_conv.inner = untag_ptr(b);
46472         b_conv.is_owned = ptr_is_owned(b);
46473         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46474         b_conv.is_owned = false;
46475         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
46476         return ret_conv;
46477 }
46478
46479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46480         LDKShutdown this_obj_conv;
46481         this_obj_conv.inner = untag_ptr(this_obj);
46482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46484         Shutdown_free(this_obj_conv);
46485 }
46486
46487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46488         LDKShutdown this_ptr_conv;
46489         this_ptr_conv.inner = untag_ptr(this_ptr);
46490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46492         this_ptr_conv.is_owned = false;
46493         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46494         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
46495         return ret_arr;
46496 }
46497
46498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46499         LDKShutdown this_ptr_conv;
46500         this_ptr_conv.inner = untag_ptr(this_ptr);
46501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46503         this_ptr_conv.is_owned = false;
46504         LDKThirtyTwoBytes val_ref;
46505         CHECK((*env)->GetArrayLength(env, val) == 32);
46506         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46507         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
46508 }
46509
46510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
46511         LDKShutdown this_ptr_conv;
46512         this_ptr_conv.inner = untag_ptr(this_ptr);
46513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46515         this_ptr_conv.is_owned = false;
46516         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
46517         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46518         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46519         return ret_arr;
46520 }
46521
46522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46523         LDKShutdown this_ptr_conv;
46524         this_ptr_conv.inner = untag_ptr(this_ptr);
46525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46527         this_ptr_conv.is_owned = false;
46528         LDKCVec_u8Z val_ref;
46529         val_ref.datalen = (*env)->GetArrayLength(env, val);
46530         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
46531         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
46532         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
46533 }
46534
46535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
46536         LDKThirtyTwoBytes channel_id_arg_ref;
46537         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46538         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46539         LDKCVec_u8Z scriptpubkey_arg_ref;
46540         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
46541         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46542         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
46543         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
46544         int64_t ret_ref = 0;
46545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46547         return ret_ref;
46548 }
46549
46550 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
46551         LDKShutdown ret_var = Shutdown_clone(arg);
46552         int64_t ret_ref = 0;
46553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46555         return ret_ref;
46556 }
46557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46558         LDKShutdown arg_conv;
46559         arg_conv.inner = untag_ptr(arg);
46560         arg_conv.is_owned = ptr_is_owned(arg);
46561         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46562         arg_conv.is_owned = false;
46563         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
46564         return ret_conv;
46565 }
46566
46567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46568         LDKShutdown orig_conv;
46569         orig_conv.inner = untag_ptr(orig);
46570         orig_conv.is_owned = ptr_is_owned(orig);
46571         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46572         orig_conv.is_owned = false;
46573         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
46574         int64_t ret_ref = 0;
46575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46577         return ret_ref;
46578 }
46579
46580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46581         LDKShutdown a_conv;
46582         a_conv.inner = untag_ptr(a);
46583         a_conv.is_owned = ptr_is_owned(a);
46584         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46585         a_conv.is_owned = false;
46586         LDKShutdown b_conv;
46587         b_conv.inner = untag_ptr(b);
46588         b_conv.is_owned = ptr_is_owned(b);
46589         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46590         b_conv.is_owned = false;
46591         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
46592         return ret_conv;
46593 }
46594
46595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46596         LDKClosingSignedFeeRange this_obj_conv;
46597         this_obj_conv.inner = untag_ptr(this_obj);
46598         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46600         ClosingSignedFeeRange_free(this_obj_conv);
46601 }
46602
46603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46604         LDKClosingSignedFeeRange this_ptr_conv;
46605         this_ptr_conv.inner = untag_ptr(this_ptr);
46606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46608         this_ptr_conv.is_owned = false;
46609         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
46610         return ret_conv;
46611 }
46612
46613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46614         LDKClosingSignedFeeRange this_ptr_conv;
46615         this_ptr_conv.inner = untag_ptr(this_ptr);
46616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46618         this_ptr_conv.is_owned = false;
46619         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
46620 }
46621
46622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46623         LDKClosingSignedFeeRange this_ptr_conv;
46624         this_ptr_conv.inner = untag_ptr(this_ptr);
46625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46627         this_ptr_conv.is_owned = false;
46628         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
46629         return ret_conv;
46630 }
46631
46632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46633         LDKClosingSignedFeeRange this_ptr_conv;
46634         this_ptr_conv.inner = untag_ptr(this_ptr);
46635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46637         this_ptr_conv.is_owned = false;
46638         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
46639 }
46640
46641 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) {
46642         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
46643         int64_t ret_ref = 0;
46644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46646         return ret_ref;
46647 }
46648
46649 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
46650         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
46651         int64_t ret_ref = 0;
46652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46654         return ret_ref;
46655 }
46656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46657         LDKClosingSignedFeeRange arg_conv;
46658         arg_conv.inner = untag_ptr(arg);
46659         arg_conv.is_owned = ptr_is_owned(arg);
46660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46661         arg_conv.is_owned = false;
46662         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
46663         return ret_conv;
46664 }
46665
46666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46667         LDKClosingSignedFeeRange orig_conv;
46668         orig_conv.inner = untag_ptr(orig);
46669         orig_conv.is_owned = ptr_is_owned(orig);
46670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46671         orig_conv.is_owned = false;
46672         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
46673         int64_t ret_ref = 0;
46674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46676         return ret_ref;
46677 }
46678
46679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46680         LDKClosingSignedFeeRange a_conv;
46681         a_conv.inner = untag_ptr(a);
46682         a_conv.is_owned = ptr_is_owned(a);
46683         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46684         a_conv.is_owned = false;
46685         LDKClosingSignedFeeRange b_conv;
46686         b_conv.inner = untag_ptr(b);
46687         b_conv.is_owned = ptr_is_owned(b);
46688         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46689         b_conv.is_owned = false;
46690         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
46691         return ret_conv;
46692 }
46693
46694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46695         LDKClosingSigned this_obj_conv;
46696         this_obj_conv.inner = untag_ptr(this_obj);
46697         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46699         ClosingSigned_free(this_obj_conv);
46700 }
46701
46702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46703         LDKClosingSigned this_ptr_conv;
46704         this_ptr_conv.inner = untag_ptr(this_ptr);
46705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46707         this_ptr_conv.is_owned = false;
46708         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46709         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
46710         return ret_arr;
46711 }
46712
46713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46714         LDKClosingSigned this_ptr_conv;
46715         this_ptr_conv.inner = untag_ptr(this_ptr);
46716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46718         this_ptr_conv.is_owned = false;
46719         LDKThirtyTwoBytes val_ref;
46720         CHECK((*env)->GetArrayLength(env, val) == 32);
46721         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46722         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
46723 }
46724
46725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46726         LDKClosingSigned this_ptr_conv;
46727         this_ptr_conv.inner = untag_ptr(this_ptr);
46728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46730         this_ptr_conv.is_owned = false;
46731         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
46732         return ret_conv;
46733 }
46734
46735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46736         LDKClosingSigned 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         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
46742 }
46743
46744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
46745         LDKClosingSigned this_ptr_conv;
46746         this_ptr_conv.inner = untag_ptr(this_ptr);
46747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46749         this_ptr_conv.is_owned = false;
46750         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46751         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
46752         return ret_arr;
46753 }
46754
46755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46756         LDKClosingSigned this_ptr_conv;
46757         this_ptr_conv.inner = untag_ptr(this_ptr);
46758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46760         this_ptr_conv.is_owned = false;
46761         LDKECDSASignature val_ref;
46762         CHECK((*env)->GetArrayLength(env, val) == 64);
46763         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46764         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
46765 }
46766
46767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
46768         LDKClosingSigned this_ptr_conv;
46769         this_ptr_conv.inner = untag_ptr(this_ptr);
46770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46772         this_ptr_conv.is_owned = false;
46773         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
46774         int64_t ret_ref = 0;
46775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46777         return ret_ref;
46778 }
46779
46780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46781         LDKClosingSigned this_ptr_conv;
46782         this_ptr_conv.inner = untag_ptr(this_ptr);
46783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46785         this_ptr_conv.is_owned = false;
46786         LDKClosingSignedFeeRange val_conv;
46787         val_conv.inner = untag_ptr(val);
46788         val_conv.is_owned = ptr_is_owned(val);
46789         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46790         val_conv = ClosingSignedFeeRange_clone(&val_conv);
46791         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
46792 }
46793
46794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
46795         LDKThirtyTwoBytes channel_id_arg_ref;
46796         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46797         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46798         LDKECDSASignature signature_arg_ref;
46799         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
46800         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
46801         LDKClosingSignedFeeRange fee_range_arg_conv;
46802         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
46803         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
46804         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
46805         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
46806         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
46807         int64_t ret_ref = 0;
46808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46810         return ret_ref;
46811 }
46812
46813 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
46814         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
46815         int64_t ret_ref = 0;
46816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46818         return ret_ref;
46819 }
46820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46821         LDKClosingSigned arg_conv;
46822         arg_conv.inner = untag_ptr(arg);
46823         arg_conv.is_owned = ptr_is_owned(arg);
46824         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46825         arg_conv.is_owned = false;
46826         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
46827         return ret_conv;
46828 }
46829
46830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46831         LDKClosingSigned orig_conv;
46832         orig_conv.inner = untag_ptr(orig);
46833         orig_conv.is_owned = ptr_is_owned(orig);
46834         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46835         orig_conv.is_owned = false;
46836         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
46837         int64_t ret_ref = 0;
46838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46840         return ret_ref;
46841 }
46842
46843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46844         LDKClosingSigned a_conv;
46845         a_conv.inner = untag_ptr(a);
46846         a_conv.is_owned = ptr_is_owned(a);
46847         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46848         a_conv.is_owned = false;
46849         LDKClosingSigned b_conv;
46850         b_conv.inner = untag_ptr(b);
46851         b_conv.is_owned = ptr_is_owned(b);
46852         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46853         b_conv.is_owned = false;
46854         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
46855         return ret_conv;
46856 }
46857
46858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46859         LDKUpdateAddHTLC this_obj_conv;
46860         this_obj_conv.inner = untag_ptr(this_obj);
46861         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46863         UpdateAddHTLC_free(this_obj_conv);
46864 }
46865
46866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46867         LDKUpdateAddHTLC this_ptr_conv;
46868         this_ptr_conv.inner = untag_ptr(this_ptr);
46869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46871         this_ptr_conv.is_owned = false;
46872         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46873         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
46874         return ret_arr;
46875 }
46876
46877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46878         LDKUpdateAddHTLC this_ptr_conv;
46879         this_ptr_conv.inner = untag_ptr(this_ptr);
46880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46882         this_ptr_conv.is_owned = false;
46883         LDKThirtyTwoBytes val_ref;
46884         CHECK((*env)->GetArrayLength(env, val) == 32);
46885         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46886         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
46887 }
46888
46889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46890         LDKUpdateAddHTLC this_ptr_conv;
46891         this_ptr_conv.inner = untag_ptr(this_ptr);
46892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46894         this_ptr_conv.is_owned = false;
46895         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
46896         return ret_conv;
46897 }
46898
46899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46900         LDKUpdateAddHTLC this_ptr_conv;
46901         this_ptr_conv.inner = untag_ptr(this_ptr);
46902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46904         this_ptr_conv.is_owned = false;
46905         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
46906 }
46907
46908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46909         LDKUpdateAddHTLC this_ptr_conv;
46910         this_ptr_conv.inner = untag_ptr(this_ptr);
46911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46913         this_ptr_conv.is_owned = false;
46914         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
46915         return ret_conv;
46916 }
46917
46918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46919         LDKUpdateAddHTLC this_ptr_conv;
46920         this_ptr_conv.inner = untag_ptr(this_ptr);
46921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46923         this_ptr_conv.is_owned = false;
46924         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
46925 }
46926
46927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46928         LDKUpdateAddHTLC this_ptr_conv;
46929         this_ptr_conv.inner = untag_ptr(this_ptr);
46930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46932         this_ptr_conv.is_owned = false;
46933         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46934         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
46935         return ret_arr;
46936 }
46937
46938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46939         LDKUpdateAddHTLC this_ptr_conv;
46940         this_ptr_conv.inner = untag_ptr(this_ptr);
46941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46943         this_ptr_conv.is_owned = false;
46944         LDKThirtyTwoBytes val_ref;
46945         CHECK((*env)->GetArrayLength(env, val) == 32);
46946         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46947         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
46948 }
46949
46950 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
46951         LDKUpdateAddHTLC this_ptr_conv;
46952         this_ptr_conv.inner = untag_ptr(this_ptr);
46953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46955         this_ptr_conv.is_owned = false;
46956         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
46957         return ret_conv;
46958 }
46959
46960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46961         LDKUpdateAddHTLC 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         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
46967 }
46968
46969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46970         LDKUpdateAddHTLC this_ptr_conv;
46971         this_ptr_conv.inner = untag_ptr(this_ptr);
46972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46974         this_ptr_conv.is_owned = false;
46975         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46976         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
46977         int64_t ret_ref = tag_ptr(ret_copy, true);
46978         return ret_ref;
46979 }
46980
46981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46982         LDKUpdateAddHTLC this_ptr_conv;
46983         this_ptr_conv.inner = untag_ptr(this_ptr);
46984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46986         this_ptr_conv.is_owned = false;
46987         void* val_ptr = untag_ptr(val);
46988         CHECK_ACCESS(val_ptr);
46989         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46990         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46991         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46992 }
46993
46994 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
46995         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
46996         int64_t ret_ref = 0;
46997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46999         return ret_ref;
47000 }
47001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47002         LDKUpdateAddHTLC arg_conv;
47003         arg_conv.inner = untag_ptr(arg);
47004         arg_conv.is_owned = ptr_is_owned(arg);
47005         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47006         arg_conv.is_owned = false;
47007         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
47008         return ret_conv;
47009 }
47010
47011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47012         LDKUpdateAddHTLC orig_conv;
47013         orig_conv.inner = untag_ptr(orig);
47014         orig_conv.is_owned = ptr_is_owned(orig);
47015         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47016         orig_conv.is_owned = false;
47017         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
47018         int64_t ret_ref = 0;
47019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47021         return ret_ref;
47022 }
47023
47024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47025         LDKUpdateAddHTLC a_conv;
47026         a_conv.inner = untag_ptr(a);
47027         a_conv.is_owned = ptr_is_owned(a);
47028         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47029         a_conv.is_owned = false;
47030         LDKUpdateAddHTLC b_conv;
47031         b_conv.inner = untag_ptr(b);
47032         b_conv.is_owned = ptr_is_owned(b);
47033         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47034         b_conv.is_owned = false;
47035         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
47036         return ret_conv;
47037 }
47038
47039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47040         LDKOnionMessage this_obj_conv;
47041         this_obj_conv.inner = untag_ptr(this_obj);
47042         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47044         OnionMessage_free(this_obj_conv);
47045 }
47046
47047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47048         LDKOnionMessage this_ptr_conv;
47049         this_ptr_conv.inner = untag_ptr(this_ptr);
47050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47052         this_ptr_conv.is_owned = false;
47053         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47054         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
47055         return ret_arr;
47056 }
47057
47058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47059         LDKOnionMessage this_ptr_conv;
47060         this_ptr_conv.inner = untag_ptr(this_ptr);
47061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47063         this_ptr_conv.is_owned = false;
47064         LDKPublicKey val_ref;
47065         CHECK((*env)->GetArrayLength(env, val) == 33);
47066         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47067         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
47068 }
47069
47070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
47071         LDKOnionMessage this_ptr_conv;
47072         this_ptr_conv.inner = untag_ptr(this_ptr);
47073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47075         this_ptr_conv.is_owned = false;
47076         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
47077         int64_t ret_ref = 0;
47078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47080         return ret_ref;
47081 }
47082
47083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47084         LDKOnionMessage this_ptr_conv;
47085         this_ptr_conv.inner = untag_ptr(this_ptr);
47086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47088         this_ptr_conv.is_owned = false;
47089         LDKPacket val_conv;
47090         val_conv.inner = untag_ptr(val);
47091         val_conv.is_owned = ptr_is_owned(val);
47092         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47093         val_conv = Packet_clone(&val_conv);
47094         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
47095 }
47096
47097 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) {
47098         LDKPublicKey blinding_point_arg_ref;
47099         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
47100         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
47101         LDKPacket onion_routing_packet_arg_conv;
47102         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
47103         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
47104         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
47105         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
47106         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
47107         int64_t ret_ref = 0;
47108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47110         return ret_ref;
47111 }
47112
47113 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
47114         LDKOnionMessage ret_var = OnionMessage_clone(arg);
47115         int64_t ret_ref = 0;
47116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47118         return ret_ref;
47119 }
47120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47121         LDKOnionMessage arg_conv;
47122         arg_conv.inner = untag_ptr(arg);
47123         arg_conv.is_owned = ptr_is_owned(arg);
47124         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47125         arg_conv.is_owned = false;
47126         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
47127         return ret_conv;
47128 }
47129
47130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47131         LDKOnionMessage orig_conv;
47132         orig_conv.inner = untag_ptr(orig);
47133         orig_conv.is_owned = ptr_is_owned(orig);
47134         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47135         orig_conv.is_owned = false;
47136         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
47137         int64_t ret_ref = 0;
47138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47140         return ret_ref;
47141 }
47142
47143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47144         LDKOnionMessage a_conv;
47145         a_conv.inner = untag_ptr(a);
47146         a_conv.is_owned = ptr_is_owned(a);
47147         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47148         a_conv.is_owned = false;
47149         LDKOnionMessage b_conv;
47150         b_conv.inner = untag_ptr(b);
47151         b_conv.is_owned = ptr_is_owned(b);
47152         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47153         b_conv.is_owned = false;
47154         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
47155         return ret_conv;
47156 }
47157
47158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47159         LDKUpdateFulfillHTLC this_obj_conv;
47160         this_obj_conv.inner = untag_ptr(this_obj);
47161         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47163         UpdateFulfillHTLC_free(this_obj_conv);
47164 }
47165
47166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47167         LDKUpdateFulfillHTLC this_ptr_conv;
47168         this_ptr_conv.inner = untag_ptr(this_ptr);
47169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47171         this_ptr_conv.is_owned = false;
47172         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47173         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
47174         return ret_arr;
47175 }
47176
47177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47178         LDKUpdateFulfillHTLC this_ptr_conv;
47179         this_ptr_conv.inner = untag_ptr(this_ptr);
47180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47182         this_ptr_conv.is_owned = false;
47183         LDKThirtyTwoBytes val_ref;
47184         CHECK((*env)->GetArrayLength(env, val) == 32);
47185         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47186         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
47187 }
47188
47189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47190         LDKUpdateFulfillHTLC this_ptr_conv;
47191         this_ptr_conv.inner = untag_ptr(this_ptr);
47192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47194         this_ptr_conv.is_owned = false;
47195         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
47196         return ret_conv;
47197 }
47198
47199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47200         LDKUpdateFulfillHTLC this_ptr_conv;
47201         this_ptr_conv.inner = untag_ptr(this_ptr);
47202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47204         this_ptr_conv.is_owned = false;
47205         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
47206 }
47207
47208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
47209         LDKUpdateFulfillHTLC this_ptr_conv;
47210         this_ptr_conv.inner = untag_ptr(this_ptr);
47211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47213         this_ptr_conv.is_owned = false;
47214         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47215         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
47216         return ret_arr;
47217 }
47218
47219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47220         LDKUpdateFulfillHTLC this_ptr_conv;
47221         this_ptr_conv.inner = untag_ptr(this_ptr);
47222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47224         this_ptr_conv.is_owned = false;
47225         LDKThirtyTwoBytes val_ref;
47226         CHECK((*env)->GetArrayLength(env, val) == 32);
47227         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47228         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
47229 }
47230
47231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
47232         LDKThirtyTwoBytes channel_id_arg_ref;
47233         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47234         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47235         LDKThirtyTwoBytes payment_preimage_arg_ref;
47236         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
47237         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
47238         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
47239         int64_t ret_ref = 0;
47240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47242         return ret_ref;
47243 }
47244
47245 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
47246         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
47247         int64_t ret_ref = 0;
47248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47250         return ret_ref;
47251 }
47252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47253         LDKUpdateFulfillHTLC arg_conv;
47254         arg_conv.inner = untag_ptr(arg);
47255         arg_conv.is_owned = ptr_is_owned(arg);
47256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47257         arg_conv.is_owned = false;
47258         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
47259         return ret_conv;
47260 }
47261
47262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47263         LDKUpdateFulfillHTLC orig_conv;
47264         orig_conv.inner = untag_ptr(orig);
47265         orig_conv.is_owned = ptr_is_owned(orig);
47266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47267         orig_conv.is_owned = false;
47268         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
47269         int64_t ret_ref = 0;
47270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47272         return ret_ref;
47273 }
47274
47275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47276         LDKUpdateFulfillHTLC a_conv;
47277         a_conv.inner = untag_ptr(a);
47278         a_conv.is_owned = ptr_is_owned(a);
47279         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47280         a_conv.is_owned = false;
47281         LDKUpdateFulfillHTLC b_conv;
47282         b_conv.inner = untag_ptr(b);
47283         b_conv.is_owned = ptr_is_owned(b);
47284         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47285         b_conv.is_owned = false;
47286         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
47287         return ret_conv;
47288 }
47289
47290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47291         LDKUpdateFailHTLC this_obj_conv;
47292         this_obj_conv.inner = untag_ptr(this_obj);
47293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47295         UpdateFailHTLC_free(this_obj_conv);
47296 }
47297
47298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47299         LDKUpdateFailHTLC this_ptr_conv;
47300         this_ptr_conv.inner = untag_ptr(this_ptr);
47301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47303         this_ptr_conv.is_owned = false;
47304         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47305         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
47306         return ret_arr;
47307 }
47308
47309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47310         LDKUpdateFailHTLC this_ptr_conv;
47311         this_ptr_conv.inner = untag_ptr(this_ptr);
47312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47314         this_ptr_conv.is_owned = false;
47315         LDKThirtyTwoBytes val_ref;
47316         CHECK((*env)->GetArrayLength(env, val) == 32);
47317         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47318         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
47319 }
47320
47321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47322         LDKUpdateFailHTLC this_ptr_conv;
47323         this_ptr_conv.inner = untag_ptr(this_ptr);
47324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47326         this_ptr_conv.is_owned = false;
47327         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
47328         return ret_conv;
47329 }
47330
47331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47332         LDKUpdateFailHTLC this_ptr_conv;
47333         this_ptr_conv.inner = untag_ptr(this_ptr);
47334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47336         this_ptr_conv.is_owned = false;
47337         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
47338 }
47339
47340 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
47341         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
47342         int64_t ret_ref = 0;
47343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47345         return ret_ref;
47346 }
47347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47348         LDKUpdateFailHTLC arg_conv;
47349         arg_conv.inner = untag_ptr(arg);
47350         arg_conv.is_owned = ptr_is_owned(arg);
47351         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47352         arg_conv.is_owned = false;
47353         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
47354         return ret_conv;
47355 }
47356
47357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47358         LDKUpdateFailHTLC orig_conv;
47359         orig_conv.inner = untag_ptr(orig);
47360         orig_conv.is_owned = ptr_is_owned(orig);
47361         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47362         orig_conv.is_owned = false;
47363         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
47364         int64_t ret_ref = 0;
47365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47367         return ret_ref;
47368 }
47369
47370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47371         LDKUpdateFailHTLC a_conv;
47372         a_conv.inner = untag_ptr(a);
47373         a_conv.is_owned = ptr_is_owned(a);
47374         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47375         a_conv.is_owned = false;
47376         LDKUpdateFailHTLC b_conv;
47377         b_conv.inner = untag_ptr(b);
47378         b_conv.is_owned = ptr_is_owned(b);
47379         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47380         b_conv.is_owned = false;
47381         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
47382         return ret_conv;
47383 }
47384
47385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47386         LDKUpdateFailMalformedHTLC this_obj_conv;
47387         this_obj_conv.inner = untag_ptr(this_obj);
47388         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47390         UpdateFailMalformedHTLC_free(this_obj_conv);
47391 }
47392
47393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47394         LDKUpdateFailMalformedHTLC this_ptr_conv;
47395         this_ptr_conv.inner = untag_ptr(this_ptr);
47396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47398         this_ptr_conv.is_owned = false;
47399         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47400         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
47401         return ret_arr;
47402 }
47403
47404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47405         LDKUpdateFailMalformedHTLC this_ptr_conv;
47406         this_ptr_conv.inner = untag_ptr(this_ptr);
47407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47409         this_ptr_conv.is_owned = false;
47410         LDKThirtyTwoBytes val_ref;
47411         CHECK((*env)->GetArrayLength(env, val) == 32);
47412         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47413         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
47414 }
47415
47416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47417         LDKUpdateFailMalformedHTLC this_ptr_conv;
47418         this_ptr_conv.inner = untag_ptr(this_ptr);
47419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47421         this_ptr_conv.is_owned = false;
47422         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
47423         return ret_conv;
47424 }
47425
47426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47427         LDKUpdateFailMalformedHTLC this_ptr_conv;
47428         this_ptr_conv.inner = untag_ptr(this_ptr);
47429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47431         this_ptr_conv.is_owned = false;
47432         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
47433 }
47434
47435 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
47436         LDKUpdateFailMalformedHTLC this_ptr_conv;
47437         this_ptr_conv.inner = untag_ptr(this_ptr);
47438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47440         this_ptr_conv.is_owned = false;
47441         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
47442         return ret_conv;
47443 }
47444
47445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47446         LDKUpdateFailMalformedHTLC this_ptr_conv;
47447         this_ptr_conv.inner = untag_ptr(this_ptr);
47448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47450         this_ptr_conv.is_owned = false;
47451         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
47452 }
47453
47454 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
47455         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
47456         int64_t ret_ref = 0;
47457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47459         return ret_ref;
47460 }
47461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47462         LDKUpdateFailMalformedHTLC arg_conv;
47463         arg_conv.inner = untag_ptr(arg);
47464         arg_conv.is_owned = ptr_is_owned(arg);
47465         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47466         arg_conv.is_owned = false;
47467         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
47468         return ret_conv;
47469 }
47470
47471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47472         LDKUpdateFailMalformedHTLC orig_conv;
47473         orig_conv.inner = untag_ptr(orig);
47474         orig_conv.is_owned = ptr_is_owned(orig);
47475         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47476         orig_conv.is_owned = false;
47477         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
47478         int64_t ret_ref = 0;
47479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47481         return ret_ref;
47482 }
47483
47484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47485         LDKUpdateFailMalformedHTLC a_conv;
47486         a_conv.inner = untag_ptr(a);
47487         a_conv.is_owned = ptr_is_owned(a);
47488         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47489         a_conv.is_owned = false;
47490         LDKUpdateFailMalformedHTLC b_conv;
47491         b_conv.inner = untag_ptr(b);
47492         b_conv.is_owned = ptr_is_owned(b);
47493         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47494         b_conv.is_owned = false;
47495         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
47496         return ret_conv;
47497 }
47498
47499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47500         LDKCommitmentSigned this_obj_conv;
47501         this_obj_conv.inner = untag_ptr(this_obj);
47502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47504         CommitmentSigned_free(this_obj_conv);
47505 }
47506
47507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47508         LDKCommitmentSigned this_ptr_conv;
47509         this_ptr_conv.inner = untag_ptr(this_ptr);
47510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47512         this_ptr_conv.is_owned = false;
47513         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47514         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
47515         return ret_arr;
47516 }
47517
47518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47519         LDKCommitmentSigned this_ptr_conv;
47520         this_ptr_conv.inner = untag_ptr(this_ptr);
47521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47523         this_ptr_conv.is_owned = false;
47524         LDKThirtyTwoBytes val_ref;
47525         CHECK((*env)->GetArrayLength(env, val) == 32);
47526         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47527         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
47528 }
47529
47530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
47531         LDKCommitmentSigned this_ptr_conv;
47532         this_ptr_conv.inner = untag_ptr(this_ptr);
47533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47535         this_ptr_conv.is_owned = false;
47536         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
47537         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
47538         return ret_arr;
47539 }
47540
47541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47542         LDKCommitmentSigned this_ptr_conv;
47543         this_ptr_conv.inner = untag_ptr(this_ptr);
47544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47546         this_ptr_conv.is_owned = false;
47547         LDKECDSASignature val_ref;
47548         CHECK((*env)->GetArrayLength(env, val) == 64);
47549         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
47550         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
47551 }
47552
47553 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
47554         LDKCommitmentSigned this_ptr_conv;
47555         this_ptr_conv.inner = untag_ptr(this_ptr);
47556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47558         this_ptr_conv.is_owned = false;
47559         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
47560         jobjectArray ret_arr = NULL;
47561         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
47562         ;
47563         for (size_t i = 0; i < ret_var.datalen; i++) {
47564                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
47565                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
47566                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
47567         }
47568         
47569         FREE(ret_var.data);
47570         return ret_arr;
47571 }
47572
47573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
47574         LDKCommitmentSigned this_ptr_conv;
47575         this_ptr_conv.inner = untag_ptr(this_ptr);
47576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47578         this_ptr_conv.is_owned = false;
47579         LDKCVec_ECDSASignatureZ val_constr;
47580         val_constr.datalen = (*env)->GetArrayLength(env, val);
47581         if (val_constr.datalen > 0)
47582                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
47583         else
47584                 val_constr.data = NULL;
47585         for (size_t i = 0; i < val_constr.datalen; i++) {
47586                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
47587                 LDKECDSASignature val_conv_8_ref;
47588                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
47589                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
47590                 val_constr.data[i] = val_conv_8_ref;
47591         }
47592         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
47593 }
47594
47595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
47596         LDKThirtyTwoBytes channel_id_arg_ref;
47597         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47598         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47599         LDKECDSASignature signature_arg_ref;
47600         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
47601         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
47602         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
47603         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
47604         if (htlc_signatures_arg_constr.datalen > 0)
47605                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
47606         else
47607                 htlc_signatures_arg_constr.data = NULL;
47608         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
47609                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
47610                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
47611                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
47612                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
47613                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
47614         }
47615         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
47616         int64_t ret_ref = 0;
47617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47619         return ret_ref;
47620 }
47621
47622 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
47623         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
47624         int64_t ret_ref = 0;
47625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47627         return ret_ref;
47628 }
47629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47630         LDKCommitmentSigned arg_conv;
47631         arg_conv.inner = untag_ptr(arg);
47632         arg_conv.is_owned = ptr_is_owned(arg);
47633         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47634         arg_conv.is_owned = false;
47635         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
47636         return ret_conv;
47637 }
47638
47639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47640         LDKCommitmentSigned orig_conv;
47641         orig_conv.inner = untag_ptr(orig);
47642         orig_conv.is_owned = ptr_is_owned(orig);
47643         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47644         orig_conv.is_owned = false;
47645         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
47646         int64_t ret_ref = 0;
47647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47649         return ret_ref;
47650 }
47651
47652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47653         LDKCommitmentSigned a_conv;
47654         a_conv.inner = untag_ptr(a);
47655         a_conv.is_owned = ptr_is_owned(a);
47656         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47657         a_conv.is_owned = false;
47658         LDKCommitmentSigned b_conv;
47659         b_conv.inner = untag_ptr(b);
47660         b_conv.is_owned = ptr_is_owned(b);
47661         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47662         b_conv.is_owned = false;
47663         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
47664         return ret_conv;
47665 }
47666
47667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47668         LDKRevokeAndACK this_obj_conv;
47669         this_obj_conv.inner = untag_ptr(this_obj);
47670         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47672         RevokeAndACK_free(this_obj_conv);
47673 }
47674
47675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47676         LDKRevokeAndACK this_ptr_conv;
47677         this_ptr_conv.inner = untag_ptr(this_ptr);
47678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47680         this_ptr_conv.is_owned = false;
47681         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47682         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
47683         return ret_arr;
47684 }
47685
47686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47687         LDKRevokeAndACK this_ptr_conv;
47688         this_ptr_conv.inner = untag_ptr(this_ptr);
47689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47691         this_ptr_conv.is_owned = false;
47692         LDKThirtyTwoBytes val_ref;
47693         CHECK((*env)->GetArrayLength(env, val) == 32);
47694         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47695         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
47696 }
47697
47698 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
47699         LDKRevokeAndACK this_ptr_conv;
47700         this_ptr_conv.inner = untag_ptr(this_ptr);
47701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47703         this_ptr_conv.is_owned = false;
47704         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47705         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
47706         return ret_arr;
47707 }
47708
47709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47710         LDKRevokeAndACK 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         LDKThirtyTwoBytes val_ref;
47716         CHECK((*env)->GetArrayLength(env, val) == 32);
47717         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47718         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
47719 }
47720
47721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47722         LDKRevokeAndACK this_ptr_conv;
47723         this_ptr_conv.inner = untag_ptr(this_ptr);
47724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47726         this_ptr_conv.is_owned = false;
47727         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47728         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
47729         return ret_arr;
47730 }
47731
47732 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) {
47733         LDKRevokeAndACK this_ptr_conv;
47734         this_ptr_conv.inner = untag_ptr(this_ptr);
47735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47737         this_ptr_conv.is_owned = false;
47738         LDKPublicKey val_ref;
47739         CHECK((*env)->GetArrayLength(env, val) == 33);
47740         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47741         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47742 }
47743
47744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
47745         LDKThirtyTwoBytes channel_id_arg_ref;
47746         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47747         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47748         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
47749         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
47750         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
47751         LDKPublicKey next_per_commitment_point_arg_ref;
47752         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
47753         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
47754         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
47755         int64_t ret_ref = 0;
47756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47758         return ret_ref;
47759 }
47760
47761 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
47762         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
47763         int64_t ret_ref = 0;
47764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47766         return ret_ref;
47767 }
47768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47769         LDKRevokeAndACK arg_conv;
47770         arg_conv.inner = untag_ptr(arg);
47771         arg_conv.is_owned = ptr_is_owned(arg);
47772         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47773         arg_conv.is_owned = false;
47774         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
47775         return ret_conv;
47776 }
47777
47778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47779         LDKRevokeAndACK orig_conv;
47780         orig_conv.inner = untag_ptr(orig);
47781         orig_conv.is_owned = ptr_is_owned(orig);
47782         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47783         orig_conv.is_owned = false;
47784         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
47785         int64_t ret_ref = 0;
47786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47788         return ret_ref;
47789 }
47790
47791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47792         LDKRevokeAndACK a_conv;
47793         a_conv.inner = untag_ptr(a);
47794         a_conv.is_owned = ptr_is_owned(a);
47795         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47796         a_conv.is_owned = false;
47797         LDKRevokeAndACK b_conv;
47798         b_conv.inner = untag_ptr(b);
47799         b_conv.is_owned = ptr_is_owned(b);
47800         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47801         b_conv.is_owned = false;
47802         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
47803         return ret_conv;
47804 }
47805
47806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47807         LDKUpdateFee this_obj_conv;
47808         this_obj_conv.inner = untag_ptr(this_obj);
47809         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47811         UpdateFee_free(this_obj_conv);
47812 }
47813
47814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47815         LDKUpdateFee this_ptr_conv;
47816         this_ptr_conv.inner = untag_ptr(this_ptr);
47817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47819         this_ptr_conv.is_owned = false;
47820         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47821         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
47822         return ret_arr;
47823 }
47824
47825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47826         LDKUpdateFee this_ptr_conv;
47827         this_ptr_conv.inner = untag_ptr(this_ptr);
47828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47830         this_ptr_conv.is_owned = false;
47831         LDKThirtyTwoBytes val_ref;
47832         CHECK((*env)->GetArrayLength(env, val) == 32);
47833         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47834         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
47835 }
47836
47837 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
47838         LDKUpdateFee this_ptr_conv;
47839         this_ptr_conv.inner = untag_ptr(this_ptr);
47840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47842         this_ptr_conv.is_owned = false;
47843         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
47844         return ret_conv;
47845 }
47846
47847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47848         LDKUpdateFee this_ptr_conv;
47849         this_ptr_conv.inner = untag_ptr(this_ptr);
47850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47852         this_ptr_conv.is_owned = false;
47853         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
47854 }
47855
47856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
47857         LDKThirtyTwoBytes channel_id_arg_ref;
47858         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
47859         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
47860         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
47861         int64_t ret_ref = 0;
47862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47864         return ret_ref;
47865 }
47866
47867 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
47868         LDKUpdateFee ret_var = UpdateFee_clone(arg);
47869         int64_t ret_ref = 0;
47870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47872         return ret_ref;
47873 }
47874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47875         LDKUpdateFee arg_conv;
47876         arg_conv.inner = untag_ptr(arg);
47877         arg_conv.is_owned = ptr_is_owned(arg);
47878         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47879         arg_conv.is_owned = false;
47880         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
47881         return ret_conv;
47882 }
47883
47884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47885         LDKUpdateFee orig_conv;
47886         orig_conv.inner = untag_ptr(orig);
47887         orig_conv.is_owned = ptr_is_owned(orig);
47888         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47889         orig_conv.is_owned = false;
47890         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
47891         int64_t ret_ref = 0;
47892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47894         return ret_ref;
47895 }
47896
47897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47898         LDKUpdateFee a_conv;
47899         a_conv.inner = untag_ptr(a);
47900         a_conv.is_owned = ptr_is_owned(a);
47901         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47902         a_conv.is_owned = false;
47903         LDKUpdateFee b_conv;
47904         b_conv.inner = untag_ptr(b);
47905         b_conv.is_owned = ptr_is_owned(b);
47906         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47907         b_conv.is_owned = false;
47908         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
47909         return ret_conv;
47910 }
47911
47912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47913         LDKChannelReestablish this_obj_conv;
47914         this_obj_conv.inner = untag_ptr(this_obj);
47915         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47917         ChannelReestablish_free(this_obj_conv);
47918 }
47919
47920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47921         LDKChannelReestablish this_ptr_conv;
47922         this_ptr_conv.inner = untag_ptr(this_ptr);
47923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47925         this_ptr_conv.is_owned = false;
47926         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47927         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
47928         return ret_arr;
47929 }
47930
47931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47932         LDKChannelReestablish this_ptr_conv;
47933         this_ptr_conv.inner = untag_ptr(this_ptr);
47934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47936         this_ptr_conv.is_owned = false;
47937         LDKThirtyTwoBytes val_ref;
47938         CHECK((*env)->GetArrayLength(env, val) == 32);
47939         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47940         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
47941 }
47942
47943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
47944         LDKChannelReestablish this_ptr_conv;
47945         this_ptr_conv.inner = untag_ptr(this_ptr);
47946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47948         this_ptr_conv.is_owned = false;
47949         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
47950         return ret_conv;
47951 }
47952
47953 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) {
47954         LDKChannelReestablish this_ptr_conv;
47955         this_ptr_conv.inner = untag_ptr(this_ptr);
47956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47958         this_ptr_conv.is_owned = false;
47959         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
47960 }
47961
47962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
47963         LDKChannelReestablish this_ptr_conv;
47964         this_ptr_conv.inner = untag_ptr(this_ptr);
47965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47967         this_ptr_conv.is_owned = false;
47968         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
47969         return ret_conv;
47970 }
47971
47972 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) {
47973         LDKChannelReestablish this_ptr_conv;
47974         this_ptr_conv.inner = untag_ptr(this_ptr);
47975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47977         this_ptr_conv.is_owned = false;
47978         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
47979 }
47980
47981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
47982         LDKChannelReestablish this_ptr_conv;
47983         this_ptr_conv.inner = untag_ptr(this_ptr);
47984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47986         this_ptr_conv.is_owned = false;
47987         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47988         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
47989         return ret_arr;
47990 }
47991
47992 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) {
47993         LDKChannelReestablish this_ptr_conv;
47994         this_ptr_conv.inner = untag_ptr(this_ptr);
47995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47997         this_ptr_conv.is_owned = false;
47998         LDKThirtyTwoBytes val_ref;
47999         CHECK((*env)->GetArrayLength(env, val) == 32);
48000         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48001         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
48002 }
48003
48004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48005         LDKChannelReestablish this_ptr_conv;
48006         this_ptr_conv.inner = untag_ptr(this_ptr);
48007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48009         this_ptr_conv.is_owned = false;
48010         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48011         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
48012         return ret_arr;
48013 }
48014
48015 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) {
48016         LDKChannelReestablish this_ptr_conv;
48017         this_ptr_conv.inner = untag_ptr(this_ptr);
48018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48020         this_ptr_conv.is_owned = false;
48021         LDKPublicKey val_ref;
48022         CHECK((*env)->GetArrayLength(env, val) == 33);
48023         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48024         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
48025 }
48026
48027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
48028         LDKChannelReestablish this_ptr_conv;
48029         this_ptr_conv.inner = untag_ptr(this_ptr);
48030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48032         this_ptr_conv.is_owned = false;
48033         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
48034         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
48035         int64_t ret_ref = tag_ptr(ret_copy, true);
48036         return ret_ref;
48037 }
48038
48039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48040         LDKChannelReestablish this_ptr_conv;
48041         this_ptr_conv.inner = untag_ptr(this_ptr);
48042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48044         this_ptr_conv.is_owned = false;
48045         void* val_ptr = untag_ptr(val);
48046         CHECK_ACCESS(val_ptr);
48047         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
48048         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
48049         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
48050 }
48051
48052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, int64_t next_funding_txid_arg) {
48053         LDKThirtyTwoBytes channel_id_arg_ref;
48054         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
48055         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
48056         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
48057         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
48058         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
48059         LDKPublicKey my_current_per_commitment_point_arg_ref;
48060         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
48061         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
48062         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
48063         CHECK_ACCESS(next_funding_txid_arg_ptr);
48064         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
48065         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
48066         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_ref, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
48067         int64_t ret_ref = 0;
48068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48070         return ret_ref;
48071 }
48072
48073 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
48074         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
48075         int64_t ret_ref = 0;
48076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48078         return ret_ref;
48079 }
48080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48081         LDKChannelReestablish arg_conv;
48082         arg_conv.inner = untag_ptr(arg);
48083         arg_conv.is_owned = ptr_is_owned(arg);
48084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48085         arg_conv.is_owned = false;
48086         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
48087         return ret_conv;
48088 }
48089
48090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48091         LDKChannelReestablish orig_conv;
48092         orig_conv.inner = untag_ptr(orig);
48093         orig_conv.is_owned = ptr_is_owned(orig);
48094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48095         orig_conv.is_owned = false;
48096         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
48097         int64_t ret_ref = 0;
48098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48100         return ret_ref;
48101 }
48102
48103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48104         LDKChannelReestablish a_conv;
48105         a_conv.inner = untag_ptr(a);
48106         a_conv.is_owned = ptr_is_owned(a);
48107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48108         a_conv.is_owned = false;
48109         LDKChannelReestablish b_conv;
48110         b_conv.inner = untag_ptr(b);
48111         b_conv.is_owned = ptr_is_owned(b);
48112         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48113         b_conv.is_owned = false;
48114         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
48115         return ret_conv;
48116 }
48117
48118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48119         LDKAnnouncementSignatures this_obj_conv;
48120         this_obj_conv.inner = untag_ptr(this_obj);
48121         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48123         AnnouncementSignatures_free(this_obj_conv);
48124 }
48125
48126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48127         LDKAnnouncementSignatures this_ptr_conv;
48128         this_ptr_conv.inner = untag_ptr(this_ptr);
48129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48131         this_ptr_conv.is_owned = false;
48132         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48133         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
48134         return ret_arr;
48135 }
48136
48137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48138         LDKAnnouncementSignatures this_ptr_conv;
48139         this_ptr_conv.inner = untag_ptr(this_ptr);
48140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48142         this_ptr_conv.is_owned = false;
48143         LDKThirtyTwoBytes val_ref;
48144         CHECK((*env)->GetArrayLength(env, val) == 32);
48145         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48146         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
48147 }
48148
48149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48150         LDKAnnouncementSignatures this_ptr_conv;
48151         this_ptr_conv.inner = untag_ptr(this_ptr);
48152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48154         this_ptr_conv.is_owned = false;
48155         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
48156         return ret_conv;
48157 }
48158
48159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48160         LDKAnnouncementSignatures this_ptr_conv;
48161         this_ptr_conv.inner = untag_ptr(this_ptr);
48162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48164         this_ptr_conv.is_owned = false;
48165         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
48166 }
48167
48168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48169         LDKAnnouncementSignatures this_ptr_conv;
48170         this_ptr_conv.inner = untag_ptr(this_ptr);
48171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48173         this_ptr_conv.is_owned = false;
48174         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48175         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
48176         return ret_arr;
48177 }
48178
48179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48180         LDKAnnouncementSignatures this_ptr_conv;
48181         this_ptr_conv.inner = untag_ptr(this_ptr);
48182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48184         this_ptr_conv.is_owned = false;
48185         LDKECDSASignature val_ref;
48186         CHECK((*env)->GetArrayLength(env, val) == 64);
48187         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48188         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
48189 }
48190
48191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48192         LDKAnnouncementSignatures this_ptr_conv;
48193         this_ptr_conv.inner = untag_ptr(this_ptr);
48194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48196         this_ptr_conv.is_owned = false;
48197         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48198         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
48199         return ret_arr;
48200 }
48201
48202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48203         LDKAnnouncementSignatures this_ptr_conv;
48204         this_ptr_conv.inner = untag_ptr(this_ptr);
48205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48207         this_ptr_conv.is_owned = false;
48208         LDKECDSASignature val_ref;
48209         CHECK((*env)->GetArrayLength(env, val) == 64);
48210         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48211         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
48212 }
48213
48214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
48215         LDKThirtyTwoBytes channel_id_arg_ref;
48216         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
48217         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
48218         LDKECDSASignature node_signature_arg_ref;
48219         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
48220         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
48221         LDKECDSASignature bitcoin_signature_arg_ref;
48222         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
48223         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
48224         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
48225         int64_t ret_ref = 0;
48226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48228         return ret_ref;
48229 }
48230
48231 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
48232         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
48233         int64_t ret_ref = 0;
48234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48236         return ret_ref;
48237 }
48238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48239         LDKAnnouncementSignatures arg_conv;
48240         arg_conv.inner = untag_ptr(arg);
48241         arg_conv.is_owned = ptr_is_owned(arg);
48242         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48243         arg_conv.is_owned = false;
48244         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
48245         return ret_conv;
48246 }
48247
48248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48249         LDKAnnouncementSignatures orig_conv;
48250         orig_conv.inner = untag_ptr(orig);
48251         orig_conv.is_owned = ptr_is_owned(orig);
48252         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48253         orig_conv.is_owned = false;
48254         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
48255         int64_t ret_ref = 0;
48256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48258         return ret_ref;
48259 }
48260
48261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48262         LDKAnnouncementSignatures a_conv;
48263         a_conv.inner = untag_ptr(a);
48264         a_conv.is_owned = ptr_is_owned(a);
48265         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48266         a_conv.is_owned = false;
48267         LDKAnnouncementSignatures b_conv;
48268         b_conv.inner = untag_ptr(b);
48269         b_conv.is_owned = ptr_is_owned(b);
48270         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48271         b_conv.is_owned = false;
48272         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
48273         return ret_conv;
48274 }
48275
48276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48277         if (!ptr_is_owned(this_ptr)) return;
48278         void* this_ptr_ptr = untag_ptr(this_ptr);
48279         CHECK_ACCESS(this_ptr_ptr);
48280         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
48281         FREE(untag_ptr(this_ptr));
48282         SocketAddress_free(this_ptr_conv);
48283 }
48284
48285 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
48286         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48287         *ret_copy = SocketAddress_clone(arg);
48288         int64_t ret_ref = tag_ptr(ret_copy, true);
48289         return ret_ref;
48290 }
48291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48292         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
48293         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
48294         return ret_conv;
48295 }
48296
48297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48298         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
48299         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48300         *ret_copy = SocketAddress_clone(orig_conv);
48301         int64_t ret_ref = tag_ptr(ret_copy, true);
48302         return ret_ref;
48303 }
48304
48305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
48306         LDKFourBytes addr_ref;
48307         CHECK((*env)->GetArrayLength(env, addr) == 4);
48308         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
48309         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48310         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
48311         int64_t ret_ref = tag_ptr(ret_copy, true);
48312         return ret_ref;
48313 }
48314
48315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
48316         LDKSixteenBytes addr_ref;
48317         CHECK((*env)->GetArrayLength(env, addr) == 16);
48318         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
48319         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48320         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
48321         int64_t ret_ref = tag_ptr(ret_copy, true);
48322         return ret_ref;
48323 }
48324
48325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
48326         LDKTwelveBytes a_ref;
48327         CHECK((*env)->GetArrayLength(env, a) == 12);
48328         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
48329         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48330         *ret_copy = SocketAddress_onion_v2(a_ref);
48331         int64_t ret_ref = tag_ptr(ret_copy, true);
48332         return ret_ref;
48333 }
48334
48335 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) {
48336         LDKThirtyTwoBytes ed25519_pubkey_ref;
48337         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
48338         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
48339         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48340         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
48341         int64_t ret_ref = tag_ptr(ret_copy, true);
48342         return ret_ref;
48343 }
48344
48345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
48346         LDKHostname hostname_conv;
48347         hostname_conv.inner = untag_ptr(hostname);
48348         hostname_conv.is_owned = ptr_is_owned(hostname);
48349         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
48350         hostname_conv = Hostname_clone(&hostname_conv);
48351         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48352         *ret_copy = SocketAddress_hostname(hostname_conv, port);
48353         int64_t ret_ref = tag_ptr(ret_copy, true);
48354         return ret_ref;
48355 }
48356
48357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48358         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
48359         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
48360         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
48361         return ret_conv;
48362 }
48363
48364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
48365         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
48366         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
48367         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48368         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48369         CVec_u8Z_free(ret_var);
48370         return ret_arr;
48371 }
48372
48373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48374         LDKu8slice ser_ref;
48375         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48376         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48377         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
48378         *ret_conv = SocketAddress_read(ser_ref);
48379         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48380         return tag_ptr(ret_conv, true);
48381 }
48382
48383 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48384         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
48385         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
48386         return ret_conv;
48387 }
48388
48389 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
48390         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
48391         return ret_conv;
48392 }
48393
48394 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
48395         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
48396         return ret_conv;
48397 }
48398
48399 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
48400         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
48401         return ret_conv;
48402 }
48403
48404 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
48405         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
48406         return ret_conv;
48407 }
48408
48409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48410         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
48411         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
48412         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
48413         return ret_conv;
48414 }
48415
48416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
48417         LDKStr host_conv = java_to_owned_str(env, host);
48418         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
48419         *ret_conv = parse_onion_address(host_conv, port);
48420         return tag_ptr(ret_conv, true);
48421 }
48422
48423 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48424         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
48425         LDKStr ret_str = SocketAddress_to_str(o_conv);
48426         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48427         Str_free(ret_str);
48428         return ret_conv;
48429 }
48430
48431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48432         LDKStr s_conv = java_to_owned_str(env, s);
48433         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
48434         *ret_conv = SocketAddress_from_str(s_conv);
48435         return tag_ptr(ret_conv, true);
48436 }
48437
48438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48439         if (!ptr_is_owned(this_ptr)) return;
48440         void* this_ptr_ptr = untag_ptr(this_ptr);
48441         CHECK_ACCESS(this_ptr_ptr);
48442         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
48443         FREE(untag_ptr(this_ptr));
48444         UnsignedGossipMessage_free(this_ptr_conv);
48445 }
48446
48447 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
48448         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48449         *ret_copy = UnsignedGossipMessage_clone(arg);
48450         int64_t ret_ref = tag_ptr(ret_copy, true);
48451         return ret_ref;
48452 }
48453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48454         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
48455         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
48456         return ret_conv;
48457 }
48458
48459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48460         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
48461         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48462         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
48463         int64_t ret_ref = tag_ptr(ret_copy, true);
48464         return ret_ref;
48465 }
48466
48467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
48468         LDKUnsignedChannelAnnouncement a_conv;
48469         a_conv.inner = untag_ptr(a);
48470         a_conv.is_owned = ptr_is_owned(a);
48471         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48472         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
48473         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48474         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
48475         int64_t ret_ref = tag_ptr(ret_copy, true);
48476         return ret_ref;
48477 }
48478
48479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
48480         LDKUnsignedChannelUpdate a_conv;
48481         a_conv.inner = untag_ptr(a);
48482         a_conv.is_owned = ptr_is_owned(a);
48483         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48484         a_conv = UnsignedChannelUpdate_clone(&a_conv);
48485         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48486         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
48487         int64_t ret_ref = tag_ptr(ret_copy, true);
48488         return ret_ref;
48489 }
48490
48491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
48492         LDKUnsignedNodeAnnouncement a_conv;
48493         a_conv.inner = untag_ptr(a);
48494         a_conv.is_owned = ptr_is_owned(a);
48495         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48496         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
48497         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48498         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
48499         int64_t ret_ref = tag_ptr(ret_copy, true);
48500         return ret_ref;
48501 }
48502
48503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
48504         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
48505         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
48506         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48507         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48508         CVec_u8Z_free(ret_var);
48509         return ret_arr;
48510 }
48511
48512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48513         LDKUnsignedNodeAnnouncement this_obj_conv;
48514         this_obj_conv.inner = untag_ptr(this_obj);
48515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48517         UnsignedNodeAnnouncement_free(this_obj_conv);
48518 }
48519
48520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
48521         LDKUnsignedNodeAnnouncement this_ptr_conv;
48522         this_ptr_conv.inner = untag_ptr(this_ptr);
48523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48525         this_ptr_conv.is_owned = false;
48526         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
48527         int64_t ret_ref = 0;
48528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48530         return ret_ref;
48531 }
48532
48533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48534         LDKUnsignedNodeAnnouncement this_ptr_conv;
48535         this_ptr_conv.inner = untag_ptr(this_ptr);
48536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48538         this_ptr_conv.is_owned = false;
48539         LDKNodeFeatures val_conv;
48540         val_conv.inner = untag_ptr(val);
48541         val_conv.is_owned = ptr_is_owned(val);
48542         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48543         val_conv = NodeFeatures_clone(&val_conv);
48544         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
48545 }
48546
48547 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
48548         LDKUnsignedNodeAnnouncement this_ptr_conv;
48549         this_ptr_conv.inner = untag_ptr(this_ptr);
48550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48552         this_ptr_conv.is_owned = false;
48553         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
48554         return ret_conv;
48555 }
48556
48557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48558         LDKUnsignedNodeAnnouncement this_ptr_conv;
48559         this_ptr_conv.inner = untag_ptr(this_ptr);
48560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48562         this_ptr_conv.is_owned = false;
48563         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
48564 }
48565
48566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48567         LDKUnsignedNodeAnnouncement this_ptr_conv;
48568         this_ptr_conv.inner = untag_ptr(this_ptr);
48569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48571         this_ptr_conv.is_owned = false;
48572         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
48573         int64_t ret_ref = 0;
48574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48576         return ret_ref;
48577 }
48578
48579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48580         LDKUnsignedNodeAnnouncement this_ptr_conv;
48581         this_ptr_conv.inner = untag_ptr(this_ptr);
48582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48584         this_ptr_conv.is_owned = false;
48585         LDKNodeId val_conv;
48586         val_conv.inner = untag_ptr(val);
48587         val_conv.is_owned = ptr_is_owned(val);
48588         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48589         val_conv = NodeId_clone(&val_conv);
48590         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
48591 }
48592
48593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
48594         LDKUnsignedNodeAnnouncement this_ptr_conv;
48595         this_ptr_conv.inner = untag_ptr(this_ptr);
48596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48598         this_ptr_conv.is_owned = false;
48599         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
48600         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
48601         return ret_arr;
48602 }
48603
48604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48605         LDKUnsignedNodeAnnouncement this_ptr_conv;
48606         this_ptr_conv.inner = untag_ptr(this_ptr);
48607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48609         this_ptr_conv.is_owned = false;
48610         LDKThreeBytes val_ref;
48611         CHECK((*env)->GetArrayLength(env, val) == 3);
48612         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
48613         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
48614 }
48615
48616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
48617         LDKUnsignedNodeAnnouncement this_ptr_conv;
48618         this_ptr_conv.inner = untag_ptr(this_ptr);
48619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48621         this_ptr_conv.is_owned = false;
48622         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
48623         int64_t ret_ref = 0;
48624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48626         return ret_ref;
48627 }
48628
48629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48630         LDKUnsignedNodeAnnouncement this_ptr_conv;
48631         this_ptr_conv.inner = untag_ptr(this_ptr);
48632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48634         this_ptr_conv.is_owned = false;
48635         LDKNodeAlias val_conv;
48636         val_conv.inner = untag_ptr(val);
48637         val_conv.is_owned = ptr_is_owned(val);
48638         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48639         val_conv = NodeAlias_clone(&val_conv);
48640         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
48641 }
48642
48643 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
48644         LDKUnsignedNodeAnnouncement this_ptr_conv;
48645         this_ptr_conv.inner = untag_ptr(this_ptr);
48646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48648         this_ptr_conv.is_owned = false;
48649         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
48650         int64_tArray ret_arr = NULL;
48651         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
48652         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
48653         for (size_t p = 0; p < ret_var.datalen; p++) {
48654                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48655                 *ret_conv_15_copy = ret_var.data[p];
48656                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
48657                 ret_arr_ptr[p] = ret_conv_15_ref;
48658         }
48659         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
48660         FREE(ret_var.data);
48661         return ret_arr;
48662 }
48663
48664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
48665         LDKUnsignedNodeAnnouncement this_ptr_conv;
48666         this_ptr_conv.inner = untag_ptr(this_ptr);
48667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48669         this_ptr_conv.is_owned = false;
48670         LDKCVec_SocketAddressZ val_constr;
48671         val_constr.datalen = (*env)->GetArrayLength(env, val);
48672         if (val_constr.datalen > 0)
48673                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
48674         else
48675                 val_constr.data = NULL;
48676         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
48677         for (size_t p = 0; p < val_constr.datalen; p++) {
48678                 int64_t val_conv_15 = val_vals[p];
48679                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
48680                 CHECK_ACCESS(val_conv_15_ptr);
48681                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
48682                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
48683                 val_constr.data[p] = val_conv_15_conv;
48684         }
48685         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
48686         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
48687 }
48688
48689 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
48690         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
48691         int64_t ret_ref = 0;
48692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48694         return ret_ref;
48695 }
48696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48697         LDKUnsignedNodeAnnouncement arg_conv;
48698         arg_conv.inner = untag_ptr(arg);
48699         arg_conv.is_owned = ptr_is_owned(arg);
48700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48701         arg_conv.is_owned = false;
48702         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
48703         return ret_conv;
48704 }
48705
48706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48707         LDKUnsignedNodeAnnouncement orig_conv;
48708         orig_conv.inner = untag_ptr(orig);
48709         orig_conv.is_owned = ptr_is_owned(orig);
48710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48711         orig_conv.is_owned = false;
48712         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
48713         int64_t ret_ref = 0;
48714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48716         return ret_ref;
48717 }
48718
48719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48720         LDKUnsignedNodeAnnouncement a_conv;
48721         a_conv.inner = untag_ptr(a);
48722         a_conv.is_owned = ptr_is_owned(a);
48723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48724         a_conv.is_owned = false;
48725         LDKUnsignedNodeAnnouncement b_conv;
48726         b_conv.inner = untag_ptr(b);
48727         b_conv.is_owned = ptr_is_owned(b);
48728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48729         b_conv.is_owned = false;
48730         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
48731         return ret_conv;
48732 }
48733
48734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48735         LDKNodeAnnouncement this_obj_conv;
48736         this_obj_conv.inner = untag_ptr(this_obj);
48737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48739         NodeAnnouncement_free(this_obj_conv);
48740 }
48741
48742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48743         LDKNodeAnnouncement this_ptr_conv;
48744         this_ptr_conv.inner = untag_ptr(this_ptr);
48745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48747         this_ptr_conv.is_owned = false;
48748         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48749         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
48750         return ret_arr;
48751 }
48752
48753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48754         LDKNodeAnnouncement this_ptr_conv;
48755         this_ptr_conv.inner = untag_ptr(this_ptr);
48756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48758         this_ptr_conv.is_owned = false;
48759         LDKECDSASignature val_ref;
48760         CHECK((*env)->GetArrayLength(env, val) == 64);
48761         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
48762         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
48763 }
48764
48765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
48766         LDKNodeAnnouncement this_ptr_conv;
48767         this_ptr_conv.inner = untag_ptr(this_ptr);
48768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48770         this_ptr_conv.is_owned = false;
48771         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
48772         int64_t ret_ref = 0;
48773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48775         return ret_ref;
48776 }
48777
48778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48779         LDKNodeAnnouncement this_ptr_conv;
48780         this_ptr_conv.inner = untag_ptr(this_ptr);
48781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48783         this_ptr_conv.is_owned = false;
48784         LDKUnsignedNodeAnnouncement val_conv;
48785         val_conv.inner = untag_ptr(val);
48786         val_conv.is_owned = ptr_is_owned(val);
48787         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48788         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
48789         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
48790 }
48791
48792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
48793         LDKECDSASignature signature_arg_ref;
48794         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
48795         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
48796         LDKUnsignedNodeAnnouncement contents_arg_conv;
48797         contents_arg_conv.inner = untag_ptr(contents_arg);
48798         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48799         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48800         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
48801         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
48802         int64_t ret_ref = 0;
48803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48805         return ret_ref;
48806 }
48807
48808 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
48809         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
48810         int64_t ret_ref = 0;
48811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48813         return ret_ref;
48814 }
48815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48816         LDKNodeAnnouncement arg_conv;
48817         arg_conv.inner = untag_ptr(arg);
48818         arg_conv.is_owned = ptr_is_owned(arg);
48819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48820         arg_conv.is_owned = false;
48821         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
48822         return ret_conv;
48823 }
48824
48825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48826         LDKNodeAnnouncement orig_conv;
48827         orig_conv.inner = untag_ptr(orig);
48828         orig_conv.is_owned = ptr_is_owned(orig);
48829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48830         orig_conv.is_owned = false;
48831         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
48832         int64_t ret_ref = 0;
48833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48835         return ret_ref;
48836 }
48837
48838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48839         LDKNodeAnnouncement a_conv;
48840         a_conv.inner = untag_ptr(a);
48841         a_conv.is_owned = ptr_is_owned(a);
48842         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48843         a_conv.is_owned = false;
48844         LDKNodeAnnouncement b_conv;
48845         b_conv.inner = untag_ptr(b);
48846         b_conv.is_owned = ptr_is_owned(b);
48847         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48848         b_conv.is_owned = false;
48849         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
48850         return ret_conv;
48851 }
48852
48853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48854         LDKUnsignedChannelAnnouncement this_obj_conv;
48855         this_obj_conv.inner = untag_ptr(this_obj);
48856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48858         UnsignedChannelAnnouncement_free(this_obj_conv);
48859 }
48860
48861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
48862         LDKUnsignedChannelAnnouncement this_ptr_conv;
48863         this_ptr_conv.inner = untag_ptr(this_ptr);
48864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48866         this_ptr_conv.is_owned = false;
48867         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
48868         int64_t ret_ref = 0;
48869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48871         return ret_ref;
48872 }
48873
48874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48875         LDKUnsignedChannelAnnouncement this_ptr_conv;
48876         this_ptr_conv.inner = untag_ptr(this_ptr);
48877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48879         this_ptr_conv.is_owned = false;
48880         LDKChannelFeatures val_conv;
48881         val_conv.inner = untag_ptr(val);
48882         val_conv.is_owned = ptr_is_owned(val);
48883         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48884         val_conv = ChannelFeatures_clone(&val_conv);
48885         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
48886 }
48887
48888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
48889         LDKUnsignedChannelAnnouncement this_ptr_conv;
48890         this_ptr_conv.inner = untag_ptr(this_ptr);
48891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48893         this_ptr_conv.is_owned = false;
48894         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48895         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
48896         return ret_arr;
48897 }
48898
48899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48900         LDKUnsignedChannelAnnouncement this_ptr_conv;
48901         this_ptr_conv.inner = untag_ptr(this_ptr);
48902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48904         this_ptr_conv.is_owned = false;
48905         LDKThirtyTwoBytes val_ref;
48906         CHECK((*env)->GetArrayLength(env, val) == 32);
48907         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48908         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
48909 }
48910
48911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48912         LDKUnsignedChannelAnnouncement this_ptr_conv;
48913         this_ptr_conv.inner = untag_ptr(this_ptr);
48914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48916         this_ptr_conv.is_owned = false;
48917         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
48918         return ret_conv;
48919 }
48920
48921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48922         LDKUnsignedChannelAnnouncement this_ptr_conv;
48923         this_ptr_conv.inner = untag_ptr(this_ptr);
48924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48926         this_ptr_conv.is_owned = false;
48927         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
48928 }
48929
48930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48931         LDKUnsignedChannelAnnouncement this_ptr_conv;
48932         this_ptr_conv.inner = untag_ptr(this_ptr);
48933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48935         this_ptr_conv.is_owned = false;
48936         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
48937         int64_t ret_ref = 0;
48938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48940         return ret_ref;
48941 }
48942
48943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48944         LDKUnsignedChannelAnnouncement this_ptr_conv;
48945         this_ptr_conv.inner = untag_ptr(this_ptr);
48946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48948         this_ptr_conv.is_owned = false;
48949         LDKNodeId val_conv;
48950         val_conv.inner = untag_ptr(val);
48951         val_conv.is_owned = ptr_is_owned(val);
48952         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48953         val_conv = NodeId_clone(&val_conv);
48954         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
48955 }
48956
48957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
48958         LDKUnsignedChannelAnnouncement this_ptr_conv;
48959         this_ptr_conv.inner = untag_ptr(this_ptr);
48960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48962         this_ptr_conv.is_owned = false;
48963         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
48964         int64_t ret_ref = 0;
48965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48967         return ret_ref;
48968 }
48969
48970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48971         LDKUnsignedChannelAnnouncement this_ptr_conv;
48972         this_ptr_conv.inner = untag_ptr(this_ptr);
48973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48975         this_ptr_conv.is_owned = false;
48976         LDKNodeId val_conv;
48977         val_conv.inner = untag_ptr(val);
48978         val_conv.is_owned = ptr_is_owned(val);
48979         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48980         val_conv = NodeId_clone(&val_conv);
48981         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
48982 }
48983
48984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
48985         LDKUnsignedChannelAnnouncement this_ptr_conv;
48986         this_ptr_conv.inner = untag_ptr(this_ptr);
48987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48989         this_ptr_conv.is_owned = false;
48990         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
48991         int64_t ret_ref = 0;
48992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48994         return ret_ref;
48995 }
48996
48997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48998         LDKUnsignedChannelAnnouncement this_ptr_conv;
48999         this_ptr_conv.inner = untag_ptr(this_ptr);
49000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49002         this_ptr_conv.is_owned = false;
49003         LDKNodeId val_conv;
49004         val_conv.inner = untag_ptr(val);
49005         val_conv.is_owned = ptr_is_owned(val);
49006         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49007         val_conv = NodeId_clone(&val_conv);
49008         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
49009 }
49010
49011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
49012         LDKUnsignedChannelAnnouncement this_ptr_conv;
49013         this_ptr_conv.inner = untag_ptr(this_ptr);
49014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49016         this_ptr_conv.is_owned = false;
49017         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
49018         int64_t ret_ref = 0;
49019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49021         return ret_ref;
49022 }
49023
49024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49025         LDKUnsignedChannelAnnouncement this_ptr_conv;
49026         this_ptr_conv.inner = untag_ptr(this_ptr);
49027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49029         this_ptr_conv.is_owned = false;
49030         LDKNodeId val_conv;
49031         val_conv.inner = untag_ptr(val);
49032         val_conv.is_owned = ptr_is_owned(val);
49033         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49034         val_conv = NodeId_clone(&val_conv);
49035         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
49036 }
49037
49038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
49039         LDKUnsignedChannelAnnouncement this_ptr_conv;
49040         this_ptr_conv.inner = untag_ptr(this_ptr);
49041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49043         this_ptr_conv.is_owned = false;
49044         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
49045         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49046         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49047         CVec_u8Z_free(ret_var);
49048         return ret_arr;
49049 }
49050
49051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49052         LDKUnsignedChannelAnnouncement this_ptr_conv;
49053         this_ptr_conv.inner = untag_ptr(this_ptr);
49054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49056         this_ptr_conv.is_owned = false;
49057         LDKCVec_u8Z val_ref;
49058         val_ref.datalen = (*env)->GetArrayLength(env, val);
49059         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49060         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
49061         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
49062 }
49063
49064 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) {
49065         LDKChannelFeatures features_arg_conv;
49066         features_arg_conv.inner = untag_ptr(features_arg);
49067         features_arg_conv.is_owned = ptr_is_owned(features_arg);
49068         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
49069         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
49070         LDKThirtyTwoBytes chain_hash_arg_ref;
49071         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49072         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49073         LDKNodeId node_id_1_arg_conv;
49074         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
49075         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
49076         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
49077         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
49078         LDKNodeId node_id_2_arg_conv;
49079         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
49080         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
49081         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
49082         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
49083         LDKNodeId bitcoin_key_1_arg_conv;
49084         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
49085         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
49086         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
49087         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
49088         LDKNodeId bitcoin_key_2_arg_conv;
49089         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
49090         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
49091         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
49092         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
49093         LDKCVec_u8Z excess_data_arg_ref;
49094         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
49095         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49096         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
49097         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);
49098         int64_t ret_ref = 0;
49099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49101         return ret_ref;
49102 }
49103
49104 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
49105         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
49106         int64_t ret_ref = 0;
49107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49109         return ret_ref;
49110 }
49111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49112         LDKUnsignedChannelAnnouncement arg_conv;
49113         arg_conv.inner = untag_ptr(arg);
49114         arg_conv.is_owned = ptr_is_owned(arg);
49115         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49116         arg_conv.is_owned = false;
49117         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
49118         return ret_conv;
49119 }
49120
49121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49122         LDKUnsignedChannelAnnouncement orig_conv;
49123         orig_conv.inner = untag_ptr(orig);
49124         orig_conv.is_owned = ptr_is_owned(orig);
49125         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49126         orig_conv.is_owned = false;
49127         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
49128         int64_t ret_ref = 0;
49129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49131         return ret_ref;
49132 }
49133
49134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49135         LDKUnsignedChannelAnnouncement a_conv;
49136         a_conv.inner = untag_ptr(a);
49137         a_conv.is_owned = ptr_is_owned(a);
49138         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49139         a_conv.is_owned = false;
49140         LDKUnsignedChannelAnnouncement b_conv;
49141         b_conv.inner = untag_ptr(b);
49142         b_conv.is_owned = ptr_is_owned(b);
49143         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49144         b_conv.is_owned = false;
49145         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
49146         return ret_conv;
49147 }
49148
49149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49150         LDKChannelAnnouncement this_obj_conv;
49151         this_obj_conv.inner = untag_ptr(this_obj);
49152         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49154         ChannelAnnouncement_free(this_obj_conv);
49155 }
49156
49157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
49158         LDKChannelAnnouncement this_ptr_conv;
49159         this_ptr_conv.inner = untag_ptr(this_ptr);
49160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49162         this_ptr_conv.is_owned = false;
49163         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49164         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
49165         return ret_arr;
49166 }
49167
49168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49169         LDKChannelAnnouncement this_ptr_conv;
49170         this_ptr_conv.inner = untag_ptr(this_ptr);
49171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49173         this_ptr_conv.is_owned = false;
49174         LDKECDSASignature val_ref;
49175         CHECK((*env)->GetArrayLength(env, val) == 64);
49176         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49177         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
49178 }
49179
49180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
49181         LDKChannelAnnouncement this_ptr_conv;
49182         this_ptr_conv.inner = untag_ptr(this_ptr);
49183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49185         this_ptr_conv.is_owned = false;
49186         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49187         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
49188         return ret_arr;
49189 }
49190
49191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49192         LDKChannelAnnouncement this_ptr_conv;
49193         this_ptr_conv.inner = untag_ptr(this_ptr);
49194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49196         this_ptr_conv.is_owned = false;
49197         LDKECDSASignature val_ref;
49198         CHECK((*env)->GetArrayLength(env, val) == 64);
49199         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49200         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
49201 }
49202
49203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
49204         LDKChannelAnnouncement this_ptr_conv;
49205         this_ptr_conv.inner = untag_ptr(this_ptr);
49206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49208         this_ptr_conv.is_owned = false;
49209         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49210         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
49211         return ret_arr;
49212 }
49213
49214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49215         LDKChannelAnnouncement this_ptr_conv;
49216         this_ptr_conv.inner = untag_ptr(this_ptr);
49217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49219         this_ptr_conv.is_owned = false;
49220         LDKECDSASignature val_ref;
49221         CHECK((*env)->GetArrayLength(env, val) == 64);
49222         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49223         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
49224 }
49225
49226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
49227         LDKChannelAnnouncement this_ptr_conv;
49228         this_ptr_conv.inner = untag_ptr(this_ptr);
49229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49231         this_ptr_conv.is_owned = false;
49232         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49233         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
49234         return ret_arr;
49235 }
49236
49237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49238         LDKChannelAnnouncement this_ptr_conv;
49239         this_ptr_conv.inner = untag_ptr(this_ptr);
49240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49242         this_ptr_conv.is_owned = false;
49243         LDKECDSASignature val_ref;
49244         CHECK((*env)->GetArrayLength(env, val) == 64);
49245         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49246         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
49247 }
49248
49249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
49250         LDKChannelAnnouncement this_ptr_conv;
49251         this_ptr_conv.inner = untag_ptr(this_ptr);
49252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49254         this_ptr_conv.is_owned = false;
49255         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
49256         int64_t ret_ref = 0;
49257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49259         return ret_ref;
49260 }
49261
49262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49263         LDKChannelAnnouncement this_ptr_conv;
49264         this_ptr_conv.inner = untag_ptr(this_ptr);
49265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49267         this_ptr_conv.is_owned = false;
49268         LDKUnsignedChannelAnnouncement val_conv;
49269         val_conv.inner = untag_ptr(val);
49270         val_conv.is_owned = ptr_is_owned(val);
49271         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49272         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
49273         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
49274 }
49275
49276 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) {
49277         LDKECDSASignature node_signature_1_arg_ref;
49278         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
49279         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
49280         LDKECDSASignature node_signature_2_arg_ref;
49281         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
49282         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
49283         LDKECDSASignature bitcoin_signature_1_arg_ref;
49284         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
49285         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
49286         LDKECDSASignature bitcoin_signature_2_arg_ref;
49287         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
49288         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
49289         LDKUnsignedChannelAnnouncement contents_arg_conv;
49290         contents_arg_conv.inner = untag_ptr(contents_arg);
49291         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49292         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49293         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
49294         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);
49295         int64_t ret_ref = 0;
49296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49298         return ret_ref;
49299 }
49300
49301 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
49302         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
49303         int64_t ret_ref = 0;
49304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49306         return ret_ref;
49307 }
49308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49309         LDKChannelAnnouncement arg_conv;
49310         arg_conv.inner = untag_ptr(arg);
49311         arg_conv.is_owned = ptr_is_owned(arg);
49312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49313         arg_conv.is_owned = false;
49314         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
49315         return ret_conv;
49316 }
49317
49318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49319         LDKChannelAnnouncement orig_conv;
49320         orig_conv.inner = untag_ptr(orig);
49321         orig_conv.is_owned = ptr_is_owned(orig);
49322         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49323         orig_conv.is_owned = false;
49324         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
49325         int64_t ret_ref = 0;
49326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49328         return ret_ref;
49329 }
49330
49331 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49332         LDKChannelAnnouncement a_conv;
49333         a_conv.inner = untag_ptr(a);
49334         a_conv.is_owned = ptr_is_owned(a);
49335         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49336         a_conv.is_owned = false;
49337         LDKChannelAnnouncement b_conv;
49338         b_conv.inner = untag_ptr(b);
49339         b_conv.is_owned = ptr_is_owned(b);
49340         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49341         b_conv.is_owned = false;
49342         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
49343         return ret_conv;
49344 }
49345
49346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49347         LDKUnsignedChannelUpdate this_obj_conv;
49348         this_obj_conv.inner = untag_ptr(this_obj);
49349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49351         UnsignedChannelUpdate_free(this_obj_conv);
49352 }
49353
49354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49355         LDKUnsignedChannelUpdate this_ptr_conv;
49356         this_ptr_conv.inner = untag_ptr(this_ptr);
49357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49359         this_ptr_conv.is_owned = false;
49360         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49361         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
49362         return ret_arr;
49363 }
49364
49365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49366         LDKUnsignedChannelUpdate this_ptr_conv;
49367         this_ptr_conv.inner = untag_ptr(this_ptr);
49368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49370         this_ptr_conv.is_owned = false;
49371         LDKThirtyTwoBytes val_ref;
49372         CHECK((*env)->GetArrayLength(env, val) == 32);
49373         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49374         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
49375 }
49376
49377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49378         LDKUnsignedChannelUpdate this_ptr_conv;
49379         this_ptr_conv.inner = untag_ptr(this_ptr);
49380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49382         this_ptr_conv.is_owned = false;
49383         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
49384         return ret_conv;
49385 }
49386
49387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49388         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
49394 }
49395
49396 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
49397         LDKUnsignedChannelUpdate this_ptr_conv;
49398         this_ptr_conv.inner = untag_ptr(this_ptr);
49399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49401         this_ptr_conv.is_owned = false;
49402         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
49403         return ret_conv;
49404 }
49405
49406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49407         LDKUnsignedChannelUpdate this_ptr_conv;
49408         this_ptr_conv.inner = untag_ptr(this_ptr);
49409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49411         this_ptr_conv.is_owned = false;
49412         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
49413 }
49414
49415 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
49416         LDKUnsignedChannelUpdate this_ptr_conv;
49417         this_ptr_conv.inner = untag_ptr(this_ptr);
49418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49420         this_ptr_conv.is_owned = false;
49421         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
49422         return ret_conv;
49423 }
49424
49425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
49426         LDKUnsignedChannelUpdate this_ptr_conv;
49427         this_ptr_conv.inner = untag_ptr(this_ptr);
49428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49430         this_ptr_conv.is_owned = false;
49431         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
49432 }
49433
49434 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
49435         LDKUnsignedChannelUpdate this_ptr_conv;
49436         this_ptr_conv.inner = untag_ptr(this_ptr);
49437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49439         this_ptr_conv.is_owned = false;
49440         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
49441         return ret_conv;
49442 }
49443
49444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
49445         LDKUnsignedChannelUpdate this_ptr_conv;
49446         this_ptr_conv.inner = untag_ptr(this_ptr);
49447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49449         this_ptr_conv.is_owned = false;
49450         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
49451 }
49452
49453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49454         LDKUnsignedChannelUpdate this_ptr_conv;
49455         this_ptr_conv.inner = untag_ptr(this_ptr);
49456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49458         this_ptr_conv.is_owned = false;
49459         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
49460         return ret_conv;
49461 }
49462
49463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49464         LDKUnsignedChannelUpdate this_ptr_conv;
49465         this_ptr_conv.inner = untag_ptr(this_ptr);
49466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49468         this_ptr_conv.is_owned = false;
49469         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
49470 }
49471
49472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49473         LDKUnsignedChannelUpdate this_ptr_conv;
49474         this_ptr_conv.inner = untag_ptr(this_ptr);
49475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49477         this_ptr_conv.is_owned = false;
49478         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
49479         return ret_conv;
49480 }
49481
49482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49483         LDKUnsignedChannelUpdate this_ptr_conv;
49484         this_ptr_conv.inner = untag_ptr(this_ptr);
49485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49487         this_ptr_conv.is_owned = false;
49488         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
49489 }
49490
49491 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
49492         LDKUnsignedChannelUpdate this_ptr_conv;
49493         this_ptr_conv.inner = untag_ptr(this_ptr);
49494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49496         this_ptr_conv.is_owned = false;
49497         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
49498         return ret_conv;
49499 }
49500
49501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49502         LDKUnsignedChannelUpdate this_ptr_conv;
49503         this_ptr_conv.inner = untag_ptr(this_ptr);
49504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49506         this_ptr_conv.is_owned = false;
49507         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
49508 }
49509
49510 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
49511         LDKUnsignedChannelUpdate this_ptr_conv;
49512         this_ptr_conv.inner = untag_ptr(this_ptr);
49513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49515         this_ptr_conv.is_owned = false;
49516         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
49517         return ret_conv;
49518 }
49519
49520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49521         LDKUnsignedChannelUpdate this_ptr_conv;
49522         this_ptr_conv.inner = untag_ptr(this_ptr);
49523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49525         this_ptr_conv.is_owned = false;
49526         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
49527 }
49528
49529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
49530         LDKUnsignedChannelUpdate this_ptr_conv;
49531         this_ptr_conv.inner = untag_ptr(this_ptr);
49532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49534         this_ptr_conv.is_owned = false;
49535         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
49536         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49537         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49538         CVec_u8Z_free(ret_var);
49539         return ret_arr;
49540 }
49541
49542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49543         LDKUnsignedChannelUpdate this_ptr_conv;
49544         this_ptr_conv.inner = untag_ptr(this_ptr);
49545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49547         this_ptr_conv.is_owned = false;
49548         LDKCVec_u8Z val_ref;
49549         val_ref.datalen = (*env)->GetArrayLength(env, val);
49550         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49551         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
49552         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
49553 }
49554
49555 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) {
49556         LDKThirtyTwoBytes chain_hash_arg_ref;
49557         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49558         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49559         LDKCVec_u8Z excess_data_arg_ref;
49560         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
49561         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49562         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
49563         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);
49564         int64_t ret_ref = 0;
49565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49567         return ret_ref;
49568 }
49569
49570 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
49571         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
49572         int64_t ret_ref = 0;
49573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49575         return ret_ref;
49576 }
49577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49578         LDKUnsignedChannelUpdate arg_conv;
49579         arg_conv.inner = untag_ptr(arg);
49580         arg_conv.is_owned = ptr_is_owned(arg);
49581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49582         arg_conv.is_owned = false;
49583         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
49584         return ret_conv;
49585 }
49586
49587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49588         LDKUnsignedChannelUpdate orig_conv;
49589         orig_conv.inner = untag_ptr(orig);
49590         orig_conv.is_owned = ptr_is_owned(orig);
49591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49592         orig_conv.is_owned = false;
49593         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
49594         int64_t ret_ref = 0;
49595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49597         return ret_ref;
49598 }
49599
49600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49601         LDKUnsignedChannelUpdate a_conv;
49602         a_conv.inner = untag_ptr(a);
49603         a_conv.is_owned = ptr_is_owned(a);
49604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49605         a_conv.is_owned = false;
49606         LDKUnsignedChannelUpdate b_conv;
49607         b_conv.inner = untag_ptr(b);
49608         b_conv.is_owned = ptr_is_owned(b);
49609         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49610         b_conv.is_owned = false;
49611         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
49612         return ret_conv;
49613 }
49614
49615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49616         LDKChannelUpdate this_obj_conv;
49617         this_obj_conv.inner = untag_ptr(this_obj);
49618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49620         ChannelUpdate_free(this_obj_conv);
49621 }
49622
49623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
49624         LDKChannelUpdate this_ptr_conv;
49625         this_ptr_conv.inner = untag_ptr(this_ptr);
49626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49628         this_ptr_conv.is_owned = false;
49629         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49630         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
49631         return ret_arr;
49632 }
49633
49634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49635         LDKChannelUpdate this_ptr_conv;
49636         this_ptr_conv.inner = untag_ptr(this_ptr);
49637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49639         this_ptr_conv.is_owned = false;
49640         LDKECDSASignature val_ref;
49641         CHECK((*env)->GetArrayLength(env, val) == 64);
49642         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49643         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
49644 }
49645
49646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
49647         LDKChannelUpdate this_ptr_conv;
49648         this_ptr_conv.inner = untag_ptr(this_ptr);
49649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49651         this_ptr_conv.is_owned = false;
49652         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
49653         int64_t ret_ref = 0;
49654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49656         return ret_ref;
49657 }
49658
49659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49660         LDKChannelUpdate this_ptr_conv;
49661         this_ptr_conv.inner = untag_ptr(this_ptr);
49662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49664         this_ptr_conv.is_owned = false;
49665         LDKUnsignedChannelUpdate val_conv;
49666         val_conv.inner = untag_ptr(val);
49667         val_conv.is_owned = ptr_is_owned(val);
49668         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49669         val_conv = UnsignedChannelUpdate_clone(&val_conv);
49670         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
49671 }
49672
49673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
49674         LDKECDSASignature signature_arg_ref;
49675         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
49676         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
49677         LDKUnsignedChannelUpdate contents_arg_conv;
49678         contents_arg_conv.inner = untag_ptr(contents_arg);
49679         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49680         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49681         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
49682         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
49683         int64_t ret_ref = 0;
49684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49686         return ret_ref;
49687 }
49688
49689 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
49690         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
49691         int64_t ret_ref = 0;
49692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49694         return ret_ref;
49695 }
49696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49697         LDKChannelUpdate arg_conv;
49698         arg_conv.inner = untag_ptr(arg);
49699         arg_conv.is_owned = ptr_is_owned(arg);
49700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49701         arg_conv.is_owned = false;
49702         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
49703         return ret_conv;
49704 }
49705
49706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49707         LDKChannelUpdate orig_conv;
49708         orig_conv.inner = untag_ptr(orig);
49709         orig_conv.is_owned = ptr_is_owned(orig);
49710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49711         orig_conv.is_owned = false;
49712         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
49713         int64_t ret_ref = 0;
49714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49716         return ret_ref;
49717 }
49718
49719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49720         LDKChannelUpdate a_conv;
49721         a_conv.inner = untag_ptr(a);
49722         a_conv.is_owned = ptr_is_owned(a);
49723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49724         a_conv.is_owned = false;
49725         LDKChannelUpdate b_conv;
49726         b_conv.inner = untag_ptr(b);
49727         b_conv.is_owned = ptr_is_owned(b);
49728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49729         b_conv.is_owned = false;
49730         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
49731         return ret_conv;
49732 }
49733
49734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49735         LDKQueryChannelRange this_obj_conv;
49736         this_obj_conv.inner = untag_ptr(this_obj);
49737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49739         QueryChannelRange_free(this_obj_conv);
49740 }
49741
49742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49743         LDKQueryChannelRange this_ptr_conv;
49744         this_ptr_conv.inner = untag_ptr(this_ptr);
49745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49747         this_ptr_conv.is_owned = false;
49748         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49749         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
49750         return ret_arr;
49751 }
49752
49753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49754         LDKQueryChannelRange this_ptr_conv;
49755         this_ptr_conv.inner = untag_ptr(this_ptr);
49756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49758         this_ptr_conv.is_owned = false;
49759         LDKThirtyTwoBytes val_ref;
49760         CHECK((*env)->GetArrayLength(env, val) == 32);
49761         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49762         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49763 }
49764
49765 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
49766         LDKQueryChannelRange this_ptr_conv;
49767         this_ptr_conv.inner = untag_ptr(this_ptr);
49768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49770         this_ptr_conv.is_owned = false;
49771         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
49772         return ret_conv;
49773 }
49774
49775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49776         LDKQueryChannelRange this_ptr_conv;
49777         this_ptr_conv.inner = untag_ptr(this_ptr);
49778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49780         this_ptr_conv.is_owned = false;
49781         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
49782 }
49783
49784 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
49785         LDKQueryChannelRange this_ptr_conv;
49786         this_ptr_conv.inner = untag_ptr(this_ptr);
49787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49789         this_ptr_conv.is_owned = false;
49790         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
49791         return ret_conv;
49792 }
49793
49794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49795         LDKQueryChannelRange this_ptr_conv;
49796         this_ptr_conv.inner = untag_ptr(this_ptr);
49797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49799         this_ptr_conv.is_owned = false;
49800         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49801 }
49802
49803 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) {
49804         LDKThirtyTwoBytes chain_hash_arg_ref;
49805         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49806         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49807         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
49808         int64_t ret_ref = 0;
49809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49811         return ret_ref;
49812 }
49813
49814 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
49815         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
49816         int64_t ret_ref = 0;
49817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49819         return ret_ref;
49820 }
49821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49822         LDKQueryChannelRange arg_conv;
49823         arg_conv.inner = untag_ptr(arg);
49824         arg_conv.is_owned = ptr_is_owned(arg);
49825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49826         arg_conv.is_owned = false;
49827         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
49828         return ret_conv;
49829 }
49830
49831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49832         LDKQueryChannelRange orig_conv;
49833         orig_conv.inner = untag_ptr(orig);
49834         orig_conv.is_owned = ptr_is_owned(orig);
49835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49836         orig_conv.is_owned = false;
49837         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
49838         int64_t ret_ref = 0;
49839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49841         return ret_ref;
49842 }
49843
49844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49845         LDKQueryChannelRange a_conv;
49846         a_conv.inner = untag_ptr(a);
49847         a_conv.is_owned = ptr_is_owned(a);
49848         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49849         a_conv.is_owned = false;
49850         LDKQueryChannelRange b_conv;
49851         b_conv.inner = untag_ptr(b);
49852         b_conv.is_owned = ptr_is_owned(b);
49853         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49854         b_conv.is_owned = false;
49855         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
49856         return ret_conv;
49857 }
49858
49859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49860         LDKReplyChannelRange this_obj_conv;
49861         this_obj_conv.inner = untag_ptr(this_obj);
49862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49864         ReplyChannelRange_free(this_obj_conv);
49865 }
49866
49867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49868         LDKReplyChannelRange this_ptr_conv;
49869         this_ptr_conv.inner = untag_ptr(this_ptr);
49870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49872         this_ptr_conv.is_owned = false;
49873         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49874         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
49875         return ret_arr;
49876 }
49877
49878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49879         LDKReplyChannelRange this_ptr_conv;
49880         this_ptr_conv.inner = untag_ptr(this_ptr);
49881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49883         this_ptr_conv.is_owned = false;
49884         LDKThirtyTwoBytes val_ref;
49885         CHECK((*env)->GetArrayLength(env, val) == 32);
49886         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49887         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49888 }
49889
49890 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
49891         LDKReplyChannelRange this_ptr_conv;
49892         this_ptr_conv.inner = untag_ptr(this_ptr);
49893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49895         this_ptr_conv.is_owned = false;
49896         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
49897         return ret_conv;
49898 }
49899
49900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49901         LDKReplyChannelRange this_ptr_conv;
49902         this_ptr_conv.inner = untag_ptr(this_ptr);
49903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49905         this_ptr_conv.is_owned = false;
49906         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
49907 }
49908
49909 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
49910         LDKReplyChannelRange this_ptr_conv;
49911         this_ptr_conv.inner = untag_ptr(this_ptr);
49912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49914         this_ptr_conv.is_owned = false;
49915         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
49916         return ret_conv;
49917 }
49918
49919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49920         LDKReplyChannelRange this_ptr_conv;
49921         this_ptr_conv.inner = untag_ptr(this_ptr);
49922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49924         this_ptr_conv.is_owned = false;
49925         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49926 }
49927
49928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
49929         LDKReplyChannelRange this_ptr_conv;
49930         this_ptr_conv.inner = untag_ptr(this_ptr);
49931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49933         this_ptr_conv.is_owned = false;
49934         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
49935         return ret_conv;
49936 }
49937
49938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
49939         LDKReplyChannelRange this_ptr_conv;
49940         this_ptr_conv.inner = untag_ptr(this_ptr);
49941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49943         this_ptr_conv.is_owned = false;
49944         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
49945 }
49946
49947 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
49948         LDKReplyChannelRange this_ptr_conv;
49949         this_ptr_conv.inner = untag_ptr(this_ptr);
49950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49952         this_ptr_conv.is_owned = false;
49953         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
49954         int64_tArray ret_arr = NULL;
49955         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49956         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49957         for (size_t g = 0; g < ret_var.datalen; g++) {
49958                 int64_t ret_conv_6_conv = ret_var.data[g];
49959                 ret_arr_ptr[g] = ret_conv_6_conv;
49960         }
49961         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49962         FREE(ret_var.data);
49963         return ret_arr;
49964 }
49965
49966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
49967         LDKReplyChannelRange this_ptr_conv;
49968         this_ptr_conv.inner = untag_ptr(this_ptr);
49969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49971         this_ptr_conv.is_owned = false;
49972         LDKCVec_u64Z val_constr;
49973         val_constr.datalen = (*env)->GetArrayLength(env, val);
49974         if (val_constr.datalen > 0)
49975                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49976         else
49977                 val_constr.data = NULL;
49978         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
49979         for (size_t g = 0; g < val_constr.datalen; g++) {
49980                 int64_t val_conv_6 = val_vals[g];
49981                 val_constr.data[g] = val_conv_6;
49982         }
49983         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
49984         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
49985 }
49986
49987 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) {
49988         LDKThirtyTwoBytes chain_hash_arg_ref;
49989         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49990         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49991         LDKCVec_u64Z short_channel_ids_arg_constr;
49992         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
49993         if (short_channel_ids_arg_constr.datalen > 0)
49994                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49995         else
49996                 short_channel_ids_arg_constr.data = NULL;
49997         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
49998         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49999                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
50000                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
50001         }
50002         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
50003         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
50004         int64_t ret_ref = 0;
50005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50007         return ret_ref;
50008 }
50009
50010 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
50011         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
50012         int64_t ret_ref = 0;
50013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50015         return ret_ref;
50016 }
50017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50018         LDKReplyChannelRange arg_conv;
50019         arg_conv.inner = untag_ptr(arg);
50020         arg_conv.is_owned = ptr_is_owned(arg);
50021         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50022         arg_conv.is_owned = false;
50023         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
50024         return ret_conv;
50025 }
50026
50027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50028         LDKReplyChannelRange orig_conv;
50029         orig_conv.inner = untag_ptr(orig);
50030         orig_conv.is_owned = ptr_is_owned(orig);
50031         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50032         orig_conv.is_owned = false;
50033         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
50034         int64_t ret_ref = 0;
50035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50037         return ret_ref;
50038 }
50039
50040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50041         LDKReplyChannelRange a_conv;
50042         a_conv.inner = untag_ptr(a);
50043         a_conv.is_owned = ptr_is_owned(a);
50044         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50045         a_conv.is_owned = false;
50046         LDKReplyChannelRange b_conv;
50047         b_conv.inner = untag_ptr(b);
50048         b_conv.is_owned = ptr_is_owned(b);
50049         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50050         b_conv.is_owned = false;
50051         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
50052         return ret_conv;
50053 }
50054
50055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50056         LDKQueryShortChannelIds this_obj_conv;
50057         this_obj_conv.inner = untag_ptr(this_obj);
50058         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50060         QueryShortChannelIds_free(this_obj_conv);
50061 }
50062
50063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50064         LDKQueryShortChannelIds this_ptr_conv;
50065         this_ptr_conv.inner = untag_ptr(this_ptr);
50066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50068         this_ptr_conv.is_owned = false;
50069         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50070         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
50071         return ret_arr;
50072 }
50073
50074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50075         LDKQueryShortChannelIds this_ptr_conv;
50076         this_ptr_conv.inner = untag_ptr(this_ptr);
50077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50079         this_ptr_conv.is_owned = false;
50080         LDKThirtyTwoBytes val_ref;
50081         CHECK((*env)->GetArrayLength(env, val) == 32);
50082         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50083         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
50084 }
50085
50086 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
50087         LDKQueryShortChannelIds this_ptr_conv;
50088         this_ptr_conv.inner = untag_ptr(this_ptr);
50089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50091         this_ptr_conv.is_owned = false;
50092         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
50093         int64_tArray ret_arr = NULL;
50094         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50095         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50096         for (size_t g = 0; g < ret_var.datalen; g++) {
50097                 int64_t ret_conv_6_conv = ret_var.data[g];
50098                 ret_arr_ptr[g] = ret_conv_6_conv;
50099         }
50100         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50101         FREE(ret_var.data);
50102         return ret_arr;
50103 }
50104
50105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50106         LDKQueryShortChannelIds this_ptr_conv;
50107         this_ptr_conv.inner = untag_ptr(this_ptr);
50108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50110         this_ptr_conv.is_owned = false;
50111         LDKCVec_u64Z val_constr;
50112         val_constr.datalen = (*env)->GetArrayLength(env, val);
50113         if (val_constr.datalen > 0)
50114                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
50115         else
50116                 val_constr.data = NULL;
50117         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50118         for (size_t g = 0; g < val_constr.datalen; g++) {
50119                 int64_t val_conv_6 = val_vals[g];
50120                 val_constr.data[g] = val_conv_6;
50121         }
50122         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50123         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
50124 }
50125
50126 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) {
50127         LDKThirtyTwoBytes chain_hash_arg_ref;
50128         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
50129         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
50130         LDKCVec_u64Z short_channel_ids_arg_constr;
50131         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
50132         if (short_channel_ids_arg_constr.datalen > 0)
50133                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
50134         else
50135                 short_channel_ids_arg_constr.data = NULL;
50136         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
50137         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
50138                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
50139                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
50140         }
50141         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
50142         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
50143         int64_t ret_ref = 0;
50144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50146         return ret_ref;
50147 }
50148
50149 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
50150         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
50151         int64_t ret_ref = 0;
50152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50154         return ret_ref;
50155 }
50156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50157         LDKQueryShortChannelIds arg_conv;
50158         arg_conv.inner = untag_ptr(arg);
50159         arg_conv.is_owned = ptr_is_owned(arg);
50160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50161         arg_conv.is_owned = false;
50162         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
50163         return ret_conv;
50164 }
50165
50166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50167         LDKQueryShortChannelIds orig_conv;
50168         orig_conv.inner = untag_ptr(orig);
50169         orig_conv.is_owned = ptr_is_owned(orig);
50170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50171         orig_conv.is_owned = false;
50172         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
50173         int64_t ret_ref = 0;
50174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50176         return ret_ref;
50177 }
50178
50179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50180         LDKQueryShortChannelIds a_conv;
50181         a_conv.inner = untag_ptr(a);
50182         a_conv.is_owned = ptr_is_owned(a);
50183         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50184         a_conv.is_owned = false;
50185         LDKQueryShortChannelIds b_conv;
50186         b_conv.inner = untag_ptr(b);
50187         b_conv.is_owned = ptr_is_owned(b);
50188         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50189         b_conv.is_owned = false;
50190         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
50191         return ret_conv;
50192 }
50193
50194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50195         LDKReplyShortChannelIdsEnd this_obj_conv;
50196         this_obj_conv.inner = untag_ptr(this_obj);
50197         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50199         ReplyShortChannelIdsEnd_free(this_obj_conv);
50200 }
50201
50202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50203         LDKReplyShortChannelIdsEnd this_ptr_conv;
50204         this_ptr_conv.inner = untag_ptr(this_ptr);
50205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50207         this_ptr_conv.is_owned = false;
50208         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50209         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
50210         return ret_arr;
50211 }
50212
50213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50214         LDKReplyShortChannelIdsEnd this_ptr_conv;
50215         this_ptr_conv.inner = untag_ptr(this_ptr);
50216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50218         this_ptr_conv.is_owned = false;
50219         LDKThirtyTwoBytes val_ref;
50220         CHECK((*env)->GetArrayLength(env, val) == 32);
50221         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50222         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
50223 }
50224
50225 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
50226         LDKReplyShortChannelIdsEnd this_ptr_conv;
50227         this_ptr_conv.inner = untag_ptr(this_ptr);
50228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50230         this_ptr_conv.is_owned = false;
50231         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
50232         return ret_conv;
50233 }
50234
50235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
50236         LDKReplyShortChannelIdsEnd this_ptr_conv;
50237         this_ptr_conv.inner = untag_ptr(this_ptr);
50238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50240         this_ptr_conv.is_owned = false;
50241         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
50242 }
50243
50244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
50245         LDKThirtyTwoBytes chain_hash_arg_ref;
50246         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
50247         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
50248         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
50249         int64_t ret_ref = 0;
50250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50252         return ret_ref;
50253 }
50254
50255 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
50256         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
50257         int64_t ret_ref = 0;
50258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50260         return ret_ref;
50261 }
50262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50263         LDKReplyShortChannelIdsEnd arg_conv;
50264         arg_conv.inner = untag_ptr(arg);
50265         arg_conv.is_owned = ptr_is_owned(arg);
50266         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50267         arg_conv.is_owned = false;
50268         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
50269         return ret_conv;
50270 }
50271
50272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50273         LDKReplyShortChannelIdsEnd orig_conv;
50274         orig_conv.inner = untag_ptr(orig);
50275         orig_conv.is_owned = ptr_is_owned(orig);
50276         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50277         orig_conv.is_owned = false;
50278         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
50279         int64_t ret_ref = 0;
50280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50282         return ret_ref;
50283 }
50284
50285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50286         LDKReplyShortChannelIdsEnd a_conv;
50287         a_conv.inner = untag_ptr(a);
50288         a_conv.is_owned = ptr_is_owned(a);
50289         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50290         a_conv.is_owned = false;
50291         LDKReplyShortChannelIdsEnd b_conv;
50292         b_conv.inner = untag_ptr(b);
50293         b_conv.is_owned = ptr_is_owned(b);
50294         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50295         b_conv.is_owned = false;
50296         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
50297         return ret_conv;
50298 }
50299
50300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50301         LDKGossipTimestampFilter this_obj_conv;
50302         this_obj_conv.inner = untag_ptr(this_obj);
50303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50305         GossipTimestampFilter_free(this_obj_conv);
50306 }
50307
50308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50309         LDKGossipTimestampFilter this_ptr_conv;
50310         this_ptr_conv.inner = untag_ptr(this_ptr);
50311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50313         this_ptr_conv.is_owned = false;
50314         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50315         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
50316         return ret_arr;
50317 }
50318
50319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50320         LDKGossipTimestampFilter this_ptr_conv;
50321         this_ptr_conv.inner = untag_ptr(this_ptr);
50322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50324         this_ptr_conv.is_owned = false;
50325         LDKThirtyTwoBytes val_ref;
50326         CHECK((*env)->GetArrayLength(env, val) == 32);
50327         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50328         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
50329 }
50330
50331 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
50332         LDKGossipTimestampFilter this_ptr_conv;
50333         this_ptr_conv.inner = untag_ptr(this_ptr);
50334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50336         this_ptr_conv.is_owned = false;
50337         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
50338         return ret_conv;
50339 }
50340
50341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50342         LDKGossipTimestampFilter this_ptr_conv;
50343         this_ptr_conv.inner = untag_ptr(this_ptr);
50344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50346         this_ptr_conv.is_owned = false;
50347         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
50348 }
50349
50350 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
50351         LDKGossipTimestampFilter this_ptr_conv;
50352         this_ptr_conv.inner = untag_ptr(this_ptr);
50353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50355         this_ptr_conv.is_owned = false;
50356         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
50357         return ret_conv;
50358 }
50359
50360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50361         LDKGossipTimestampFilter this_ptr_conv;
50362         this_ptr_conv.inner = untag_ptr(this_ptr);
50363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50365         this_ptr_conv.is_owned = false;
50366         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
50367 }
50368
50369 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) {
50370         LDKThirtyTwoBytes chain_hash_arg_ref;
50371         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
50372         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
50373         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
50374         int64_t ret_ref = 0;
50375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50377         return ret_ref;
50378 }
50379
50380 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
50381         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
50382         int64_t ret_ref = 0;
50383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50385         return ret_ref;
50386 }
50387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50388         LDKGossipTimestampFilter arg_conv;
50389         arg_conv.inner = untag_ptr(arg);
50390         arg_conv.is_owned = ptr_is_owned(arg);
50391         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50392         arg_conv.is_owned = false;
50393         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
50394         return ret_conv;
50395 }
50396
50397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50398         LDKGossipTimestampFilter orig_conv;
50399         orig_conv.inner = untag_ptr(orig);
50400         orig_conv.is_owned = ptr_is_owned(orig);
50401         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50402         orig_conv.is_owned = false;
50403         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
50404         int64_t ret_ref = 0;
50405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50407         return ret_ref;
50408 }
50409
50410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50411         LDKGossipTimestampFilter a_conv;
50412         a_conv.inner = untag_ptr(a);
50413         a_conv.is_owned = ptr_is_owned(a);
50414         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50415         a_conv.is_owned = false;
50416         LDKGossipTimestampFilter b_conv;
50417         b_conv.inner = untag_ptr(b);
50418         b_conv.is_owned = ptr_is_owned(b);
50419         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50420         b_conv.is_owned = false;
50421         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
50422         return ret_conv;
50423 }
50424
50425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50426         if (!ptr_is_owned(this_ptr)) return;
50427         void* this_ptr_ptr = untag_ptr(this_ptr);
50428         CHECK_ACCESS(this_ptr_ptr);
50429         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
50430         FREE(untag_ptr(this_ptr));
50431         ErrorAction_free(this_ptr_conv);
50432 }
50433
50434 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
50435         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50436         *ret_copy = ErrorAction_clone(arg);
50437         int64_t ret_ref = tag_ptr(ret_copy, true);
50438         return ret_ref;
50439 }
50440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50441         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
50442         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
50443         return ret_conv;
50444 }
50445
50446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50447         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
50448         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50449         *ret_copy = ErrorAction_clone(orig_conv);
50450         int64_t ret_ref = tag_ptr(ret_copy, true);
50451         return ret_ref;
50452 }
50453
50454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
50455         LDKErrorMessage msg_conv;
50456         msg_conv.inner = untag_ptr(msg);
50457         msg_conv.is_owned = ptr_is_owned(msg);
50458         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50459         msg_conv = ErrorMessage_clone(&msg_conv);
50460         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50461         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
50462         int64_t ret_ref = tag_ptr(ret_copy, true);
50463         return ret_ref;
50464 }
50465
50466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
50467         LDKWarningMessage msg_conv;
50468         msg_conv.inner = untag_ptr(msg);
50469         msg_conv.is_owned = ptr_is_owned(msg);
50470         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50471         msg_conv = WarningMessage_clone(&msg_conv);
50472         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50473         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
50474         int64_t ret_ref = tag_ptr(ret_copy, true);
50475         return ret_ref;
50476 }
50477
50478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
50479         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50480         *ret_copy = ErrorAction_ignore_error();
50481         int64_t ret_ref = tag_ptr(ret_copy, true);
50482         return ret_ref;
50483 }
50484
50485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
50486         LDKLevel a_conv = LDKLevel_from_java(env, a);
50487         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50488         *ret_copy = ErrorAction_ignore_and_log(a_conv);
50489         int64_t ret_ref = tag_ptr(ret_copy, true);
50490         return ret_ref;
50491 }
50492
50493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
50494         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50495         *ret_copy = ErrorAction_ignore_duplicate_gossip();
50496         int64_t ret_ref = tag_ptr(ret_copy, true);
50497         return ret_ref;
50498 }
50499
50500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
50501         LDKErrorMessage msg_conv;
50502         msg_conv.inner = untag_ptr(msg);
50503         msg_conv.is_owned = ptr_is_owned(msg);
50504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50505         msg_conv = ErrorMessage_clone(&msg_conv);
50506         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50507         *ret_copy = ErrorAction_send_error_message(msg_conv);
50508         int64_t ret_ref = tag_ptr(ret_copy, true);
50509         return ret_ref;
50510 }
50511
50512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
50513         LDKWarningMessage msg_conv;
50514         msg_conv.inner = untag_ptr(msg);
50515         msg_conv.is_owned = ptr_is_owned(msg);
50516         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50517         msg_conv = WarningMessage_clone(&msg_conv);
50518         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
50519         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50520         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
50521         int64_t ret_ref = tag_ptr(ret_copy, true);
50522         return ret_ref;
50523 }
50524
50525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50526         LDKLightningError this_obj_conv;
50527         this_obj_conv.inner = untag_ptr(this_obj);
50528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50530         LightningError_free(this_obj_conv);
50531 }
50532
50533 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
50534         LDKLightningError this_ptr_conv;
50535         this_ptr_conv.inner = untag_ptr(this_ptr);
50536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50538         this_ptr_conv.is_owned = false;
50539         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
50540         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50541         Str_free(ret_str);
50542         return ret_conv;
50543 }
50544
50545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
50546         LDKLightningError this_ptr_conv;
50547         this_ptr_conv.inner = untag_ptr(this_ptr);
50548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50550         this_ptr_conv.is_owned = false;
50551         LDKStr val_conv = java_to_owned_str(env, val);
50552         LightningError_set_err(&this_ptr_conv, val_conv);
50553 }
50554
50555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
50556         LDKLightningError this_ptr_conv;
50557         this_ptr_conv.inner = untag_ptr(this_ptr);
50558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50560         this_ptr_conv.is_owned = false;
50561         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50562         *ret_copy = LightningError_get_action(&this_ptr_conv);
50563         int64_t ret_ref = tag_ptr(ret_copy, true);
50564         return ret_ref;
50565 }
50566
50567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50568         LDKLightningError this_ptr_conv;
50569         this_ptr_conv.inner = untag_ptr(this_ptr);
50570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50572         this_ptr_conv.is_owned = false;
50573         void* val_ptr = untag_ptr(val);
50574         CHECK_ACCESS(val_ptr);
50575         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
50576         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
50577         LightningError_set_action(&this_ptr_conv, val_conv);
50578 }
50579
50580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
50581         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
50582         void* action_arg_ptr = untag_ptr(action_arg);
50583         CHECK_ACCESS(action_arg_ptr);
50584         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
50585         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
50586         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
50587         int64_t ret_ref = 0;
50588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50590         return ret_ref;
50591 }
50592
50593 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
50594         LDKLightningError ret_var = LightningError_clone(arg);
50595         int64_t ret_ref = 0;
50596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50598         return ret_ref;
50599 }
50600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50601         LDKLightningError arg_conv;
50602         arg_conv.inner = untag_ptr(arg);
50603         arg_conv.is_owned = ptr_is_owned(arg);
50604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50605         arg_conv.is_owned = false;
50606         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
50607         return ret_conv;
50608 }
50609
50610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50611         LDKLightningError orig_conv;
50612         orig_conv.inner = untag_ptr(orig);
50613         orig_conv.is_owned = ptr_is_owned(orig);
50614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50615         orig_conv.is_owned = false;
50616         LDKLightningError ret_var = LightningError_clone(&orig_conv);
50617         int64_t ret_ref = 0;
50618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50620         return ret_ref;
50621 }
50622
50623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50624         LDKCommitmentUpdate this_obj_conv;
50625         this_obj_conv.inner = untag_ptr(this_obj);
50626         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50628         CommitmentUpdate_free(this_obj_conv);
50629 }
50630
50631 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50632         LDKCommitmentUpdate this_ptr_conv;
50633         this_ptr_conv.inner = untag_ptr(this_ptr);
50634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50636         this_ptr_conv.is_owned = false;
50637         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
50638         int64_tArray ret_arr = NULL;
50639         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50640         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50641         for (size_t p = 0; p < ret_var.datalen; p++) {
50642                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
50643                 int64_t ret_conv_15_ref = 0;
50644                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
50645                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
50646                 ret_arr_ptr[p] = ret_conv_15_ref;
50647         }
50648         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50649         FREE(ret_var.data);
50650         return ret_arr;
50651 }
50652
50653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50654         LDKCommitmentUpdate this_ptr_conv;
50655         this_ptr_conv.inner = untag_ptr(this_ptr);
50656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50658         this_ptr_conv.is_owned = false;
50659         LDKCVec_UpdateAddHTLCZ val_constr;
50660         val_constr.datalen = (*env)->GetArrayLength(env, val);
50661         if (val_constr.datalen > 0)
50662                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50663         else
50664                 val_constr.data = NULL;
50665         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50666         for (size_t p = 0; p < val_constr.datalen; p++) {
50667                 int64_t val_conv_15 = val_vals[p];
50668                 LDKUpdateAddHTLC val_conv_15_conv;
50669                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
50670                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
50671                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
50672                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
50673                 val_constr.data[p] = val_conv_15_conv;
50674         }
50675         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50676         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
50677 }
50678
50679 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50680         LDKCommitmentUpdate this_ptr_conv;
50681         this_ptr_conv.inner = untag_ptr(this_ptr);
50682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50684         this_ptr_conv.is_owned = false;
50685         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
50686         int64_tArray ret_arr = NULL;
50687         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50688         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50689         for (size_t t = 0; t < ret_var.datalen; t++) {
50690                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
50691                 int64_t ret_conv_19_ref = 0;
50692                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
50693                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
50694                 ret_arr_ptr[t] = ret_conv_19_ref;
50695         }
50696         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50697         FREE(ret_var.data);
50698         return ret_arr;
50699 }
50700
50701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50702         LDKCommitmentUpdate this_ptr_conv;
50703         this_ptr_conv.inner = untag_ptr(this_ptr);
50704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50706         this_ptr_conv.is_owned = false;
50707         LDKCVec_UpdateFulfillHTLCZ val_constr;
50708         val_constr.datalen = (*env)->GetArrayLength(env, val);
50709         if (val_constr.datalen > 0)
50710                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50711         else
50712                 val_constr.data = NULL;
50713         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50714         for (size_t t = 0; t < val_constr.datalen; t++) {
50715                 int64_t val_conv_19 = val_vals[t];
50716                 LDKUpdateFulfillHTLC val_conv_19_conv;
50717                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
50718                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
50719                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
50720                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
50721                 val_constr.data[t] = val_conv_19_conv;
50722         }
50723         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50724         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
50725 }
50726
50727 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50728         LDKCommitmentUpdate this_ptr_conv;
50729         this_ptr_conv.inner = untag_ptr(this_ptr);
50730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50732         this_ptr_conv.is_owned = false;
50733         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
50734         int64_tArray ret_arr = NULL;
50735         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50736         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50737         for (size_t q = 0; q < ret_var.datalen; q++) {
50738                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
50739                 int64_t ret_conv_16_ref = 0;
50740                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
50741                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
50742                 ret_arr_ptr[q] = ret_conv_16_ref;
50743         }
50744         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50745         FREE(ret_var.data);
50746         return ret_arr;
50747 }
50748
50749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
50750         LDKCommitmentUpdate this_ptr_conv;
50751         this_ptr_conv.inner = untag_ptr(this_ptr);
50752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50754         this_ptr_conv.is_owned = false;
50755         LDKCVec_UpdateFailHTLCZ val_constr;
50756         val_constr.datalen = (*env)->GetArrayLength(env, val);
50757         if (val_constr.datalen > 0)
50758                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50759         else
50760                 val_constr.data = NULL;
50761         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50762         for (size_t q = 0; q < val_constr.datalen; q++) {
50763                 int64_t val_conv_16 = val_vals[q];
50764                 LDKUpdateFailHTLC val_conv_16_conv;
50765                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
50766                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
50767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
50768                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
50769                 val_constr.data[q] = val_conv_16_conv;
50770         }
50771         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50772         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
50773 }
50774
50775 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
50776         LDKCommitmentUpdate this_ptr_conv;
50777         this_ptr_conv.inner = untag_ptr(this_ptr);
50778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50780         this_ptr_conv.is_owned = false;
50781         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
50782         int64_tArray ret_arr = NULL;
50783         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
50784         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
50785         for (size_t z = 0; z < ret_var.datalen; z++) {
50786                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
50787                 int64_t ret_conv_25_ref = 0;
50788                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
50789                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
50790                 ret_arr_ptr[z] = ret_conv_25_ref;
50791         }
50792         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
50793         FREE(ret_var.data);
50794         return ret_arr;
50795 }
50796
50797 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) {
50798         LDKCommitmentUpdate this_ptr_conv;
50799         this_ptr_conv.inner = untag_ptr(this_ptr);
50800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50802         this_ptr_conv.is_owned = false;
50803         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
50804         val_constr.datalen = (*env)->GetArrayLength(env, val);
50805         if (val_constr.datalen > 0)
50806                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50807         else
50808                 val_constr.data = NULL;
50809         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
50810         for (size_t z = 0; z < val_constr.datalen; z++) {
50811                 int64_t val_conv_25 = val_vals[z];
50812                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
50813                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
50814                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
50815                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
50816                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
50817                 val_constr.data[z] = val_conv_25_conv;
50818         }
50819         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
50820         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
50821 }
50822
50823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
50824         LDKCommitmentUpdate this_ptr_conv;
50825         this_ptr_conv.inner = untag_ptr(this_ptr);
50826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50828         this_ptr_conv.is_owned = false;
50829         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
50830         int64_t ret_ref = 0;
50831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50833         return ret_ref;
50834 }
50835
50836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50837         LDKCommitmentUpdate this_ptr_conv;
50838         this_ptr_conv.inner = untag_ptr(this_ptr);
50839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50841         this_ptr_conv.is_owned = false;
50842         LDKUpdateFee val_conv;
50843         val_conv.inner = untag_ptr(val);
50844         val_conv.is_owned = ptr_is_owned(val);
50845         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50846         val_conv = UpdateFee_clone(&val_conv);
50847         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
50848 }
50849
50850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
50851         LDKCommitmentUpdate this_ptr_conv;
50852         this_ptr_conv.inner = untag_ptr(this_ptr);
50853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50855         this_ptr_conv.is_owned = false;
50856         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
50857         int64_t ret_ref = 0;
50858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50860         return ret_ref;
50861 }
50862
50863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50864         LDKCommitmentUpdate this_ptr_conv;
50865         this_ptr_conv.inner = untag_ptr(this_ptr);
50866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50868         this_ptr_conv.is_owned = false;
50869         LDKCommitmentSigned val_conv;
50870         val_conv.inner = untag_ptr(val);
50871         val_conv.is_owned = ptr_is_owned(val);
50872         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50873         val_conv = CommitmentSigned_clone(&val_conv);
50874         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
50875 }
50876
50877 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) {
50878         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
50879         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
50880         if (update_add_htlcs_arg_constr.datalen > 0)
50881                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50882         else
50883                 update_add_htlcs_arg_constr.data = NULL;
50884         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
50885         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
50886                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
50887                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
50888                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
50889                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
50890                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
50891                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
50892                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
50893         }
50894         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
50895         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
50896         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
50897         if (update_fulfill_htlcs_arg_constr.datalen > 0)
50898                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50899         else
50900                 update_fulfill_htlcs_arg_constr.data = NULL;
50901         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
50902         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
50903                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
50904                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
50905                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
50906                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
50907                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
50908                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
50909                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
50910         }
50911         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
50912         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
50913         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
50914         if (update_fail_htlcs_arg_constr.datalen > 0)
50915                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50916         else
50917                 update_fail_htlcs_arg_constr.data = NULL;
50918         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
50919         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
50920                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
50921                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
50922                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
50923                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
50924                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
50925                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
50926                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
50927         }
50928         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
50929         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
50930         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
50931         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
50932                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50933         else
50934                 update_fail_malformed_htlcs_arg_constr.data = NULL;
50935         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
50936         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
50937                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
50938                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
50939                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
50940                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
50941                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
50942                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
50943                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
50944         }
50945         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
50946         LDKUpdateFee update_fee_arg_conv;
50947         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
50948         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
50949         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
50950         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
50951         LDKCommitmentSigned commitment_signed_arg_conv;
50952         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
50953         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
50954         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
50955         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
50956         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);
50957         int64_t ret_ref = 0;
50958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50960         return ret_ref;
50961 }
50962
50963 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
50964         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
50965         int64_t ret_ref = 0;
50966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50968         return ret_ref;
50969 }
50970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50971         LDKCommitmentUpdate arg_conv;
50972         arg_conv.inner = untag_ptr(arg);
50973         arg_conv.is_owned = ptr_is_owned(arg);
50974         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50975         arg_conv.is_owned = false;
50976         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
50977         return ret_conv;
50978 }
50979
50980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50981         LDKCommitmentUpdate orig_conv;
50982         orig_conv.inner = untag_ptr(orig);
50983         orig_conv.is_owned = ptr_is_owned(orig);
50984         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50985         orig_conv.is_owned = false;
50986         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
50987         int64_t ret_ref = 0;
50988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50990         return ret_ref;
50991 }
50992
50993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50994         LDKCommitmentUpdate a_conv;
50995         a_conv.inner = untag_ptr(a);
50996         a_conv.is_owned = ptr_is_owned(a);
50997         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50998         a_conv.is_owned = false;
50999         LDKCommitmentUpdate b_conv;
51000         b_conv.inner = untag_ptr(b);
51001         b_conv.is_owned = ptr_is_owned(b);
51002         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51003         b_conv.is_owned = false;
51004         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
51005         return ret_conv;
51006 }
51007
51008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51009         if (!ptr_is_owned(this_ptr)) return;
51010         void* this_ptr_ptr = untag_ptr(this_ptr);
51011         CHECK_ACCESS(this_ptr_ptr);
51012         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
51013         FREE(untag_ptr(this_ptr));
51014         ChannelMessageHandler_free(this_ptr_conv);
51015 }
51016
51017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51018         if (!ptr_is_owned(this_ptr)) return;
51019         void* this_ptr_ptr = untag_ptr(this_ptr);
51020         CHECK_ACCESS(this_ptr_ptr);
51021         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
51022         FREE(untag_ptr(this_ptr));
51023         RoutingMessageHandler_free(this_ptr_conv);
51024 }
51025
51026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
51027         if (!ptr_is_owned(this_ptr)) return;
51028         void* this_ptr_ptr = untag_ptr(this_ptr);
51029         CHECK_ACCESS(this_ptr_ptr);
51030         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
51031         FREE(untag_ptr(this_ptr));
51032         OnionMessageHandler_free(this_ptr_conv);
51033 }
51034
51035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
51036         LDKAcceptChannel obj_conv;
51037         obj_conv.inner = untag_ptr(obj);
51038         obj_conv.is_owned = ptr_is_owned(obj);
51039         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51040         obj_conv.is_owned = false;
51041         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
51042         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51043         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51044         CVec_u8Z_free(ret_var);
51045         return ret_arr;
51046 }
51047
51048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51049         LDKu8slice ser_ref;
51050         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51051         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51052         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
51053         *ret_conv = AcceptChannel_read(ser_ref);
51054         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51055         return tag_ptr(ret_conv, true);
51056 }
51057
51058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
51059         LDKAcceptChannelV2 obj_conv;
51060         obj_conv.inner = untag_ptr(obj);
51061         obj_conv.is_owned = ptr_is_owned(obj);
51062         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51063         obj_conv.is_owned = false;
51064         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
51065         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51066         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51067         CVec_u8Z_free(ret_var);
51068         return ret_arr;
51069 }
51070
51071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51072         LDKu8slice ser_ref;
51073         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51074         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51075         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
51076         *ret_conv = AcceptChannelV2_read(ser_ref);
51077         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51078         return tag_ptr(ret_conv, true);
51079 }
51080
51081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
51082         LDKTxAddInput obj_conv;
51083         obj_conv.inner = untag_ptr(obj);
51084         obj_conv.is_owned = ptr_is_owned(obj);
51085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51086         obj_conv.is_owned = false;
51087         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
51088         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51089         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51090         CVec_u8Z_free(ret_var);
51091         return ret_arr;
51092 }
51093
51094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51095         LDKu8slice ser_ref;
51096         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51097         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51098         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
51099         *ret_conv = TxAddInput_read(ser_ref);
51100         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51101         return tag_ptr(ret_conv, true);
51102 }
51103
51104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
51105         LDKTxAddOutput obj_conv;
51106         obj_conv.inner = untag_ptr(obj);
51107         obj_conv.is_owned = ptr_is_owned(obj);
51108         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51109         obj_conv.is_owned = false;
51110         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
51111         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51112         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51113         CVec_u8Z_free(ret_var);
51114         return ret_arr;
51115 }
51116
51117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51118         LDKu8slice ser_ref;
51119         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51120         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51121         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
51122         *ret_conv = TxAddOutput_read(ser_ref);
51123         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51124         return tag_ptr(ret_conv, true);
51125 }
51126
51127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
51128         LDKTxRemoveInput obj_conv;
51129         obj_conv.inner = untag_ptr(obj);
51130         obj_conv.is_owned = ptr_is_owned(obj);
51131         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51132         obj_conv.is_owned = false;
51133         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
51134         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51135         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51136         CVec_u8Z_free(ret_var);
51137         return ret_arr;
51138 }
51139
51140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51141         LDKu8slice ser_ref;
51142         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51143         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51144         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
51145         *ret_conv = TxRemoveInput_read(ser_ref);
51146         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51147         return tag_ptr(ret_conv, true);
51148 }
51149
51150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
51151         LDKTxRemoveOutput obj_conv;
51152         obj_conv.inner = untag_ptr(obj);
51153         obj_conv.is_owned = ptr_is_owned(obj);
51154         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51155         obj_conv.is_owned = false;
51156         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
51157         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51158         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51159         CVec_u8Z_free(ret_var);
51160         return ret_arr;
51161 }
51162
51163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51164         LDKu8slice ser_ref;
51165         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51166         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51167         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
51168         *ret_conv = TxRemoveOutput_read(ser_ref);
51169         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51170         return tag_ptr(ret_conv, true);
51171 }
51172
51173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
51174         LDKTxComplete obj_conv;
51175         obj_conv.inner = untag_ptr(obj);
51176         obj_conv.is_owned = ptr_is_owned(obj);
51177         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51178         obj_conv.is_owned = false;
51179         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
51180         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51181         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51182         CVec_u8Z_free(ret_var);
51183         return ret_arr;
51184 }
51185
51186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51187         LDKu8slice ser_ref;
51188         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51189         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51190         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
51191         *ret_conv = TxComplete_read(ser_ref);
51192         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51193         return tag_ptr(ret_conv, true);
51194 }
51195
51196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
51197         LDKTxSignatures obj_conv;
51198         obj_conv.inner = untag_ptr(obj);
51199         obj_conv.is_owned = ptr_is_owned(obj);
51200         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51201         obj_conv.is_owned = false;
51202         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
51203         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51204         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51205         CVec_u8Z_free(ret_var);
51206         return ret_arr;
51207 }
51208
51209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51210         LDKu8slice ser_ref;
51211         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51212         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51213         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
51214         *ret_conv = TxSignatures_read(ser_ref);
51215         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51216         return tag_ptr(ret_conv, true);
51217 }
51218
51219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
51220         LDKTxInitRbf obj_conv;
51221         obj_conv.inner = untag_ptr(obj);
51222         obj_conv.is_owned = ptr_is_owned(obj);
51223         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51224         obj_conv.is_owned = false;
51225         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
51226         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51227         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51228         CVec_u8Z_free(ret_var);
51229         return ret_arr;
51230 }
51231
51232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51233         LDKu8slice ser_ref;
51234         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51235         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51236         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
51237         *ret_conv = TxInitRbf_read(ser_ref);
51238         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51239         return tag_ptr(ret_conv, true);
51240 }
51241
51242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
51243         LDKTxAckRbf obj_conv;
51244         obj_conv.inner = untag_ptr(obj);
51245         obj_conv.is_owned = ptr_is_owned(obj);
51246         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51247         obj_conv.is_owned = false;
51248         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
51249         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51250         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51251         CVec_u8Z_free(ret_var);
51252         return ret_arr;
51253 }
51254
51255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51256         LDKu8slice ser_ref;
51257         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51258         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51259         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
51260         *ret_conv = TxAckRbf_read(ser_ref);
51261         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51262         return tag_ptr(ret_conv, true);
51263 }
51264
51265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
51266         LDKTxAbort obj_conv;
51267         obj_conv.inner = untag_ptr(obj);
51268         obj_conv.is_owned = ptr_is_owned(obj);
51269         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51270         obj_conv.is_owned = false;
51271         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
51272         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51273         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51274         CVec_u8Z_free(ret_var);
51275         return ret_arr;
51276 }
51277
51278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51279         LDKu8slice ser_ref;
51280         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51281         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51282         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
51283         *ret_conv = TxAbort_read(ser_ref);
51284         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51285         return tag_ptr(ret_conv, true);
51286 }
51287
51288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
51289         LDKAnnouncementSignatures obj_conv;
51290         obj_conv.inner = untag_ptr(obj);
51291         obj_conv.is_owned = ptr_is_owned(obj);
51292         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51293         obj_conv.is_owned = false;
51294         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
51295         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51296         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51297         CVec_u8Z_free(ret_var);
51298         return ret_arr;
51299 }
51300
51301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51302         LDKu8slice ser_ref;
51303         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51304         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51305         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
51306         *ret_conv = AnnouncementSignatures_read(ser_ref);
51307         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51308         return tag_ptr(ret_conv, true);
51309 }
51310
51311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
51312         LDKChannelReestablish obj_conv;
51313         obj_conv.inner = untag_ptr(obj);
51314         obj_conv.is_owned = ptr_is_owned(obj);
51315         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51316         obj_conv.is_owned = false;
51317         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
51318         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51319         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51320         CVec_u8Z_free(ret_var);
51321         return ret_arr;
51322 }
51323
51324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51325         LDKu8slice ser_ref;
51326         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51327         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51328         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
51329         *ret_conv = ChannelReestablish_read(ser_ref);
51330         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51331         return tag_ptr(ret_conv, true);
51332 }
51333
51334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
51335         LDKClosingSigned obj_conv;
51336         obj_conv.inner = untag_ptr(obj);
51337         obj_conv.is_owned = ptr_is_owned(obj);
51338         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51339         obj_conv.is_owned = false;
51340         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
51341         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51342         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51343         CVec_u8Z_free(ret_var);
51344         return ret_arr;
51345 }
51346
51347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51348         LDKu8slice ser_ref;
51349         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51350         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51351         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
51352         *ret_conv = ClosingSigned_read(ser_ref);
51353         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51354         return tag_ptr(ret_conv, true);
51355 }
51356
51357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
51358         LDKClosingSignedFeeRange obj_conv;
51359         obj_conv.inner = untag_ptr(obj);
51360         obj_conv.is_owned = ptr_is_owned(obj);
51361         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51362         obj_conv.is_owned = false;
51363         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
51364         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51365         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51366         CVec_u8Z_free(ret_var);
51367         return ret_arr;
51368 }
51369
51370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51371         LDKu8slice ser_ref;
51372         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51373         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51374         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
51375         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
51376         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51377         return tag_ptr(ret_conv, true);
51378 }
51379
51380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
51381         LDKCommitmentSigned obj_conv;
51382         obj_conv.inner = untag_ptr(obj);
51383         obj_conv.is_owned = ptr_is_owned(obj);
51384         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51385         obj_conv.is_owned = false;
51386         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
51387         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51388         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51389         CVec_u8Z_free(ret_var);
51390         return ret_arr;
51391 }
51392
51393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51394         LDKu8slice ser_ref;
51395         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51396         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51397         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
51398         *ret_conv = CommitmentSigned_read(ser_ref);
51399         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51400         return tag_ptr(ret_conv, true);
51401 }
51402
51403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
51404         LDKFundingCreated obj_conv;
51405         obj_conv.inner = untag_ptr(obj);
51406         obj_conv.is_owned = ptr_is_owned(obj);
51407         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51408         obj_conv.is_owned = false;
51409         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
51410         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51411         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51412         CVec_u8Z_free(ret_var);
51413         return ret_arr;
51414 }
51415
51416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51417         LDKu8slice ser_ref;
51418         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51419         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51420         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
51421         *ret_conv = FundingCreated_read(ser_ref);
51422         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51423         return tag_ptr(ret_conv, true);
51424 }
51425
51426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
51427         LDKFundingSigned obj_conv;
51428         obj_conv.inner = untag_ptr(obj);
51429         obj_conv.is_owned = ptr_is_owned(obj);
51430         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51431         obj_conv.is_owned = false;
51432         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
51433         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51434         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51435         CVec_u8Z_free(ret_var);
51436         return ret_arr;
51437 }
51438
51439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51440         LDKu8slice ser_ref;
51441         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51442         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51443         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
51444         *ret_conv = FundingSigned_read(ser_ref);
51445         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51446         return tag_ptr(ret_conv, true);
51447 }
51448
51449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
51450         LDKChannelReady obj_conv;
51451         obj_conv.inner = untag_ptr(obj);
51452         obj_conv.is_owned = ptr_is_owned(obj);
51453         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51454         obj_conv.is_owned = false;
51455         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
51456         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51457         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51458         CVec_u8Z_free(ret_var);
51459         return ret_arr;
51460 }
51461
51462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51463         LDKu8slice ser_ref;
51464         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51465         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51466         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
51467         *ret_conv = ChannelReady_read(ser_ref);
51468         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51469         return tag_ptr(ret_conv, true);
51470 }
51471
51472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
51473         LDKInit obj_conv;
51474         obj_conv.inner = untag_ptr(obj);
51475         obj_conv.is_owned = ptr_is_owned(obj);
51476         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51477         obj_conv.is_owned = false;
51478         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
51479         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51480         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51481         CVec_u8Z_free(ret_var);
51482         return ret_arr;
51483 }
51484
51485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51486         LDKu8slice ser_ref;
51487         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51488         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51489         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
51490         *ret_conv = Init_read(ser_ref);
51491         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51492         return tag_ptr(ret_conv, true);
51493 }
51494
51495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
51496         LDKOpenChannel obj_conv;
51497         obj_conv.inner = untag_ptr(obj);
51498         obj_conv.is_owned = ptr_is_owned(obj);
51499         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51500         obj_conv.is_owned = false;
51501         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
51502         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51503         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51504         CVec_u8Z_free(ret_var);
51505         return ret_arr;
51506 }
51507
51508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51509         LDKu8slice ser_ref;
51510         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51511         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51512         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
51513         *ret_conv = OpenChannel_read(ser_ref);
51514         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51515         return tag_ptr(ret_conv, true);
51516 }
51517
51518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
51519         LDKOpenChannelV2 obj_conv;
51520         obj_conv.inner = untag_ptr(obj);
51521         obj_conv.is_owned = ptr_is_owned(obj);
51522         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51523         obj_conv.is_owned = false;
51524         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
51525         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51526         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51527         CVec_u8Z_free(ret_var);
51528         return ret_arr;
51529 }
51530
51531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51532         LDKu8slice ser_ref;
51533         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51534         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51535         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
51536         *ret_conv = OpenChannelV2_read(ser_ref);
51537         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51538         return tag_ptr(ret_conv, true);
51539 }
51540
51541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
51542         LDKRevokeAndACK obj_conv;
51543         obj_conv.inner = untag_ptr(obj);
51544         obj_conv.is_owned = ptr_is_owned(obj);
51545         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51546         obj_conv.is_owned = false;
51547         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
51548         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51549         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51550         CVec_u8Z_free(ret_var);
51551         return ret_arr;
51552 }
51553
51554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51555         LDKu8slice ser_ref;
51556         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51557         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51558         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
51559         *ret_conv = RevokeAndACK_read(ser_ref);
51560         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51561         return tag_ptr(ret_conv, true);
51562 }
51563
51564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
51565         LDKShutdown obj_conv;
51566         obj_conv.inner = untag_ptr(obj);
51567         obj_conv.is_owned = ptr_is_owned(obj);
51568         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51569         obj_conv.is_owned = false;
51570         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
51571         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51572         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51573         CVec_u8Z_free(ret_var);
51574         return ret_arr;
51575 }
51576
51577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51578         LDKu8slice ser_ref;
51579         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51580         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51581         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
51582         *ret_conv = Shutdown_read(ser_ref);
51583         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51584         return tag_ptr(ret_conv, true);
51585 }
51586
51587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51588         LDKUpdateFailHTLC obj_conv;
51589         obj_conv.inner = untag_ptr(obj);
51590         obj_conv.is_owned = ptr_is_owned(obj);
51591         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51592         obj_conv.is_owned = false;
51593         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
51594         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51595         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51596         CVec_u8Z_free(ret_var);
51597         return ret_arr;
51598 }
51599
51600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51601         LDKu8slice ser_ref;
51602         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51603         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51604         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
51605         *ret_conv = UpdateFailHTLC_read(ser_ref);
51606         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51607         return tag_ptr(ret_conv, true);
51608 }
51609
51610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51611         LDKUpdateFailMalformedHTLC obj_conv;
51612         obj_conv.inner = untag_ptr(obj);
51613         obj_conv.is_owned = ptr_is_owned(obj);
51614         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51615         obj_conv.is_owned = false;
51616         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
51617         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51618         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51619         CVec_u8Z_free(ret_var);
51620         return ret_arr;
51621 }
51622
51623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51624         LDKu8slice ser_ref;
51625         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51626         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51627         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
51628         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
51629         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51630         return tag_ptr(ret_conv, true);
51631 }
51632
51633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
51634         LDKUpdateFee obj_conv;
51635         obj_conv.inner = untag_ptr(obj);
51636         obj_conv.is_owned = ptr_is_owned(obj);
51637         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51638         obj_conv.is_owned = false;
51639         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
51640         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51641         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51642         CVec_u8Z_free(ret_var);
51643         return ret_arr;
51644 }
51645
51646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51647         LDKu8slice ser_ref;
51648         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51649         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51650         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
51651         *ret_conv = UpdateFee_read(ser_ref);
51652         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51653         return tag_ptr(ret_conv, true);
51654 }
51655
51656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51657         LDKUpdateFulfillHTLC obj_conv;
51658         obj_conv.inner = untag_ptr(obj);
51659         obj_conv.is_owned = ptr_is_owned(obj);
51660         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51661         obj_conv.is_owned = false;
51662         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
51663         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51664         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51665         CVec_u8Z_free(ret_var);
51666         return ret_arr;
51667 }
51668
51669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51670         LDKu8slice ser_ref;
51671         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51672         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51673         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
51674         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
51675         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51676         return tag_ptr(ret_conv, true);
51677 }
51678
51679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
51680         LDKUpdateAddHTLC obj_conv;
51681         obj_conv.inner = untag_ptr(obj);
51682         obj_conv.is_owned = ptr_is_owned(obj);
51683         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51684         obj_conv.is_owned = false;
51685         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
51686         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51687         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51688         CVec_u8Z_free(ret_var);
51689         return ret_arr;
51690 }
51691
51692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51693         LDKu8slice ser_ref;
51694         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51695         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51696         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
51697         *ret_conv = UpdateAddHTLC_read(ser_ref);
51698         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51699         return tag_ptr(ret_conv, true);
51700 }
51701
51702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51703         LDKu8slice ser_ref;
51704         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51705         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51706         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
51707         *ret_conv = OnionMessage_read(ser_ref);
51708         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51709         return tag_ptr(ret_conv, true);
51710 }
51711
51712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51713         LDKOnionMessage obj_conv;
51714         obj_conv.inner = untag_ptr(obj);
51715         obj_conv.is_owned = ptr_is_owned(obj);
51716         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51717         obj_conv.is_owned = false;
51718         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
51719         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51720         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51721         CVec_u8Z_free(ret_var);
51722         return ret_arr;
51723 }
51724
51725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
51726         LDKPing obj_conv;
51727         obj_conv.inner = untag_ptr(obj);
51728         obj_conv.is_owned = ptr_is_owned(obj);
51729         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51730         obj_conv.is_owned = false;
51731         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
51732         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51733         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51734         CVec_u8Z_free(ret_var);
51735         return ret_arr;
51736 }
51737
51738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51739         LDKu8slice ser_ref;
51740         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51741         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51742         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
51743         *ret_conv = Ping_read(ser_ref);
51744         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51745         return tag_ptr(ret_conv, true);
51746 }
51747
51748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
51749         LDKPong obj_conv;
51750         obj_conv.inner = untag_ptr(obj);
51751         obj_conv.is_owned = ptr_is_owned(obj);
51752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51753         obj_conv.is_owned = false;
51754         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
51755         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51756         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51757         CVec_u8Z_free(ret_var);
51758         return ret_arr;
51759 }
51760
51761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51762         LDKu8slice ser_ref;
51763         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51764         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51765         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
51766         *ret_conv = Pong_read(ser_ref);
51767         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51768         return tag_ptr(ret_conv, true);
51769 }
51770
51771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51772         LDKUnsignedChannelAnnouncement obj_conv;
51773         obj_conv.inner = untag_ptr(obj);
51774         obj_conv.is_owned = ptr_is_owned(obj);
51775         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51776         obj_conv.is_owned = false;
51777         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
51778         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51779         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51780         CVec_u8Z_free(ret_var);
51781         return ret_arr;
51782 }
51783
51784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51785         LDKu8slice ser_ref;
51786         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51787         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51788         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
51789         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
51790         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51791         return tag_ptr(ret_conv, true);
51792 }
51793
51794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51795         LDKChannelAnnouncement obj_conv;
51796         obj_conv.inner = untag_ptr(obj);
51797         obj_conv.is_owned = ptr_is_owned(obj);
51798         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51799         obj_conv.is_owned = false;
51800         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
51801         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51802         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51803         CVec_u8Z_free(ret_var);
51804         return ret_arr;
51805 }
51806
51807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51808         LDKu8slice ser_ref;
51809         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51810         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51811         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
51812         *ret_conv = ChannelAnnouncement_read(ser_ref);
51813         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51814         return tag_ptr(ret_conv, true);
51815 }
51816
51817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
51818         LDKUnsignedChannelUpdate obj_conv;
51819         obj_conv.inner = untag_ptr(obj);
51820         obj_conv.is_owned = ptr_is_owned(obj);
51821         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51822         obj_conv.is_owned = false;
51823         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
51824         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51825         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51826         CVec_u8Z_free(ret_var);
51827         return ret_arr;
51828 }
51829
51830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51831         LDKu8slice ser_ref;
51832         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51833         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51834         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
51835         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
51836         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51837         return tag_ptr(ret_conv, true);
51838 }
51839
51840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
51841         LDKChannelUpdate obj_conv;
51842         obj_conv.inner = untag_ptr(obj);
51843         obj_conv.is_owned = ptr_is_owned(obj);
51844         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51845         obj_conv.is_owned = false;
51846         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
51847         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51848         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51849         CVec_u8Z_free(ret_var);
51850         return ret_arr;
51851 }
51852
51853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51854         LDKu8slice ser_ref;
51855         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51856         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51857         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
51858         *ret_conv = ChannelUpdate_read(ser_ref);
51859         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51860         return tag_ptr(ret_conv, true);
51861 }
51862
51863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51864         LDKErrorMessage obj_conv;
51865         obj_conv.inner = untag_ptr(obj);
51866         obj_conv.is_owned = ptr_is_owned(obj);
51867         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51868         obj_conv.is_owned = false;
51869         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
51870         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51871         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51872         CVec_u8Z_free(ret_var);
51873         return ret_arr;
51874 }
51875
51876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51877         LDKu8slice ser_ref;
51878         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51879         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51880         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
51881         *ret_conv = ErrorMessage_read(ser_ref);
51882         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51883         return tag_ptr(ret_conv, true);
51884 }
51885
51886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
51887         LDKWarningMessage obj_conv;
51888         obj_conv.inner = untag_ptr(obj);
51889         obj_conv.is_owned = ptr_is_owned(obj);
51890         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51891         obj_conv.is_owned = false;
51892         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
51893         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51894         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51895         CVec_u8Z_free(ret_var);
51896         return ret_arr;
51897 }
51898
51899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51900         LDKu8slice ser_ref;
51901         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51902         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51903         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
51904         *ret_conv = WarningMessage_read(ser_ref);
51905         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51906         return tag_ptr(ret_conv, true);
51907 }
51908
51909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51910         LDKUnsignedNodeAnnouncement obj_conv;
51911         obj_conv.inner = untag_ptr(obj);
51912         obj_conv.is_owned = ptr_is_owned(obj);
51913         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51914         obj_conv.is_owned = false;
51915         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
51916         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51917         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51918         CVec_u8Z_free(ret_var);
51919         return ret_arr;
51920 }
51921
51922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51923         LDKu8slice ser_ref;
51924         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51925         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51926         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
51927         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
51928         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51929         return tag_ptr(ret_conv, true);
51930 }
51931
51932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
51933         LDKNodeAnnouncement obj_conv;
51934         obj_conv.inner = untag_ptr(obj);
51935         obj_conv.is_owned = ptr_is_owned(obj);
51936         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51937         obj_conv.is_owned = false;
51938         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
51939         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51940         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51941         CVec_u8Z_free(ret_var);
51942         return ret_arr;
51943 }
51944
51945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51946         LDKu8slice ser_ref;
51947         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51948         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51949         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
51950         *ret_conv = NodeAnnouncement_read(ser_ref);
51951         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51952         return tag_ptr(ret_conv, true);
51953 }
51954
51955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51956         LDKu8slice ser_ref;
51957         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51958         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51959         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
51960         *ret_conv = QueryShortChannelIds_read(ser_ref);
51961         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51962         return tag_ptr(ret_conv, true);
51963 }
51964
51965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
51966         LDKQueryShortChannelIds obj_conv;
51967         obj_conv.inner = untag_ptr(obj);
51968         obj_conv.is_owned = ptr_is_owned(obj);
51969         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51970         obj_conv.is_owned = false;
51971         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
51972         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51973         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51974         CVec_u8Z_free(ret_var);
51975         return ret_arr;
51976 }
51977
51978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
51979         LDKReplyShortChannelIdsEnd obj_conv;
51980         obj_conv.inner = untag_ptr(obj);
51981         obj_conv.is_owned = ptr_is_owned(obj);
51982         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51983         obj_conv.is_owned = false;
51984         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
51985         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51986         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51987         CVec_u8Z_free(ret_var);
51988         return ret_arr;
51989 }
51990
51991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51992         LDKu8slice ser_ref;
51993         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51994         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51995         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
51996         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
51997         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51998         return tag_ptr(ret_conv, true);
51999 }
52000
52001 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
52002         LDKQueryChannelRange this_arg_conv;
52003         this_arg_conv.inner = untag_ptr(this_arg);
52004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52006         this_arg_conv.is_owned = false;
52007         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
52008         return ret_conv;
52009 }
52010
52011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
52012         LDKQueryChannelRange obj_conv;
52013         obj_conv.inner = untag_ptr(obj);
52014         obj_conv.is_owned = ptr_is_owned(obj);
52015         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52016         obj_conv.is_owned = false;
52017         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
52018         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52019         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52020         CVec_u8Z_free(ret_var);
52021         return ret_arr;
52022 }
52023
52024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52025         LDKu8slice ser_ref;
52026         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52027         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52028         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
52029         *ret_conv = QueryChannelRange_read(ser_ref);
52030         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52031         return tag_ptr(ret_conv, true);
52032 }
52033
52034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52035         LDKu8slice ser_ref;
52036         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52037         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52038         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
52039         *ret_conv = ReplyChannelRange_read(ser_ref);
52040         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52041         return tag_ptr(ret_conv, true);
52042 }
52043
52044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
52045         LDKReplyChannelRange obj_conv;
52046         obj_conv.inner = untag_ptr(obj);
52047         obj_conv.is_owned = ptr_is_owned(obj);
52048         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52049         obj_conv.is_owned = false;
52050         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
52051         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52052         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52053         CVec_u8Z_free(ret_var);
52054         return ret_arr;
52055 }
52056
52057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
52058         LDKGossipTimestampFilter obj_conv;
52059         obj_conv.inner = untag_ptr(obj);
52060         obj_conv.is_owned = ptr_is_owned(obj);
52061         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52062         obj_conv.is_owned = false;
52063         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
52064         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52065         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52066         CVec_u8Z_free(ret_var);
52067         return ret_arr;
52068 }
52069
52070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52071         LDKu8slice ser_ref;
52072         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52073         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52074         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
52075         *ret_conv = GossipTimestampFilter_read(ser_ref);
52076         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52077         return tag_ptr(ret_conv, true);
52078 }
52079
52080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52081         if (!ptr_is_owned(this_ptr)) return;
52082         void* this_ptr_ptr = untag_ptr(this_ptr);
52083         CHECK_ACCESS(this_ptr_ptr);
52084         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
52085         FREE(untag_ptr(this_ptr));
52086         CustomMessageHandler_free(this_ptr_conv);
52087 }
52088
52089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52090         LDKIgnoringMessageHandler this_obj_conv;
52091         this_obj_conv.inner = untag_ptr(this_obj);
52092         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52094         IgnoringMessageHandler_free(this_obj_conv);
52095 }
52096
52097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
52098         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
52099         int64_t ret_ref = 0;
52100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52102         return ret_ref;
52103 }
52104
52105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
52106         LDKIgnoringMessageHandler this_arg_conv;
52107         this_arg_conv.inner = untag_ptr(this_arg);
52108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52110         this_arg_conv.is_owned = false;
52111         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52112         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
52113         return tag_ptr(ret_ret, true);
52114 }
52115
52116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52117         LDKIgnoringMessageHandler this_arg_conv;
52118         this_arg_conv.inner = untag_ptr(this_arg);
52119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52121         this_arg_conv.is_owned = false;
52122         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
52123         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
52124         return tag_ptr(ret_ret, true);
52125 }
52126
52127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52128         LDKIgnoringMessageHandler this_arg_conv;
52129         this_arg_conv.inner = untag_ptr(this_arg);
52130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52132         this_arg_conv.is_owned = false;
52133         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
52134         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
52135         return tag_ptr(ret_ret, true);
52136 }
52137
52138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52139         LDKIgnoringMessageHandler this_arg_conv;
52140         this_arg_conv.inner = untag_ptr(this_arg);
52141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52143         this_arg_conv.is_owned = false;
52144         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
52145         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
52146         return tag_ptr(ret_ret, true);
52147 }
52148
52149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52150         LDKIgnoringMessageHandler this_arg_conv;
52151         this_arg_conv.inner = untag_ptr(this_arg);
52152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52154         this_arg_conv.is_owned = false;
52155         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
52156         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
52157         return tag_ptr(ret_ret, true);
52158 }
52159
52160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
52161         LDKIgnoringMessageHandler this_arg_conv;
52162         this_arg_conv.inner = untag_ptr(this_arg);
52163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52165         this_arg_conv.is_owned = false;
52166         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
52167         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
52168         return tag_ptr(ret_ret, true);
52169 }
52170
52171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52172         LDKIgnoringMessageHandler this_arg_conv;
52173         this_arg_conv.inner = untag_ptr(this_arg);
52174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52176         this_arg_conv.is_owned = false;
52177         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
52178         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
52179         return tag_ptr(ret_ret, true);
52180 }
52181
52182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52183         LDKErroringMessageHandler this_obj_conv;
52184         this_obj_conv.inner = untag_ptr(this_obj);
52185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52187         ErroringMessageHandler_free(this_obj_conv);
52188 }
52189
52190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
52191         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
52192         int64_t ret_ref = 0;
52193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52195         return ret_ref;
52196 }
52197
52198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
52199         LDKErroringMessageHandler this_arg_conv;
52200         this_arg_conv.inner = untag_ptr(this_arg);
52201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52203         this_arg_conv.is_owned = false;
52204         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52205         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
52206         return tag_ptr(ret_ret, true);
52207 }
52208
52209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
52210         LDKErroringMessageHandler this_arg_conv;
52211         this_arg_conv.inner = untag_ptr(this_arg);
52212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52214         this_arg_conv.is_owned = false;
52215         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
52216         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
52217         return tag_ptr(ret_ret, true);
52218 }
52219
52220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52221         LDKMessageHandler this_obj_conv;
52222         this_obj_conv.inner = untag_ptr(this_obj);
52223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52225         MessageHandler_free(this_obj_conv);
52226 }
52227
52228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
52229         LDKMessageHandler this_ptr_conv;
52230         this_ptr_conv.inner = untag_ptr(this_ptr);
52231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52233         this_ptr_conv.is_owned = false;
52234         // WARNING: This object doesn't live past this scope, needs clone!
52235         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
52236         return ret_ret;
52237 }
52238
52239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52240         LDKMessageHandler this_ptr_conv;
52241         this_ptr_conv.inner = untag_ptr(this_ptr);
52242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52244         this_ptr_conv.is_owned = false;
52245         void* val_ptr = untag_ptr(val);
52246         CHECK_ACCESS(val_ptr);
52247         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
52248         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
52249                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52250                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
52251         }
52252         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
52253 }
52254
52255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
52256         LDKMessageHandler this_ptr_conv;
52257         this_ptr_conv.inner = untag_ptr(this_ptr);
52258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52260         this_ptr_conv.is_owned = false;
52261         // WARNING: This object doesn't live past this scope, needs clone!
52262         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
52263         return ret_ret;
52264 }
52265
52266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52267         LDKMessageHandler this_ptr_conv;
52268         this_ptr_conv.inner = untag_ptr(this_ptr);
52269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52271         this_ptr_conv.is_owned = false;
52272         void* val_ptr = untag_ptr(val);
52273         CHECK_ACCESS(val_ptr);
52274         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
52275         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52276                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52277                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
52278         }
52279         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
52280 }
52281
52282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
52283         LDKMessageHandler 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         // WARNING: This object doesn't live past this scope, needs clone!
52289         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
52290         return ret_ret;
52291 }
52292
52293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52294         LDKMessageHandler this_ptr_conv;
52295         this_ptr_conv.inner = untag_ptr(this_ptr);
52296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52298         this_ptr_conv.is_owned = false;
52299         void* val_ptr = untag_ptr(val);
52300         CHECK_ACCESS(val_ptr);
52301         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
52302         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
52303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52304                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
52305         }
52306         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
52307 }
52308
52309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
52310         LDKMessageHandler this_ptr_conv;
52311         this_ptr_conv.inner = untag_ptr(this_ptr);
52312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52314         this_ptr_conv.is_owned = false;
52315         // WARNING: This object doesn't live past this scope, needs clone!
52316         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
52317         return ret_ret;
52318 }
52319
52320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52321         LDKMessageHandler this_ptr_conv;
52322         this_ptr_conv.inner = untag_ptr(this_ptr);
52323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52325         this_ptr_conv.is_owned = false;
52326         void* val_ptr = untag_ptr(val);
52327         CHECK_ACCESS(val_ptr);
52328         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
52329         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
52330                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52331                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
52332         }
52333         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
52334 }
52335
52336 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) {
52337         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
52338         CHECK_ACCESS(chan_handler_arg_ptr);
52339         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
52340         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
52341                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52342                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
52343         }
52344         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
52345         CHECK_ACCESS(route_handler_arg_ptr);
52346         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
52347         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52348                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52349                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
52350         }
52351         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
52352         CHECK_ACCESS(onion_message_handler_arg_ptr);
52353         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
52354         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
52355                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52356                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
52357         }
52358         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
52359         CHECK_ACCESS(custom_message_handler_arg_ptr);
52360         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
52361         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
52362                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52363                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
52364         }
52365         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
52366         int64_t ret_ref = 0;
52367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52369         return ret_ref;
52370 }
52371
52372 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
52373         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52374         *ret_ret = SocketDescriptor_clone(arg);
52375         return tag_ptr(ret_ret, true);
52376 }
52377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52378         void* arg_ptr = untag_ptr(arg);
52379         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52380         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
52381         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
52382         return ret_conv;
52383 }
52384
52385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52386         void* orig_ptr = untag_ptr(orig);
52387         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52388         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
52389         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52390         *ret_ret = SocketDescriptor_clone(orig_conv);
52391         return tag_ptr(ret_ret, true);
52392 }
52393
52394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
52395         if (!ptr_is_owned(this_ptr)) return;
52396         void* this_ptr_ptr = untag_ptr(this_ptr);
52397         CHECK_ACCESS(this_ptr_ptr);
52398         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
52399         FREE(untag_ptr(this_ptr));
52400         SocketDescriptor_free(this_ptr_conv);
52401 }
52402
52403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52404         LDKPeerHandleError this_obj_conv;
52405         this_obj_conv.inner = untag_ptr(this_obj);
52406         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52408         PeerHandleError_free(this_obj_conv);
52409 }
52410
52411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
52412         LDKPeerHandleError ret_var = PeerHandleError_new();
52413         int64_t ret_ref = 0;
52414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52416         return ret_ref;
52417 }
52418
52419 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
52420         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
52421         int64_t ret_ref = 0;
52422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52424         return ret_ref;
52425 }
52426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52427         LDKPeerHandleError arg_conv;
52428         arg_conv.inner = untag_ptr(arg);
52429         arg_conv.is_owned = ptr_is_owned(arg);
52430         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52431         arg_conv.is_owned = false;
52432         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
52433         return ret_conv;
52434 }
52435
52436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52437         LDKPeerHandleError orig_conv;
52438         orig_conv.inner = untag_ptr(orig);
52439         orig_conv.is_owned = ptr_is_owned(orig);
52440         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52441         orig_conv.is_owned = false;
52442         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
52443         int64_t ret_ref = 0;
52444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52446         return ret_ref;
52447 }
52448
52449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52450         LDKPeerManager this_obj_conv;
52451         this_obj_conv.inner = untag_ptr(this_obj);
52452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52454         PeerManager_free(this_obj_conv);
52455 }
52456
52457 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) {
52458         LDKMessageHandler message_handler_conv;
52459         message_handler_conv.inner = untag_ptr(message_handler);
52460         message_handler_conv.is_owned = ptr_is_owned(message_handler);
52461         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
52462         // WARNING: we need a move here but no clone is available for LDKMessageHandler
52463         
52464         uint8_t ephemeral_random_data_arr[32];
52465         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
52466         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
52467         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
52468         void* logger_ptr = untag_ptr(logger);
52469         CHECK_ACCESS(logger_ptr);
52470         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52471         if (logger_conv.free == LDKLogger_JCalls_free) {
52472                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52473                 LDKLogger_JCalls_cloned(&logger_conv);
52474         }
52475         void* node_signer_ptr = untag_ptr(node_signer);
52476         CHECK_ACCESS(node_signer_ptr);
52477         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52478         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52479                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52480                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52481         }
52482         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
52483         int64_t ret_ref = 0;
52484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52486         return ret_ref;
52487 }
52488
52489 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
52490         LDKPeerManager this_arg_conv;
52491         this_arg_conv.inner = untag_ptr(this_arg);
52492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52494         this_arg_conv.is_owned = false;
52495         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
52496         int64_tArray ret_arr = NULL;
52497         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
52498         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
52499         for (size_t r = 0; r < ret_var.datalen; r++) {
52500                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
52501                 *ret_conv_43_conv = ret_var.data[r];
52502                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
52503         }
52504         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
52505         FREE(ret_var.data);
52506         return ret_arr;
52507 }
52508
52509 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) {
52510         LDKPeerManager this_arg_conv;
52511         this_arg_conv.inner = untag_ptr(this_arg);
52512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52514         this_arg_conv.is_owned = false;
52515         LDKPublicKey their_node_id_ref;
52516         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
52517         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
52518         void* descriptor_ptr = untag_ptr(descriptor);
52519         CHECK_ACCESS(descriptor_ptr);
52520         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52521         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52522                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52523                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52524         }
52525         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52526         CHECK_ACCESS(remote_network_address_ptr);
52527         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52528         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
52529         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
52530         return tag_ptr(ret_conv, true);
52531 }
52532
52533 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) {
52534         LDKPeerManager this_arg_conv;
52535         this_arg_conv.inner = untag_ptr(this_arg);
52536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52538         this_arg_conv.is_owned = false;
52539         void* descriptor_ptr = untag_ptr(descriptor);
52540         CHECK_ACCESS(descriptor_ptr);
52541         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52542         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52543                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52544                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52545         }
52546         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52547         CHECK_ACCESS(remote_network_address_ptr);
52548         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52549         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52550         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
52551         return tag_ptr(ret_conv, true);
52552 }
52553
52554 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) {
52555         LDKPeerManager this_arg_conv;
52556         this_arg_conv.inner = untag_ptr(this_arg);
52557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52559         this_arg_conv.is_owned = false;
52560         void* descriptor_ptr = untag_ptr(descriptor);
52561         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52562         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52563         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52564         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
52565         return tag_ptr(ret_conv, true);
52566 }
52567
52568 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) {
52569         LDKPeerManager this_arg_conv;
52570         this_arg_conv.inner = untag_ptr(this_arg);
52571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52573         this_arg_conv.is_owned = false;
52574         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
52575         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
52576         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
52577         LDKu8slice data_ref;
52578         data_ref.datalen = (*env)->GetArrayLength(env, data);
52579         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
52580         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
52581         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
52582         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
52583         return tag_ptr(ret_conv, true);
52584 }
52585
52586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
52587         LDKPeerManager this_arg_conv;
52588         this_arg_conv.inner = untag_ptr(this_arg);
52589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52591         this_arg_conv.is_owned = false;
52592         PeerManager_process_events(&this_arg_conv);
52593 }
52594
52595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
52596         LDKPeerManager this_arg_conv;
52597         this_arg_conv.inner = untag_ptr(this_arg);
52598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52600         this_arg_conv.is_owned = false;
52601         void* descriptor_ptr = untag_ptr(descriptor);
52602         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52603         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52604         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
52605 }
52606
52607 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) {
52608         LDKPeerManager this_arg_conv;
52609         this_arg_conv.inner = untag_ptr(this_arg);
52610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52612         this_arg_conv.is_owned = false;
52613         LDKPublicKey node_id_ref;
52614         CHECK((*env)->GetArrayLength(env, node_id) == 33);
52615         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
52616         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
52617 }
52618
52619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
52620         LDKPeerManager this_arg_conv;
52621         this_arg_conv.inner = untag_ptr(this_arg);
52622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52624         this_arg_conv.is_owned = false;
52625         PeerManager_disconnect_all_peers(&this_arg_conv);
52626 }
52627
52628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
52629         LDKPeerManager this_arg_conv;
52630         this_arg_conv.inner = untag_ptr(this_arg);
52631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52633         this_arg_conv.is_owned = false;
52634         PeerManager_timer_tick_occurred(&this_arg_conv);
52635 }
52636
52637 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) {
52638         LDKPeerManager this_arg_conv;
52639         this_arg_conv.inner = untag_ptr(this_arg);
52640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52642         this_arg_conv.is_owned = false;
52643         LDKThreeBytes rgb_ref;
52644         CHECK((*env)->GetArrayLength(env, rgb) == 3);
52645         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
52646         LDKThirtyTwoBytes alias_ref;
52647         CHECK((*env)->GetArrayLength(env, alias) == 32);
52648         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
52649         LDKCVec_SocketAddressZ addresses_constr;
52650         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
52651         if (addresses_constr.datalen > 0)
52652                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52653         else
52654                 addresses_constr.data = NULL;
52655         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
52656         for (size_t p = 0; p < addresses_constr.datalen; p++) {
52657                 int64_t addresses_conv_15 = addresses_vals[p];
52658                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
52659                 CHECK_ACCESS(addresses_conv_15_ptr);
52660                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
52661                 addresses_constr.data[p] = addresses_conv_15_conv;
52662         }
52663         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
52664         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
52665 }
52666
52667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
52668         LDKChannelTypeFeatures channel_type_features_conv;
52669         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52670         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52671         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52672         channel_type_features_conv.is_owned = false;
52673         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
52674         return ret_conv;
52675 }
52676
52677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
52678         LDKChannelTypeFeatures channel_type_features_conv;
52679         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52680         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52681         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52682         channel_type_features_conv.is_owned = false;
52683         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
52684         return ret_conv;
52685 }
52686
52687 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52688         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
52689         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
52690         return ret_conv;
52691 }
52692
52693 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
52694         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
52695         return ret_conv;
52696 }
52697
52698 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
52699         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
52700         return ret_conv;
52701 }
52702
52703 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
52704         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
52705         return ret_conv;
52706 }
52707
52708 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
52709         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
52710         return ret_conv;
52711 }
52712
52713 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
52714         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
52715         return ret_conv;
52716 }
52717
52718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52719         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
52720         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
52721         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
52722         return ret_conv;
52723 }
52724
52725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
52726         LDKWitness witness_ref;
52727         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
52728         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
52729         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
52730         witness_ref.data_is_owned = true;
52731         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
52732         *ret_copy = HTLCClaim_from_witness(witness_ref);
52733         int64_t ret_ref = tag_ptr(ret_copy, true);
52734         return ret_ref;
52735 }
52736
52737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
52738         uint8_t commitment_seed_arr[32];
52739         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
52740         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
52741         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
52742         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52743         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
52744         return ret_arr;
52745 }
52746
52747 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) {
52748         LDKCVec_u8Z to_holder_script_ref;
52749         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
52750         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
52751         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
52752         LDKCVec_u8Z to_counterparty_script_ref;
52753         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
52754         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
52755         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
52756         LDKOutPoint funding_outpoint_conv;
52757         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
52758         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
52759         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
52760         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
52761         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);
52762         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52763         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52764         Transaction_free(ret_var);
52765         return ret_arr;
52766 }
52767
52768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52769         LDKCounterpartyCommitmentSecrets this_obj_conv;
52770         this_obj_conv.inner = untag_ptr(this_obj);
52771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52773         CounterpartyCommitmentSecrets_free(this_obj_conv);
52774 }
52775
52776 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
52777         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
52778         int64_t ret_ref = 0;
52779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52781         return ret_ref;
52782 }
52783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52784         LDKCounterpartyCommitmentSecrets arg_conv;
52785         arg_conv.inner = untag_ptr(arg);
52786         arg_conv.is_owned = ptr_is_owned(arg);
52787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52788         arg_conv.is_owned = false;
52789         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
52790         return ret_conv;
52791 }
52792
52793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52794         LDKCounterpartyCommitmentSecrets orig_conv;
52795         orig_conv.inner = untag_ptr(orig);
52796         orig_conv.is_owned = ptr_is_owned(orig);
52797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52798         orig_conv.is_owned = false;
52799         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
52800         int64_t ret_ref = 0;
52801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52803         return ret_ref;
52804 }
52805
52806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
52807         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
52808         int64_t ret_ref = 0;
52809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52811         return ret_ref;
52812 }
52813
52814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
52815         LDKCounterpartyCommitmentSecrets this_arg_conv;
52816         this_arg_conv.inner = untag_ptr(this_arg);
52817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52819         this_arg_conv.is_owned = false;
52820         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
52821         return ret_conv;
52822 }
52823
52824 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) {
52825         LDKCounterpartyCommitmentSecrets this_arg_conv;
52826         this_arg_conv.inner = untag_ptr(this_arg);
52827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52829         this_arg_conv.is_owned = false;
52830         LDKThirtyTwoBytes secret_ref;
52831         CHECK((*env)->GetArrayLength(env, secret) == 32);
52832         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
52833         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52834         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
52835         return tag_ptr(ret_conv, true);
52836 }
52837
52838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
52839         LDKCounterpartyCommitmentSecrets this_arg_conv;
52840         this_arg_conv.inner = untag_ptr(this_arg);
52841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52843         this_arg_conv.is_owned = false;
52844         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52845         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
52846         return ret_arr;
52847 }
52848
52849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
52850         LDKCounterpartyCommitmentSecrets obj_conv;
52851         obj_conv.inner = untag_ptr(obj);
52852         obj_conv.is_owned = ptr_is_owned(obj);
52853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52854         obj_conv.is_owned = false;
52855         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
52856         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
52857         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
52858         CVec_u8Z_free(ret_var);
52859         return ret_arr;
52860 }
52861
52862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
52863         LDKu8slice ser_ref;
52864         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
52865         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
52866         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
52867         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
52868         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
52869         return tag_ptr(ret_conv, true);
52870 }
52871
52872 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) {
52873         LDKPublicKey per_commitment_point_ref;
52874         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52875         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52876         uint8_t base_secret_arr[32];
52877         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
52878         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
52879         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
52880         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52881         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
52882         return ret_arr;
52883 }
52884
52885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
52886         LDKPublicKey per_commitment_point_ref;
52887         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52888         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52889         LDKPublicKey base_point_ref;
52890         CHECK((*env)->GetArrayLength(env, base_point) == 33);
52891         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
52892         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52893         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form);
52894         return ret_arr;
52895 }
52896
52897 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) {
52898         uint8_t per_commitment_secret_arr[32];
52899         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
52900         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
52901         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
52902         uint8_t countersignatory_revocation_base_secret_arr[32];
52903         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
52904         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
52905         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
52906         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52907         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
52908         return ret_arr;
52909 }
52910
52911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
52912         LDKPublicKey per_commitment_point_ref;
52913         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
52914         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
52915         LDKPublicKey countersignatory_revocation_base_point_ref;
52916         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
52917         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
52918         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52919         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form);
52920         return ret_arr;
52921 }
52922
52923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52924         LDKTxCreationKeys this_obj_conv;
52925         this_obj_conv.inner = untag_ptr(this_obj);
52926         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52928         TxCreationKeys_free(this_obj_conv);
52929 }
52930
52931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52932         LDKTxCreationKeys this_ptr_conv;
52933         this_ptr_conv.inner = untag_ptr(this_ptr);
52934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52936         this_ptr_conv.is_owned = false;
52937         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52938         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
52939         return ret_arr;
52940 }
52941
52942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52943         LDKTxCreationKeys this_ptr_conv;
52944         this_ptr_conv.inner = untag_ptr(this_ptr);
52945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52947         this_ptr_conv.is_owned = false;
52948         LDKPublicKey val_ref;
52949         CHECK((*env)->GetArrayLength(env, val) == 33);
52950         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52951         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
52952 }
52953
52954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52955         LDKTxCreationKeys this_ptr_conv;
52956         this_ptr_conv.inner = untag_ptr(this_ptr);
52957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52959         this_ptr_conv.is_owned = false;
52960         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52961         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
52962         return ret_arr;
52963 }
52964
52965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52966         LDKTxCreationKeys this_ptr_conv;
52967         this_ptr_conv.inner = untag_ptr(this_ptr);
52968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52970         this_ptr_conv.is_owned = false;
52971         LDKPublicKey val_ref;
52972         CHECK((*env)->GetArrayLength(env, val) == 33);
52973         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52974         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
52975 }
52976
52977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
52978         LDKTxCreationKeys this_ptr_conv;
52979         this_ptr_conv.inner = untag_ptr(this_ptr);
52980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52982         this_ptr_conv.is_owned = false;
52983         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52984         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
52985         return ret_arr;
52986 }
52987
52988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52989         LDKTxCreationKeys this_ptr_conv;
52990         this_ptr_conv.inner = untag_ptr(this_ptr);
52991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52993         this_ptr_conv.is_owned = false;
52994         LDKPublicKey val_ref;
52995         CHECK((*env)->GetArrayLength(env, val) == 33);
52996         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52997         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
52998 }
52999
53000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
53001         LDKTxCreationKeys this_ptr_conv;
53002         this_ptr_conv.inner = untag_ptr(this_ptr);
53003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53005         this_ptr_conv.is_owned = false;
53006         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53007         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
53008         return ret_arr;
53009 }
53010
53011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53012         LDKTxCreationKeys this_ptr_conv;
53013         this_ptr_conv.inner = untag_ptr(this_ptr);
53014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53016         this_ptr_conv.is_owned = false;
53017         LDKPublicKey val_ref;
53018         CHECK((*env)->GetArrayLength(env, val) == 33);
53019         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53020         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
53021 }
53022
53023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
53024         LDKTxCreationKeys this_ptr_conv;
53025         this_ptr_conv.inner = untag_ptr(this_ptr);
53026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53028         this_ptr_conv.is_owned = false;
53029         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53030         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
53031         return ret_arr;
53032 }
53033
53034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53035         LDKTxCreationKeys this_ptr_conv;
53036         this_ptr_conv.inner = untag_ptr(this_ptr);
53037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53039         this_ptr_conv.is_owned = false;
53040         LDKPublicKey val_ref;
53041         CHECK((*env)->GetArrayLength(env, val) == 33);
53042         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53043         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
53044 }
53045
53046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
53047         LDKPublicKey per_commitment_point_arg_ref;
53048         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
53049         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
53050         LDKPublicKey revocation_key_arg_ref;
53051         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
53052         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
53053         LDKPublicKey broadcaster_htlc_key_arg_ref;
53054         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
53055         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
53056         LDKPublicKey countersignatory_htlc_key_arg_ref;
53057         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
53058         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
53059         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
53060         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
53061         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
53062         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
53063         int64_t ret_ref = 0;
53064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53066         return ret_ref;
53067 }
53068
53069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53070         LDKTxCreationKeys a_conv;
53071         a_conv.inner = untag_ptr(a);
53072         a_conv.is_owned = ptr_is_owned(a);
53073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53074         a_conv.is_owned = false;
53075         LDKTxCreationKeys b_conv;
53076         b_conv.inner = untag_ptr(b);
53077         b_conv.is_owned = ptr_is_owned(b);
53078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53079         b_conv.is_owned = false;
53080         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
53081         return ret_conv;
53082 }
53083
53084 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
53085         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
53086         int64_t ret_ref = 0;
53087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53089         return ret_ref;
53090 }
53091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53092         LDKTxCreationKeys arg_conv;
53093         arg_conv.inner = untag_ptr(arg);
53094         arg_conv.is_owned = ptr_is_owned(arg);
53095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53096         arg_conv.is_owned = false;
53097         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
53098         return ret_conv;
53099 }
53100
53101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53102         LDKTxCreationKeys orig_conv;
53103         orig_conv.inner = untag_ptr(orig);
53104         orig_conv.is_owned = ptr_is_owned(orig);
53105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53106         orig_conv.is_owned = false;
53107         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_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 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
53115         LDKTxCreationKeys obj_conv;
53116         obj_conv.inner = untag_ptr(obj);
53117         obj_conv.is_owned = ptr_is_owned(obj);
53118         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53119         obj_conv.is_owned = false;
53120         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
53121         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53122         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53123         CVec_u8Z_free(ret_var);
53124         return ret_arr;
53125 }
53126
53127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53128         LDKu8slice ser_ref;
53129         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53130         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53131         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
53132         *ret_conv = TxCreationKeys_read(ser_ref);
53133         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53134         return tag_ptr(ret_conv, true);
53135 }
53136
53137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53138         LDKChannelPublicKeys this_obj_conv;
53139         this_obj_conv.inner = untag_ptr(this_obj);
53140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53142         ChannelPublicKeys_free(this_obj_conv);
53143 }
53144
53145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
53146         LDKChannelPublicKeys this_ptr_conv;
53147         this_ptr_conv.inner = untag_ptr(this_ptr);
53148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53150         this_ptr_conv.is_owned = false;
53151         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53152         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
53153         return ret_arr;
53154 }
53155
53156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53157         LDKChannelPublicKeys this_ptr_conv;
53158         this_ptr_conv.inner = untag_ptr(this_ptr);
53159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53161         this_ptr_conv.is_owned = false;
53162         LDKPublicKey val_ref;
53163         CHECK((*env)->GetArrayLength(env, val) == 33);
53164         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53165         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
53166 }
53167
53168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53169         LDKChannelPublicKeys this_ptr_conv;
53170         this_ptr_conv.inner = untag_ptr(this_ptr);
53171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53173         this_ptr_conv.is_owned = false;
53174         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53175         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
53176         return ret_arr;
53177 }
53178
53179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53180         LDKChannelPublicKeys this_ptr_conv;
53181         this_ptr_conv.inner = untag_ptr(this_ptr);
53182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53184         this_ptr_conv.is_owned = false;
53185         LDKPublicKey val_ref;
53186         CHECK((*env)->GetArrayLength(env, val) == 33);
53187         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53188         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
53189 }
53190
53191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
53192         LDKChannelPublicKeys this_ptr_conv;
53193         this_ptr_conv.inner = untag_ptr(this_ptr);
53194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53196         this_ptr_conv.is_owned = false;
53197         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53198         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
53199         return ret_arr;
53200 }
53201
53202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53203         LDKChannelPublicKeys this_ptr_conv;
53204         this_ptr_conv.inner = untag_ptr(this_ptr);
53205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53207         this_ptr_conv.is_owned = false;
53208         LDKPublicKey val_ref;
53209         CHECK((*env)->GetArrayLength(env, val) == 33);
53210         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53211         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
53212 }
53213
53214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53215         LDKChannelPublicKeys 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53221         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
53222         return ret_arr;
53223 }
53224
53225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53226         LDKChannelPublicKeys this_ptr_conv;
53227         this_ptr_conv.inner = untag_ptr(this_ptr);
53228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53230         this_ptr_conv.is_owned = false;
53231         LDKPublicKey val_ref;
53232         CHECK((*env)->GetArrayLength(env, val) == 33);
53233         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53234         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
53235 }
53236
53237 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53238         LDKChannelPublicKeys this_ptr_conv;
53239         this_ptr_conv.inner = untag_ptr(this_ptr);
53240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53242         this_ptr_conv.is_owned = false;
53243         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53244         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
53245         return ret_arr;
53246 }
53247
53248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53249         LDKChannelPublicKeys this_ptr_conv;
53250         this_ptr_conv.inner = untag_ptr(this_ptr);
53251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53253         this_ptr_conv.is_owned = false;
53254         LDKPublicKey val_ref;
53255         CHECK((*env)->GetArrayLength(env, val) == 33);
53256         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53257         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
53258 }
53259
53260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg) {
53261         LDKPublicKey funding_pubkey_arg_ref;
53262         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
53263         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
53264         LDKPublicKey revocation_basepoint_arg_ref;
53265         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
53266         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
53267         LDKPublicKey payment_point_arg_ref;
53268         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
53269         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
53270         LDKPublicKey delayed_payment_basepoint_arg_ref;
53271         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
53272         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
53273         LDKPublicKey htlc_basepoint_arg_ref;
53274         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
53275         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
53276         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
53277         int64_t ret_ref = 0;
53278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53280         return ret_ref;
53281 }
53282
53283 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
53284         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
53285         int64_t ret_ref = 0;
53286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53288         return ret_ref;
53289 }
53290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53291         LDKChannelPublicKeys arg_conv;
53292         arg_conv.inner = untag_ptr(arg);
53293         arg_conv.is_owned = ptr_is_owned(arg);
53294         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53295         arg_conv.is_owned = false;
53296         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
53297         return ret_conv;
53298 }
53299
53300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53301         LDKChannelPublicKeys orig_conv;
53302         orig_conv.inner = untag_ptr(orig);
53303         orig_conv.is_owned = ptr_is_owned(orig);
53304         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53305         orig_conv.is_owned = false;
53306         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
53307         int64_t ret_ref = 0;
53308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53310         return ret_ref;
53311 }
53312
53313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
53314         LDKChannelPublicKeys o_conv;
53315         o_conv.inner = untag_ptr(o);
53316         o_conv.is_owned = ptr_is_owned(o);
53317         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53318         o_conv.is_owned = false;
53319         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
53320         return ret_conv;
53321 }
53322
53323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53324         LDKChannelPublicKeys a_conv;
53325         a_conv.inner = untag_ptr(a);
53326         a_conv.is_owned = ptr_is_owned(a);
53327         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53328         a_conv.is_owned = false;
53329         LDKChannelPublicKeys b_conv;
53330         b_conv.inner = untag_ptr(b);
53331         b_conv.is_owned = ptr_is_owned(b);
53332         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53333         b_conv.is_owned = false;
53334         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
53335         return ret_conv;
53336 }
53337
53338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
53339         LDKChannelPublicKeys obj_conv;
53340         obj_conv.inner = untag_ptr(obj);
53341         obj_conv.is_owned = ptr_is_owned(obj);
53342         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53343         obj_conv.is_owned = false;
53344         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
53345         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53346         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53347         CVec_u8Z_free(ret_var);
53348         return ret_arr;
53349 }
53350
53351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53352         LDKu8slice ser_ref;
53353         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53354         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53355         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
53356         *ret_conv = ChannelPublicKeys_read(ser_ref);
53357         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53358         return tag_ptr(ret_conv, true);
53359 }
53360
53361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
53362         LDKPublicKey per_commitment_point_ref;
53363         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
53364         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
53365         LDKPublicKey broadcaster_delayed_payment_base_ref;
53366         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
53367         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
53368         LDKPublicKey broadcaster_htlc_base_ref;
53369         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
53370         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
53371         LDKPublicKey countersignatory_revocation_base_ref;
53372         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
53373         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
53374         LDKPublicKey countersignatory_htlc_base_ref;
53375         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
53376         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
53377         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
53378         int64_t ret_ref = 0;
53379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53381         return ret_ref;
53382 }
53383
53384 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) {
53385         LDKPublicKey per_commitment_point_ref;
53386         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
53387         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
53388         LDKChannelPublicKeys broadcaster_keys_conv;
53389         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
53390         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
53391         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
53392         broadcaster_keys_conv.is_owned = false;
53393         LDKChannelPublicKeys countersignatory_keys_conv;
53394         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
53395         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
53396         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
53397         countersignatory_keys_conv.is_owned = false;
53398         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
53399         int64_t ret_ref = 0;
53400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53402         return ret_ref;
53403 }
53404
53405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
53406         LDKPublicKey revocation_key_ref;
53407         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
53408         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
53409         LDKPublicKey broadcaster_delayed_payment_key_ref;
53410         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
53411         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
53412         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
53413         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53414         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53415         CVec_u8Z_free(ret_var);
53416         return ret_arr;
53417 }
53418
53419 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) {
53420         LDKChannelTypeFeatures channel_type_features_conv;
53421         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53422         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53423         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53424         channel_type_features_conv.is_owned = false;
53425         LDKPublicKey payment_key_ref;
53426         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
53427         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
53428         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
53429         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53430         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53431         CVec_u8Z_free(ret_var);
53432         return ret_arr;
53433 }
53434
53435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53436         LDKHTLCOutputInCommitment this_obj_conv;
53437         this_obj_conv.inner = untag_ptr(this_obj);
53438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53440         HTLCOutputInCommitment_free(this_obj_conv);
53441 }
53442
53443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
53444         LDKHTLCOutputInCommitment this_ptr_conv;
53445         this_ptr_conv.inner = untag_ptr(this_ptr);
53446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53448         this_ptr_conv.is_owned = false;
53449         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
53450         return ret_conv;
53451 }
53452
53453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
53454         LDKHTLCOutputInCommitment this_ptr_conv;
53455         this_ptr_conv.inner = untag_ptr(this_ptr);
53456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53458         this_ptr_conv.is_owned = false;
53459         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
53460 }
53461
53462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
53463         LDKHTLCOutputInCommitment this_ptr_conv;
53464         this_ptr_conv.inner = untag_ptr(this_ptr);
53465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53467         this_ptr_conv.is_owned = false;
53468         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
53469         return ret_conv;
53470 }
53471
53472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53473         LDKHTLCOutputInCommitment this_ptr_conv;
53474         this_ptr_conv.inner = untag_ptr(this_ptr);
53475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53477         this_ptr_conv.is_owned = false;
53478         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
53479 }
53480
53481 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
53482         LDKHTLCOutputInCommitment this_ptr_conv;
53483         this_ptr_conv.inner = untag_ptr(this_ptr);
53484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53486         this_ptr_conv.is_owned = false;
53487         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
53488         return ret_conv;
53489 }
53490
53491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53492         LDKHTLCOutputInCommitment 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         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
53498 }
53499
53500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
53501         LDKHTLCOutputInCommitment this_ptr_conv;
53502         this_ptr_conv.inner = untag_ptr(this_ptr);
53503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53505         this_ptr_conv.is_owned = false;
53506         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53507         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
53508         return ret_arr;
53509 }
53510
53511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53512         LDKHTLCOutputInCommitment this_ptr_conv;
53513         this_ptr_conv.inner = untag_ptr(this_ptr);
53514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53516         this_ptr_conv.is_owned = false;
53517         LDKThirtyTwoBytes val_ref;
53518         CHECK((*env)->GetArrayLength(env, val) == 32);
53519         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53520         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
53521 }
53522
53523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
53524         LDKHTLCOutputInCommitment this_ptr_conv;
53525         this_ptr_conv.inner = untag_ptr(this_ptr);
53526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53528         this_ptr_conv.is_owned = false;
53529         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
53530         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
53531         int64_t ret_ref = tag_ptr(ret_copy, true);
53532         return ret_ref;
53533 }
53534
53535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53536         LDKHTLCOutputInCommitment this_ptr_conv;
53537         this_ptr_conv.inner = untag_ptr(this_ptr);
53538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53540         this_ptr_conv.is_owned = false;
53541         void* val_ptr = untag_ptr(val);
53542         CHECK_ACCESS(val_ptr);
53543         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
53544         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
53545         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
53546 }
53547
53548 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) {
53549         LDKThirtyTwoBytes payment_hash_arg_ref;
53550         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
53551         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
53552         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
53553         CHECK_ACCESS(transaction_output_index_arg_ptr);
53554         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
53555         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
53556         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
53557         int64_t ret_ref = 0;
53558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53560         return ret_ref;
53561 }
53562
53563 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
53564         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
53565         int64_t ret_ref = 0;
53566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53568         return ret_ref;
53569 }
53570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53571         LDKHTLCOutputInCommitment arg_conv;
53572         arg_conv.inner = untag_ptr(arg);
53573         arg_conv.is_owned = ptr_is_owned(arg);
53574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53575         arg_conv.is_owned = false;
53576         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
53577         return ret_conv;
53578 }
53579
53580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53581         LDKHTLCOutputInCommitment orig_conv;
53582         orig_conv.inner = untag_ptr(orig);
53583         orig_conv.is_owned = ptr_is_owned(orig);
53584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53585         orig_conv.is_owned = false;
53586         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
53587         int64_t ret_ref = 0;
53588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53590         return ret_ref;
53591 }
53592
53593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53594         LDKHTLCOutputInCommitment a_conv;
53595         a_conv.inner = untag_ptr(a);
53596         a_conv.is_owned = ptr_is_owned(a);
53597         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53598         a_conv.is_owned = false;
53599         LDKHTLCOutputInCommitment b_conv;
53600         b_conv.inner = untag_ptr(b);
53601         b_conv.is_owned = ptr_is_owned(b);
53602         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53603         b_conv.is_owned = false;
53604         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
53605         return ret_conv;
53606 }
53607
53608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
53609         LDKHTLCOutputInCommitment obj_conv;
53610         obj_conv.inner = untag_ptr(obj);
53611         obj_conv.is_owned = ptr_is_owned(obj);
53612         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53613         obj_conv.is_owned = false;
53614         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
53615         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53616         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53617         CVec_u8Z_free(ret_var);
53618         return ret_arr;
53619 }
53620
53621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53622         LDKu8slice ser_ref;
53623         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53624         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53625         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
53626         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
53627         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53628         return tag_ptr(ret_conv, true);
53629 }
53630
53631 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) {
53632         LDKHTLCOutputInCommitment htlc_conv;
53633         htlc_conv.inner = untag_ptr(htlc);
53634         htlc_conv.is_owned = ptr_is_owned(htlc);
53635         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53636         htlc_conv.is_owned = false;
53637         LDKChannelTypeFeatures channel_type_features_conv;
53638         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53639         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53640         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53641         channel_type_features_conv.is_owned = false;
53642         LDKTxCreationKeys keys_conv;
53643         keys_conv.inner = untag_ptr(keys);
53644         keys_conv.is_owned = ptr_is_owned(keys);
53645         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
53646         keys_conv.is_owned = false;
53647         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
53648         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53649         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53650         CVec_u8Z_free(ret_var);
53651         return ret_arr;
53652 }
53653
53654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
53655         LDKPublicKey broadcaster_ref;
53656         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
53657         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
53658         LDKPublicKey countersignatory_ref;
53659         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
53660         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
53661         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
53662         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53663         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53664         CVec_u8Z_free(ret_var);
53665         return ret_arr;
53666 }
53667
53668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int64_t channel_type_features, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
53669         uint8_t commitment_txid_arr[32];
53670         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
53671         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
53672         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
53673         LDKHTLCOutputInCommitment htlc_conv;
53674         htlc_conv.inner = untag_ptr(htlc);
53675         htlc_conv.is_owned = ptr_is_owned(htlc);
53676         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53677         htlc_conv.is_owned = false;
53678         LDKChannelTypeFeatures channel_type_features_conv;
53679         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53680         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53681         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53682         channel_type_features_conv.is_owned = false;
53683         LDKPublicKey broadcaster_delayed_payment_key_ref;
53684         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
53685         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
53686         LDKPublicKey revocation_key_ref;
53687         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
53688         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
53689         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
53690         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53691         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53692         Transaction_free(ret_var);
53693         return ret_arr;
53694 }
53695
53696 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) {
53697         LDKECDSASignature local_sig_ref;
53698         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
53699         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
53700         LDKECDSASignature remote_sig_ref;
53701         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
53702         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
53703         void* preimage_ptr = untag_ptr(preimage);
53704         CHECK_ACCESS(preimage_ptr);
53705         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
53706         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
53707         LDKu8slice redeem_script_ref;
53708         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
53709         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
53710         LDKChannelTypeFeatures channel_type_features_conv;
53711         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53712         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53713         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53714         channel_type_features_conv.is_owned = false;
53715         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
53716         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53717         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53718         Witness_free(ret_var);
53719         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
53720         return ret_arr;
53721 }
53722
53723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
53724         LDKPublicKey payment_point_ref;
53725         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
53726         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
53727         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
53728         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53729         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53730         CVec_u8Z_free(ret_var);
53731         return ret_arr;
53732 }
53733
53734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
53735         LDKPublicKey funding_pubkey_ref;
53736         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
53737         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
53738         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
53739         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53740         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53741         CVec_u8Z_free(ret_var);
53742         return ret_arr;
53743 }
53744
53745 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) {
53746         LDKPublicKey funding_key_ref;
53747         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
53748         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
53749         LDKECDSASignature funding_sig_ref;
53750         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
53751         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
53752         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
53753         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53754         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53755         Witness_free(ret_var);
53756         return ret_arr;
53757 }
53758
53759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53760         LDKChannelTransactionParameters this_obj_conv;
53761         this_obj_conv.inner = untag_ptr(this_obj);
53762         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53764         ChannelTransactionParameters_free(this_obj_conv);
53765 }
53766
53767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
53768         LDKChannelTransactionParameters this_ptr_conv;
53769         this_ptr_conv.inner = untag_ptr(this_ptr);
53770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53772         this_ptr_conv.is_owned = false;
53773         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
53774         int64_t ret_ref = 0;
53775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53777         return ret_ref;
53778 }
53779
53780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53781         LDKChannelTransactionParameters this_ptr_conv;
53782         this_ptr_conv.inner = untag_ptr(this_ptr);
53783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53785         this_ptr_conv.is_owned = false;
53786         LDKChannelPublicKeys val_conv;
53787         val_conv.inner = untag_ptr(val);
53788         val_conv.is_owned = ptr_is_owned(val);
53789         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53790         val_conv = ChannelPublicKeys_clone(&val_conv);
53791         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
53792 }
53793
53794 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
53795         LDKChannelTransactionParameters 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         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
53801         return ret_conv;
53802 }
53803
53804 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) {
53805         LDKChannelTransactionParameters this_ptr_conv;
53806         this_ptr_conv.inner = untag_ptr(this_ptr);
53807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53809         this_ptr_conv.is_owned = false;
53810         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
53811 }
53812
53813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
53814         LDKChannelTransactionParameters this_ptr_conv;
53815         this_ptr_conv.inner = untag_ptr(this_ptr);
53816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53818         this_ptr_conv.is_owned = false;
53819         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
53820         return ret_conv;
53821 }
53822
53823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
53824         LDKChannelTransactionParameters this_ptr_conv;
53825         this_ptr_conv.inner = untag_ptr(this_ptr);
53826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53828         this_ptr_conv.is_owned = false;
53829         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
53830 }
53831
53832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
53833         LDKChannelTransactionParameters this_ptr_conv;
53834         this_ptr_conv.inner = untag_ptr(this_ptr);
53835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53837         this_ptr_conv.is_owned = false;
53838         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
53839         int64_t ret_ref = 0;
53840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53842         return ret_ref;
53843 }
53844
53845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53846         LDKChannelTransactionParameters this_ptr_conv;
53847         this_ptr_conv.inner = untag_ptr(this_ptr);
53848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53850         this_ptr_conv.is_owned = false;
53851         LDKCounterpartyChannelTransactionParameters val_conv;
53852         val_conv.inner = untag_ptr(val);
53853         val_conv.is_owned = ptr_is_owned(val);
53854         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53855         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
53856         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
53857 }
53858
53859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
53860         LDKChannelTransactionParameters this_ptr_conv;
53861         this_ptr_conv.inner = untag_ptr(this_ptr);
53862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53864         this_ptr_conv.is_owned = false;
53865         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
53866         int64_t ret_ref = 0;
53867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53869         return ret_ref;
53870 }
53871
53872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53873         LDKChannelTransactionParameters this_ptr_conv;
53874         this_ptr_conv.inner = untag_ptr(this_ptr);
53875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53877         this_ptr_conv.is_owned = false;
53878         LDKOutPoint val_conv;
53879         val_conv.inner = untag_ptr(val);
53880         val_conv.is_owned = ptr_is_owned(val);
53881         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53882         val_conv = OutPoint_clone(&val_conv);
53883         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
53884 }
53885
53886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
53887         LDKChannelTransactionParameters this_ptr_conv;
53888         this_ptr_conv.inner = untag_ptr(this_ptr);
53889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53891         this_ptr_conv.is_owned = false;
53892         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
53893         int64_t ret_ref = 0;
53894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53896         return ret_ref;
53897 }
53898
53899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53900         LDKChannelTransactionParameters this_ptr_conv;
53901         this_ptr_conv.inner = untag_ptr(this_ptr);
53902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53904         this_ptr_conv.is_owned = false;
53905         LDKChannelTypeFeatures val_conv;
53906         val_conv.inner = untag_ptr(val);
53907         val_conv.is_owned = ptr_is_owned(val);
53908         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53909         val_conv = ChannelTypeFeatures_clone(&val_conv);
53910         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
53911 }
53912
53913 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) {
53914         LDKChannelPublicKeys holder_pubkeys_arg_conv;
53915         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
53916         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
53917         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
53918         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
53919         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
53920         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
53921         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
53922         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
53923         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
53924         LDKOutPoint funding_outpoint_arg_conv;
53925         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
53926         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
53927         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
53928         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
53929         LDKChannelTypeFeatures channel_type_features_arg_conv;
53930         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
53931         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
53932         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
53933         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
53934         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);
53935         int64_t ret_ref = 0;
53936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53938         return ret_ref;
53939 }
53940
53941 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
53942         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
53943         int64_t ret_ref = 0;
53944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53946         return ret_ref;
53947 }
53948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53949         LDKChannelTransactionParameters arg_conv;
53950         arg_conv.inner = untag_ptr(arg);
53951         arg_conv.is_owned = ptr_is_owned(arg);
53952         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53953         arg_conv.is_owned = false;
53954         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
53955         return ret_conv;
53956 }
53957
53958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53959         LDKChannelTransactionParameters orig_conv;
53960         orig_conv.inner = untag_ptr(orig);
53961         orig_conv.is_owned = ptr_is_owned(orig);
53962         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53963         orig_conv.is_owned = false;
53964         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
53965         int64_t ret_ref = 0;
53966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53968         return ret_ref;
53969 }
53970
53971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
53972         LDKChannelTransactionParameters o_conv;
53973         o_conv.inner = untag_ptr(o);
53974         o_conv.is_owned = ptr_is_owned(o);
53975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53976         o_conv.is_owned = false;
53977         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
53978         return ret_conv;
53979 }
53980
53981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53982         LDKChannelTransactionParameters a_conv;
53983         a_conv.inner = untag_ptr(a);
53984         a_conv.is_owned = ptr_is_owned(a);
53985         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53986         a_conv.is_owned = false;
53987         LDKChannelTransactionParameters b_conv;
53988         b_conv.inner = untag_ptr(b);
53989         b_conv.is_owned = ptr_is_owned(b);
53990         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53991         b_conv.is_owned = false;
53992         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
53993         return ret_conv;
53994 }
53995
53996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53997         LDKCounterpartyChannelTransactionParameters this_obj_conv;
53998         this_obj_conv.inner = untag_ptr(this_obj);
53999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54001         CounterpartyChannelTransactionParameters_free(this_obj_conv);
54002 }
54003
54004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
54005         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54006         this_ptr_conv.inner = untag_ptr(this_ptr);
54007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54009         this_ptr_conv.is_owned = false;
54010         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
54011         int64_t ret_ref = 0;
54012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54014         return ret_ref;
54015 }
54016
54017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54018         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54019         this_ptr_conv.inner = untag_ptr(this_ptr);
54020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54022         this_ptr_conv.is_owned = false;
54023         LDKChannelPublicKeys val_conv;
54024         val_conv.inner = untag_ptr(val);
54025         val_conv.is_owned = ptr_is_owned(val);
54026         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54027         val_conv = ChannelPublicKeys_clone(&val_conv);
54028         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
54029 }
54030
54031 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
54032         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54033         this_ptr_conv.inner = untag_ptr(this_ptr);
54034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54036         this_ptr_conv.is_owned = false;
54037         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
54038         return ret_conv;
54039 }
54040
54041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
54042         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54043         this_ptr_conv.inner = untag_ptr(this_ptr);
54044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54046         this_ptr_conv.is_owned = false;
54047         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
54048 }
54049
54050 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) {
54051         LDKChannelPublicKeys pubkeys_arg_conv;
54052         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
54053         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
54054         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
54055         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
54056         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
54057         int64_t ret_ref = 0;
54058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54060         return ret_ref;
54061 }
54062
54063 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
54064         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
54065         int64_t ret_ref = 0;
54066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54068         return ret_ref;
54069 }
54070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54071         LDKCounterpartyChannelTransactionParameters arg_conv;
54072         arg_conv.inner = untag_ptr(arg);
54073         arg_conv.is_owned = ptr_is_owned(arg);
54074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54075         arg_conv.is_owned = false;
54076         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
54077         return ret_conv;
54078 }
54079
54080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54081         LDKCounterpartyChannelTransactionParameters orig_conv;
54082         orig_conv.inner = untag_ptr(orig);
54083         orig_conv.is_owned = ptr_is_owned(orig);
54084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54085         orig_conv.is_owned = false;
54086         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
54087         int64_t ret_ref = 0;
54088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54090         return ret_ref;
54091 }
54092
54093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
54094         LDKCounterpartyChannelTransactionParameters o_conv;
54095         o_conv.inner = untag_ptr(o);
54096         o_conv.is_owned = ptr_is_owned(o);
54097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54098         o_conv.is_owned = false;
54099         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
54100         return ret_conv;
54101 }
54102
54103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54104         LDKCounterpartyChannelTransactionParameters a_conv;
54105         a_conv.inner = untag_ptr(a);
54106         a_conv.is_owned = ptr_is_owned(a);
54107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54108         a_conv.is_owned = false;
54109         LDKCounterpartyChannelTransactionParameters b_conv;
54110         b_conv.inner = untag_ptr(b);
54111         b_conv.is_owned = ptr_is_owned(b);
54112         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54113         b_conv.is_owned = false;
54114         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
54115         return ret_conv;
54116 }
54117
54118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
54119         LDKChannelTransactionParameters this_arg_conv;
54120         this_arg_conv.inner = untag_ptr(this_arg);
54121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54123         this_arg_conv.is_owned = false;
54124         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
54125         return ret_conv;
54126 }
54127
54128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
54129         LDKChannelTransactionParameters this_arg_conv;
54130         this_arg_conv.inner = untag_ptr(this_arg);
54131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54133         this_arg_conv.is_owned = false;
54134         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
54135         int64_t ret_ref = 0;
54136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54138         return ret_ref;
54139 }
54140
54141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
54142         LDKChannelTransactionParameters this_arg_conv;
54143         this_arg_conv.inner = untag_ptr(this_arg);
54144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54146         this_arg_conv.is_owned = false;
54147         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
54148         int64_t ret_ref = 0;
54149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54151         return ret_ref;
54152 }
54153
54154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
54155         LDKCounterpartyChannelTransactionParameters obj_conv;
54156         obj_conv.inner = untag_ptr(obj);
54157         obj_conv.is_owned = ptr_is_owned(obj);
54158         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54159         obj_conv.is_owned = false;
54160         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
54161         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54162         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54163         CVec_u8Z_free(ret_var);
54164         return ret_arr;
54165 }
54166
54167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54168         LDKu8slice ser_ref;
54169         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54170         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54171         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
54172         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
54173         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54174         return tag_ptr(ret_conv, true);
54175 }
54176
54177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
54178         LDKChannelTransactionParameters obj_conv;
54179         obj_conv.inner = untag_ptr(obj);
54180         obj_conv.is_owned = ptr_is_owned(obj);
54181         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54182         obj_conv.is_owned = false;
54183         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
54184         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54185         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54186         CVec_u8Z_free(ret_var);
54187         return ret_arr;
54188 }
54189
54190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54191         LDKu8slice ser_ref;
54192         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54193         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54194         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
54195         *ret_conv = ChannelTransactionParameters_read(ser_ref);
54196         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54197         return tag_ptr(ret_conv, true);
54198 }
54199
54200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54201         LDKDirectedChannelTransactionParameters this_obj_conv;
54202         this_obj_conv.inner = untag_ptr(this_obj);
54203         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54205         DirectedChannelTransactionParameters_free(this_obj_conv);
54206 }
54207
54208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
54209         LDKDirectedChannelTransactionParameters this_arg_conv;
54210         this_arg_conv.inner = untag_ptr(this_arg);
54211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54213         this_arg_conv.is_owned = false;
54214         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
54215         int64_t ret_ref = 0;
54216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54218         return ret_ref;
54219 }
54220
54221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
54222         LDKDirectedChannelTransactionParameters this_arg_conv;
54223         this_arg_conv.inner = untag_ptr(this_arg);
54224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54226         this_arg_conv.is_owned = false;
54227         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
54228         int64_t ret_ref = 0;
54229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54231         return ret_ref;
54232 }
54233
54234 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
54235         LDKDirectedChannelTransactionParameters this_arg_conv;
54236         this_arg_conv.inner = untag_ptr(this_arg);
54237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54239         this_arg_conv.is_owned = false;
54240         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
54241         return ret_conv;
54242 }
54243
54244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
54245         LDKDirectedChannelTransactionParameters this_arg_conv;
54246         this_arg_conv.inner = untag_ptr(this_arg);
54247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54249         this_arg_conv.is_owned = false;
54250         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
54251         return ret_conv;
54252 }
54253
54254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
54255         LDKDirectedChannelTransactionParameters this_arg_conv;
54256         this_arg_conv.inner = untag_ptr(this_arg);
54257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54259         this_arg_conv.is_owned = false;
54260         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
54261         int64_t ret_ref = 0;
54262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54264         return ret_ref;
54265 }
54266
54267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
54268         LDKDirectedChannelTransactionParameters this_arg_conv;
54269         this_arg_conv.inner = untag_ptr(this_arg);
54270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54272         this_arg_conv.is_owned = false;
54273         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
54274         int64_t ret_ref = 0;
54275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54277         return ret_ref;
54278 }
54279
54280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54281         LDKHolderCommitmentTransaction this_obj_conv;
54282         this_obj_conv.inner = untag_ptr(this_obj);
54283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54285         HolderCommitmentTransaction_free(this_obj_conv);
54286 }
54287
54288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
54289         LDKHolderCommitmentTransaction this_ptr_conv;
54290         this_ptr_conv.inner = untag_ptr(this_ptr);
54291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54293         this_ptr_conv.is_owned = false;
54294         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54295         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
54296         return ret_arr;
54297 }
54298
54299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54300         LDKHolderCommitmentTransaction this_ptr_conv;
54301         this_ptr_conv.inner = untag_ptr(this_ptr);
54302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54304         this_ptr_conv.is_owned = false;
54305         LDKECDSASignature val_ref;
54306         CHECK((*env)->GetArrayLength(env, val) == 64);
54307         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54308         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
54309 }
54310
54311 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
54312         LDKHolderCommitmentTransaction this_ptr_conv;
54313         this_ptr_conv.inner = untag_ptr(this_ptr);
54314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54316         this_ptr_conv.is_owned = false;
54317         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
54318         jobjectArray ret_arr = NULL;
54319         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
54320         ;
54321         for (size_t i = 0; i < ret_var.datalen; i++) {
54322                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
54323                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
54324                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
54325         }
54326         
54327         FREE(ret_var.data);
54328         return ret_arr;
54329 }
54330
54331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
54332         LDKHolderCommitmentTransaction this_ptr_conv;
54333         this_ptr_conv.inner = untag_ptr(this_ptr);
54334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54336         this_ptr_conv.is_owned = false;
54337         LDKCVec_ECDSASignatureZ val_constr;
54338         val_constr.datalen = (*env)->GetArrayLength(env, val);
54339         if (val_constr.datalen > 0)
54340                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54341         else
54342                 val_constr.data = NULL;
54343         for (size_t i = 0; i < val_constr.datalen; i++) {
54344                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
54345                 LDKECDSASignature val_conv_8_ref;
54346                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
54347                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
54348                 val_constr.data[i] = val_conv_8_ref;
54349         }
54350         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
54351 }
54352
54353 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
54354         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
54355         int64_t ret_ref = 0;
54356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54358         return ret_ref;
54359 }
54360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54361         LDKHolderCommitmentTransaction arg_conv;
54362         arg_conv.inner = untag_ptr(arg);
54363         arg_conv.is_owned = ptr_is_owned(arg);
54364         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54365         arg_conv.is_owned = false;
54366         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
54367         return ret_conv;
54368 }
54369
54370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54371         LDKHolderCommitmentTransaction orig_conv;
54372         orig_conv.inner = untag_ptr(orig);
54373         orig_conv.is_owned = ptr_is_owned(orig);
54374         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54375         orig_conv.is_owned = false;
54376         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
54377         int64_t ret_ref = 0;
54378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54380         return ret_ref;
54381 }
54382
54383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
54384         LDKHolderCommitmentTransaction obj_conv;
54385         obj_conv.inner = untag_ptr(obj);
54386         obj_conv.is_owned = ptr_is_owned(obj);
54387         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54388         obj_conv.is_owned = false;
54389         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
54390         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54391         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54392         CVec_u8Z_free(ret_var);
54393         return ret_arr;
54394 }
54395
54396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54397         LDKu8slice ser_ref;
54398         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54399         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54400         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
54401         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
54402         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54403         return tag_ptr(ret_conv, true);
54404 }
54405
54406 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) {
54407         LDKCommitmentTransaction commitment_tx_conv;
54408         commitment_tx_conv.inner = untag_ptr(commitment_tx);
54409         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
54410         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
54411         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
54412         LDKECDSASignature counterparty_sig_ref;
54413         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
54414         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
54415         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
54416         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
54417         if (counterparty_htlc_sigs_constr.datalen > 0)
54418                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54419         else
54420                 counterparty_htlc_sigs_constr.data = NULL;
54421         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
54422                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
54423                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
54424                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
54425                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
54426                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
54427         }
54428         LDKPublicKey holder_funding_key_ref;
54429         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
54430         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
54431         LDKPublicKey counterparty_funding_key_ref;
54432         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
54433         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
54434         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
54435         int64_t ret_ref = 0;
54436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54438         return ret_ref;
54439 }
54440
54441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54442         LDKBuiltCommitmentTransaction this_obj_conv;
54443         this_obj_conv.inner = untag_ptr(this_obj);
54444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54446         BuiltCommitmentTransaction_free(this_obj_conv);
54447 }
54448
54449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
54450         LDKBuiltCommitmentTransaction this_ptr_conv;
54451         this_ptr_conv.inner = untag_ptr(this_ptr);
54452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54454         this_ptr_conv.is_owned = false;
54455         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
54456         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54457         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54458         Transaction_free(ret_var);
54459         return ret_arr;
54460 }
54461
54462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54463         LDKBuiltCommitmentTransaction this_ptr_conv;
54464         this_ptr_conv.inner = untag_ptr(this_ptr);
54465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54467         this_ptr_conv.is_owned = false;
54468         LDKTransaction val_ref;
54469         val_ref.datalen = (*env)->GetArrayLength(env, val);
54470         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
54471         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54472         val_ref.data_is_owned = true;
54473         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
54474 }
54475
54476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
54477         LDKBuiltCommitmentTransaction this_ptr_conv;
54478         this_ptr_conv.inner = untag_ptr(this_ptr);
54479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54481         this_ptr_conv.is_owned = false;
54482         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54483         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
54484         return ret_arr;
54485 }
54486
54487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54488         LDKBuiltCommitmentTransaction this_ptr_conv;
54489         this_ptr_conv.inner = untag_ptr(this_ptr);
54490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54492         this_ptr_conv.is_owned = false;
54493         LDKThirtyTwoBytes val_ref;
54494         CHECK((*env)->GetArrayLength(env, val) == 32);
54495         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54496         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
54497 }
54498
54499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
54500         LDKTransaction transaction_arg_ref;
54501         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
54502         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
54503         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
54504         transaction_arg_ref.data_is_owned = true;
54505         LDKThirtyTwoBytes txid_arg_ref;
54506         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
54507         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
54508         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
54509         int64_t ret_ref = 0;
54510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54512         return ret_ref;
54513 }
54514
54515 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
54516         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
54517         int64_t ret_ref = 0;
54518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54520         return ret_ref;
54521 }
54522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54523         LDKBuiltCommitmentTransaction arg_conv;
54524         arg_conv.inner = untag_ptr(arg);
54525         arg_conv.is_owned = ptr_is_owned(arg);
54526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54527         arg_conv.is_owned = false;
54528         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
54529         return ret_conv;
54530 }
54531
54532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54533         LDKBuiltCommitmentTransaction orig_conv;
54534         orig_conv.inner = untag_ptr(orig);
54535         orig_conv.is_owned = ptr_is_owned(orig);
54536         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54537         orig_conv.is_owned = false;
54538         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
54539         int64_t ret_ref = 0;
54540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54542         return ret_ref;
54543 }
54544
54545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
54546         LDKBuiltCommitmentTransaction obj_conv;
54547         obj_conv.inner = untag_ptr(obj);
54548         obj_conv.is_owned = ptr_is_owned(obj);
54549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54550         obj_conv.is_owned = false;
54551         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
54552         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54553         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54554         CVec_u8Z_free(ret_var);
54555         return ret_arr;
54556 }
54557
54558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54559         LDKu8slice ser_ref;
54560         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54561         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54562         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
54563         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
54564         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54565         return tag_ptr(ret_conv, true);
54566 }
54567
54568 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) {
54569         LDKBuiltCommitmentTransaction this_arg_conv;
54570         this_arg_conv.inner = untag_ptr(this_arg);
54571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54573         this_arg_conv.is_owned = false;
54574         LDKu8slice funding_redeemscript_ref;
54575         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54576         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54577         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54578         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
54579         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54580         return ret_arr;
54581 }
54582
54583 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) {
54584         LDKBuiltCommitmentTransaction this_arg_conv;
54585         this_arg_conv.inner = untag_ptr(this_arg);
54586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54588         this_arg_conv.is_owned = false;
54589         uint8_t funding_key_arr[32];
54590         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
54591         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
54592         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54593         LDKu8slice funding_redeemscript_ref;
54594         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54595         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54596         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54597         (*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);
54598         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54599         return ret_arr;
54600 }
54601
54602 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) {
54603         LDKBuiltCommitmentTransaction this_arg_conv;
54604         this_arg_conv.inner = untag_ptr(this_arg);
54605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54607         this_arg_conv.is_owned = false;
54608         uint8_t funding_key_arr[32];
54609         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
54610         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
54611         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54612         LDKu8slice funding_redeemscript_ref;
54613         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54614         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54615         void* entropy_source_ptr = untag_ptr(entropy_source);
54616         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54617         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54618         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54619         (*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);
54620         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54621         return ret_arr;
54622 }
54623
54624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54625         LDKClosingTransaction this_obj_conv;
54626         this_obj_conv.inner = untag_ptr(this_obj);
54627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54629         ClosingTransaction_free(this_obj_conv);
54630 }
54631
54632 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
54633         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
54634         int64_t ret_ref = 0;
54635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54637         return ret_ref;
54638 }
54639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54640         LDKClosingTransaction arg_conv;
54641         arg_conv.inner = untag_ptr(arg);
54642         arg_conv.is_owned = ptr_is_owned(arg);
54643         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54644         arg_conv.is_owned = false;
54645         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
54646         return ret_conv;
54647 }
54648
54649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54650         LDKClosingTransaction orig_conv;
54651         orig_conv.inner = untag_ptr(orig);
54652         orig_conv.is_owned = ptr_is_owned(orig);
54653         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54654         orig_conv.is_owned = false;
54655         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
54656         int64_t ret_ref = 0;
54657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54659         return ret_ref;
54660 }
54661
54662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
54663         LDKClosingTransaction o_conv;
54664         o_conv.inner = untag_ptr(o);
54665         o_conv.is_owned = ptr_is_owned(o);
54666         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54667         o_conv.is_owned = false;
54668         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
54669         return ret_conv;
54670 }
54671
54672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54673         LDKClosingTransaction a_conv;
54674         a_conv.inner = untag_ptr(a);
54675         a_conv.is_owned = ptr_is_owned(a);
54676         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54677         a_conv.is_owned = false;
54678         LDKClosingTransaction b_conv;
54679         b_conv.inner = untag_ptr(b);
54680         b_conv.is_owned = ptr_is_owned(b);
54681         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54682         b_conv.is_owned = false;
54683         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
54684         return ret_conv;
54685 }
54686
54687 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) {
54688         LDKCVec_u8Z to_holder_script_ref;
54689         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
54690         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
54691         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
54692         LDKCVec_u8Z to_counterparty_script_ref;
54693         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
54694         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
54695         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
54696         LDKOutPoint funding_outpoint_conv;
54697         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54698         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54699         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54700         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54701         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
54702         int64_t ret_ref = 0;
54703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54705         return ret_ref;
54706 }
54707
54708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
54709         LDKClosingTransaction this_arg_conv;
54710         this_arg_conv.inner = untag_ptr(this_arg);
54711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54713         this_arg_conv.is_owned = false;
54714         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
54715         int64_t ret_ref = 0;
54716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54718         return ret_ref;
54719 }
54720
54721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
54722         LDKClosingTransaction this_arg_conv;
54723         this_arg_conv.inner = untag_ptr(this_arg);
54724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54726         this_arg_conv.is_owned = false;
54727         LDKOutPoint funding_outpoint_conv;
54728         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54729         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54730         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54731         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54732         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
54733         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
54734         return tag_ptr(ret_conv, true);
54735 }
54736
54737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54738         LDKClosingTransaction this_arg_conv;
54739         this_arg_conv.inner = untag_ptr(this_arg);
54740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54742         this_arg_conv.is_owned = false;
54743         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
54744         return ret_conv;
54745 }
54746
54747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54748         LDKClosingTransaction this_arg_conv;
54749         this_arg_conv.inner = untag_ptr(this_arg);
54750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54752         this_arg_conv.is_owned = false;
54753         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
54754         return ret_conv;
54755 }
54756
54757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
54758         LDKClosingTransaction this_arg_conv;
54759         this_arg_conv.inner = untag_ptr(this_arg);
54760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54762         this_arg_conv.is_owned = false;
54763         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
54764         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54765         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54766         return ret_arr;
54767 }
54768
54769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
54770         LDKClosingTransaction this_arg_conv;
54771         this_arg_conv.inner = untag_ptr(this_arg);
54772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54774         this_arg_conv.is_owned = false;
54775         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
54776         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54777         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54778         return ret_arr;
54779 }
54780
54781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54782         LDKTrustedClosingTransaction this_obj_conv;
54783         this_obj_conv.inner = untag_ptr(this_obj);
54784         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54786         TrustedClosingTransaction_free(this_obj_conv);
54787 }
54788
54789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
54790         LDKTrustedClosingTransaction this_arg_conv;
54791         this_arg_conv.inner = untag_ptr(this_arg);
54792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54794         this_arg_conv.is_owned = false;
54795         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
54796         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54797         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54798         Transaction_free(ret_var);
54799         return ret_arr;
54800 }
54801
54802 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) {
54803         LDKTrustedClosingTransaction this_arg_conv;
54804         this_arg_conv.inner = untag_ptr(this_arg);
54805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54807         this_arg_conv.is_owned = false;
54808         LDKu8slice funding_redeemscript_ref;
54809         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54810         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54811         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54812         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
54813         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54814         return ret_arr;
54815 }
54816
54817 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) {
54818         LDKTrustedClosingTransaction this_arg_conv;
54819         this_arg_conv.inner = untag_ptr(this_arg);
54820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54822         this_arg_conv.is_owned = false;
54823         uint8_t funding_key_arr[32];
54824         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
54825         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
54826         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54827         LDKu8slice funding_redeemscript_ref;
54828         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
54829         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
54830         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54831         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
54832         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
54833         return ret_arr;
54834 }
54835
54836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54837         LDKCommitmentTransaction this_obj_conv;
54838         this_obj_conv.inner = untag_ptr(this_obj);
54839         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54841         CommitmentTransaction_free(this_obj_conv);
54842 }
54843
54844 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
54845         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
54846         int64_t ret_ref = 0;
54847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54849         return ret_ref;
54850 }
54851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54852         LDKCommitmentTransaction arg_conv;
54853         arg_conv.inner = untag_ptr(arg);
54854         arg_conv.is_owned = ptr_is_owned(arg);
54855         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54856         arg_conv.is_owned = false;
54857         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
54858         return ret_conv;
54859 }
54860
54861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54862         LDKCommitmentTransaction orig_conv;
54863         orig_conv.inner = untag_ptr(orig);
54864         orig_conv.is_owned = ptr_is_owned(orig);
54865         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54866         orig_conv.is_owned = false;
54867         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
54868         int64_t ret_ref = 0;
54869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54871         return ret_ref;
54872 }
54873
54874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
54875         LDKCommitmentTransaction obj_conv;
54876         obj_conv.inner = untag_ptr(obj);
54877         obj_conv.is_owned = ptr_is_owned(obj);
54878         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54879         obj_conv.is_owned = false;
54880         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
54881         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54882         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54883         CVec_u8Z_free(ret_var);
54884         return ret_arr;
54885 }
54886
54887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54888         LDKu8slice ser_ref;
54889         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54890         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54891         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
54892         *ret_conv = CommitmentTransaction_read(ser_ref);
54893         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54894         return tag_ptr(ret_conv, true);
54895 }
54896
54897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
54898         LDKCommitmentTransaction this_arg_conv;
54899         this_arg_conv.inner = untag_ptr(this_arg);
54900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54902         this_arg_conv.is_owned = false;
54903         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
54904         return ret_conv;
54905 }
54906
54907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg) {
54908         LDKCommitmentTransaction this_arg_conv;
54909         this_arg_conv.inner = untag_ptr(this_arg);
54910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54912         this_arg_conv.is_owned = false;
54913         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
54914         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form);
54915         return ret_arr;
54916 }
54917
54918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54919         LDKCommitmentTransaction this_arg_conv;
54920         this_arg_conv.inner = untag_ptr(this_arg);
54921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54923         this_arg_conv.is_owned = false;
54924         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
54925         return ret_conv;
54926 }
54927
54928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
54929         LDKCommitmentTransaction this_arg_conv;
54930         this_arg_conv.inner = untag_ptr(this_arg);
54931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54933         this_arg_conv.is_owned = false;
54934         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
54935         return ret_conv;
54936 }
54937
54938 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
54939         LDKCommitmentTransaction this_arg_conv;
54940         this_arg_conv.inner = untag_ptr(this_arg);
54941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54943         this_arg_conv.is_owned = false;
54944         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
54945         return ret_conv;
54946 }
54947
54948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
54949         LDKCommitmentTransaction this_arg_conv;
54950         this_arg_conv.inner = untag_ptr(this_arg);
54951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54953         this_arg_conv.is_owned = false;
54954         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
54955         int64_t ret_ref = 0;
54956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54958         return ret_ref;
54959 }
54960
54961 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) {
54962         LDKCommitmentTransaction this_arg_conv;
54963         this_arg_conv.inner = untag_ptr(this_arg);
54964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54966         this_arg_conv.is_owned = false;
54967         LDKDirectedChannelTransactionParameters channel_parameters_conv;
54968         channel_parameters_conv.inner = untag_ptr(channel_parameters);
54969         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
54970         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
54971         channel_parameters_conv.is_owned = false;
54972         LDKChannelPublicKeys broadcaster_keys_conv;
54973         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
54974         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
54975         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
54976         broadcaster_keys_conv.is_owned = false;
54977         LDKChannelPublicKeys countersignatory_keys_conv;
54978         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
54979         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
54980         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
54981         countersignatory_keys_conv.is_owned = false;
54982         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
54983         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
54984         return tag_ptr(ret_conv, true);
54985 }
54986
54987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54988         LDKTrustedCommitmentTransaction this_obj_conv;
54989         this_obj_conv.inner = untag_ptr(this_obj);
54990         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54992         TrustedCommitmentTransaction_free(this_obj_conv);
54993 }
54994
54995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
54996         LDKTrustedCommitmentTransaction this_arg_conv;
54997         this_arg_conv.inner = untag_ptr(this_arg);
54998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55000         this_arg_conv.is_owned = false;
55001         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55002         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
55003         return ret_arr;
55004 }
55005
55006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
55007         LDKTrustedCommitmentTransaction this_arg_conv;
55008         this_arg_conv.inner = untag_ptr(this_arg);
55009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55011         this_arg_conv.is_owned = false;
55012         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
55013         int64_t ret_ref = 0;
55014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55016         return ret_ref;
55017 }
55018
55019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
55020         LDKTrustedCommitmentTransaction this_arg_conv;
55021         this_arg_conv.inner = untag_ptr(this_arg);
55022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55024         this_arg_conv.is_owned = false;
55025         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
55026         int64_t ret_ref = 0;
55027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55029         return ret_ref;
55030 }
55031
55032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
55033         LDKTrustedCommitmentTransaction this_arg_conv;
55034         this_arg_conv.inner = untag_ptr(this_arg);
55035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55037         this_arg_conv.is_owned = false;
55038         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
55039         int64_t ret_ref = 0;
55040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55042         return ret_ref;
55043 }
55044
55045 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) {
55046         LDKTrustedCommitmentTransaction this_arg_conv;
55047         this_arg_conv.inner = untag_ptr(this_arg);
55048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55050         this_arg_conv.is_owned = false;
55051         uint8_t htlc_base_key_arr[32];
55052         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
55053         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
55054         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
55055         LDKDirectedChannelTransactionParameters channel_parameters_conv;
55056         channel_parameters_conv.inner = untag_ptr(channel_parameters);
55057         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
55058         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
55059         channel_parameters_conv.is_owned = false;
55060         void* entropy_source_ptr = untag_ptr(entropy_source);
55061         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
55062         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
55063         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
55064         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
55065         return tag_ptr(ret_conv, true);
55066 }
55067
55068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
55069         LDKTrustedCommitmentTransaction this_arg_conv;
55070         this_arg_conv.inner = untag_ptr(this_arg);
55071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55073         this_arg_conv.is_owned = false;
55074         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
55075         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
55076         int64_t ret_ref = tag_ptr(ret_copy, true);
55077         return ret_ref;
55078 }
55079
55080 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) {
55081         LDKTrustedCommitmentTransaction this_arg_conv;
55082         this_arg_conv.inner = untag_ptr(this_arg);
55083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55085         this_arg_conv.is_owned = false;
55086         LDKCVec_u8Z destination_script_ref;
55087         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
55088         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
55089         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
55090         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
55091         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
55092         return tag_ptr(ret_conv, true);
55093 }
55094
55095 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) {
55096         LDKPublicKey broadcaster_payment_basepoint_ref;
55097         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
55098         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
55099         LDKPublicKey countersignatory_payment_basepoint_ref;
55100         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
55101         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
55102         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
55103         return ret_conv;
55104 }
55105
55106 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55107         LDKInitFeatures a_conv;
55108         a_conv.inner = untag_ptr(a);
55109         a_conv.is_owned = ptr_is_owned(a);
55110         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55111         a_conv.is_owned = false;
55112         LDKInitFeatures b_conv;
55113         b_conv.inner = untag_ptr(b);
55114         b_conv.is_owned = ptr_is_owned(b);
55115         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55116         b_conv.is_owned = false;
55117         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
55118         return ret_conv;
55119 }
55120
55121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55122         LDKNodeFeatures a_conv;
55123         a_conv.inner = untag_ptr(a);
55124         a_conv.is_owned = ptr_is_owned(a);
55125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55126         a_conv.is_owned = false;
55127         LDKNodeFeatures b_conv;
55128         b_conv.inner = untag_ptr(b);
55129         b_conv.is_owned = ptr_is_owned(b);
55130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55131         b_conv.is_owned = false;
55132         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
55133         return ret_conv;
55134 }
55135
55136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55137         LDKChannelFeatures a_conv;
55138         a_conv.inner = untag_ptr(a);
55139         a_conv.is_owned = ptr_is_owned(a);
55140         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55141         a_conv.is_owned = false;
55142         LDKChannelFeatures b_conv;
55143         b_conv.inner = untag_ptr(b);
55144         b_conv.is_owned = ptr_is_owned(b);
55145         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55146         b_conv.is_owned = false;
55147         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
55148         return ret_conv;
55149 }
55150
55151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55152         LDKBolt11InvoiceFeatures a_conv;
55153         a_conv.inner = untag_ptr(a);
55154         a_conv.is_owned = ptr_is_owned(a);
55155         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55156         a_conv.is_owned = false;
55157         LDKBolt11InvoiceFeatures b_conv;
55158         b_conv.inner = untag_ptr(b);
55159         b_conv.is_owned = ptr_is_owned(b);
55160         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55161         b_conv.is_owned = false;
55162         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
55163         return ret_conv;
55164 }
55165
55166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55167         LDKOfferFeatures a_conv;
55168         a_conv.inner = untag_ptr(a);
55169         a_conv.is_owned = ptr_is_owned(a);
55170         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55171         a_conv.is_owned = false;
55172         LDKOfferFeatures b_conv;
55173         b_conv.inner = untag_ptr(b);
55174         b_conv.is_owned = ptr_is_owned(b);
55175         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55176         b_conv.is_owned = false;
55177         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
55178         return ret_conv;
55179 }
55180
55181 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55182         LDKInvoiceRequestFeatures a_conv;
55183         a_conv.inner = untag_ptr(a);
55184         a_conv.is_owned = ptr_is_owned(a);
55185         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55186         a_conv.is_owned = false;
55187         LDKInvoiceRequestFeatures b_conv;
55188         b_conv.inner = untag_ptr(b);
55189         b_conv.is_owned = ptr_is_owned(b);
55190         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55191         b_conv.is_owned = false;
55192         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
55193         return ret_conv;
55194 }
55195
55196 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55197         LDKBolt12InvoiceFeatures a_conv;
55198         a_conv.inner = untag_ptr(a);
55199         a_conv.is_owned = ptr_is_owned(a);
55200         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55201         a_conv.is_owned = false;
55202         LDKBolt12InvoiceFeatures b_conv;
55203         b_conv.inner = untag_ptr(b);
55204         b_conv.is_owned = ptr_is_owned(b);
55205         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55206         b_conv.is_owned = false;
55207         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
55208         return ret_conv;
55209 }
55210
55211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55212         LDKBlindedHopFeatures a_conv;
55213         a_conv.inner = untag_ptr(a);
55214         a_conv.is_owned = ptr_is_owned(a);
55215         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55216         a_conv.is_owned = false;
55217         LDKBlindedHopFeatures b_conv;
55218         b_conv.inner = untag_ptr(b);
55219         b_conv.is_owned = ptr_is_owned(b);
55220         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55221         b_conv.is_owned = false;
55222         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
55223         return ret_conv;
55224 }
55225
55226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55227         LDKChannelTypeFeatures a_conv;
55228         a_conv.inner = untag_ptr(a);
55229         a_conv.is_owned = ptr_is_owned(a);
55230         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55231         a_conv.is_owned = false;
55232         LDKChannelTypeFeatures b_conv;
55233         b_conv.inner = untag_ptr(b);
55234         b_conv.is_owned = ptr_is_owned(b);
55235         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55236         b_conv.is_owned = false;
55237         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
55238         return ret_conv;
55239 }
55240
55241 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
55242         LDKInitFeatures ret_var = InitFeatures_clone(arg);
55243         int64_t ret_ref = 0;
55244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55246         return ret_ref;
55247 }
55248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55249         LDKInitFeatures arg_conv;
55250         arg_conv.inner = untag_ptr(arg);
55251         arg_conv.is_owned = ptr_is_owned(arg);
55252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55253         arg_conv.is_owned = false;
55254         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
55255         return ret_conv;
55256 }
55257
55258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55259         LDKInitFeatures orig_conv;
55260         orig_conv.inner = untag_ptr(orig);
55261         orig_conv.is_owned = ptr_is_owned(orig);
55262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55263         orig_conv.is_owned = false;
55264         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
55265         int64_t ret_ref = 0;
55266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55268         return ret_ref;
55269 }
55270
55271 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
55272         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
55273         int64_t ret_ref = 0;
55274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55276         return ret_ref;
55277 }
55278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55279         LDKNodeFeatures arg_conv;
55280         arg_conv.inner = untag_ptr(arg);
55281         arg_conv.is_owned = ptr_is_owned(arg);
55282         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55283         arg_conv.is_owned = false;
55284         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
55285         return ret_conv;
55286 }
55287
55288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55289         LDKNodeFeatures orig_conv;
55290         orig_conv.inner = untag_ptr(orig);
55291         orig_conv.is_owned = ptr_is_owned(orig);
55292         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55293         orig_conv.is_owned = false;
55294         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
55295         int64_t ret_ref = 0;
55296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55298         return ret_ref;
55299 }
55300
55301 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
55302         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
55303         int64_t ret_ref = 0;
55304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55306         return ret_ref;
55307 }
55308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55309         LDKChannelFeatures arg_conv;
55310         arg_conv.inner = untag_ptr(arg);
55311         arg_conv.is_owned = ptr_is_owned(arg);
55312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55313         arg_conv.is_owned = false;
55314         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
55315         return ret_conv;
55316 }
55317
55318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55319         LDKChannelFeatures orig_conv;
55320         orig_conv.inner = untag_ptr(orig);
55321         orig_conv.is_owned = ptr_is_owned(orig);
55322         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55323         orig_conv.is_owned = false;
55324         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
55325         int64_t ret_ref = 0;
55326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55328         return ret_ref;
55329 }
55330
55331 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
55332         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
55333         int64_t ret_ref = 0;
55334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55336         return ret_ref;
55337 }
55338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55339         LDKBolt11InvoiceFeatures arg_conv;
55340         arg_conv.inner = untag_ptr(arg);
55341         arg_conv.is_owned = ptr_is_owned(arg);
55342         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55343         arg_conv.is_owned = false;
55344         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
55345         return ret_conv;
55346 }
55347
55348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55349         LDKBolt11InvoiceFeatures orig_conv;
55350         orig_conv.inner = untag_ptr(orig);
55351         orig_conv.is_owned = ptr_is_owned(orig);
55352         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55353         orig_conv.is_owned = false;
55354         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
55355         int64_t ret_ref = 0;
55356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55358         return ret_ref;
55359 }
55360
55361 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
55362         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
55363         int64_t ret_ref = 0;
55364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55366         return ret_ref;
55367 }
55368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55369         LDKOfferFeatures arg_conv;
55370         arg_conv.inner = untag_ptr(arg);
55371         arg_conv.is_owned = ptr_is_owned(arg);
55372         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55373         arg_conv.is_owned = false;
55374         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
55375         return ret_conv;
55376 }
55377
55378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55379         LDKOfferFeatures orig_conv;
55380         orig_conv.inner = untag_ptr(orig);
55381         orig_conv.is_owned = ptr_is_owned(orig);
55382         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55383         orig_conv.is_owned = false;
55384         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
55385         int64_t ret_ref = 0;
55386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55388         return ret_ref;
55389 }
55390
55391 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
55392         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
55393         int64_t ret_ref = 0;
55394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55396         return ret_ref;
55397 }
55398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55399         LDKInvoiceRequestFeatures arg_conv;
55400         arg_conv.inner = untag_ptr(arg);
55401         arg_conv.is_owned = ptr_is_owned(arg);
55402         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55403         arg_conv.is_owned = false;
55404         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
55405         return ret_conv;
55406 }
55407
55408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55409         LDKInvoiceRequestFeatures orig_conv;
55410         orig_conv.inner = untag_ptr(orig);
55411         orig_conv.is_owned = ptr_is_owned(orig);
55412         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55413         orig_conv.is_owned = false;
55414         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
55415         int64_t ret_ref = 0;
55416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55418         return ret_ref;
55419 }
55420
55421 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
55422         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
55423         int64_t ret_ref = 0;
55424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55426         return ret_ref;
55427 }
55428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55429         LDKBolt12InvoiceFeatures arg_conv;
55430         arg_conv.inner = untag_ptr(arg);
55431         arg_conv.is_owned = ptr_is_owned(arg);
55432         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55433         arg_conv.is_owned = false;
55434         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
55435         return ret_conv;
55436 }
55437
55438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55439         LDKBolt12InvoiceFeatures orig_conv;
55440         orig_conv.inner = untag_ptr(orig);
55441         orig_conv.is_owned = ptr_is_owned(orig);
55442         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55443         orig_conv.is_owned = false;
55444         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
55445         int64_t ret_ref = 0;
55446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55448         return ret_ref;
55449 }
55450
55451 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
55452         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
55453         int64_t ret_ref = 0;
55454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55456         return ret_ref;
55457 }
55458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55459         LDKBlindedHopFeatures arg_conv;
55460         arg_conv.inner = untag_ptr(arg);
55461         arg_conv.is_owned = ptr_is_owned(arg);
55462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55463         arg_conv.is_owned = false;
55464         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
55465         return ret_conv;
55466 }
55467
55468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55469         LDKBlindedHopFeatures orig_conv;
55470         orig_conv.inner = untag_ptr(orig);
55471         orig_conv.is_owned = ptr_is_owned(orig);
55472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55473         orig_conv.is_owned = false;
55474         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
55475         int64_t ret_ref = 0;
55476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55478         return ret_ref;
55479 }
55480
55481 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
55482         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
55483         int64_t ret_ref = 0;
55484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55486         return ret_ref;
55487 }
55488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55489         LDKChannelTypeFeatures arg_conv;
55490         arg_conv.inner = untag_ptr(arg);
55491         arg_conv.is_owned = ptr_is_owned(arg);
55492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55493         arg_conv.is_owned = false;
55494         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
55495         return ret_conv;
55496 }
55497
55498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55499         LDKChannelTypeFeatures orig_conv;
55500         orig_conv.inner = untag_ptr(orig);
55501         orig_conv.is_owned = ptr_is_owned(orig);
55502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55503         orig_conv.is_owned = false;
55504         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
55505         int64_t ret_ref = 0;
55506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55508         return ret_ref;
55509 }
55510
55511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55512         LDKInitFeatures this_obj_conv;
55513         this_obj_conv.inner = untag_ptr(this_obj);
55514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55516         InitFeatures_free(this_obj_conv);
55517 }
55518
55519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55520         LDKNodeFeatures this_obj_conv;
55521         this_obj_conv.inner = untag_ptr(this_obj);
55522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55524         NodeFeatures_free(this_obj_conv);
55525 }
55526
55527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55528         LDKChannelFeatures this_obj_conv;
55529         this_obj_conv.inner = untag_ptr(this_obj);
55530         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55532         ChannelFeatures_free(this_obj_conv);
55533 }
55534
55535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55536         LDKBolt11InvoiceFeatures this_obj_conv;
55537         this_obj_conv.inner = untag_ptr(this_obj);
55538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55540         Bolt11InvoiceFeatures_free(this_obj_conv);
55541 }
55542
55543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55544         LDKOfferFeatures this_obj_conv;
55545         this_obj_conv.inner = untag_ptr(this_obj);
55546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55548         OfferFeatures_free(this_obj_conv);
55549 }
55550
55551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55552         LDKInvoiceRequestFeatures this_obj_conv;
55553         this_obj_conv.inner = untag_ptr(this_obj);
55554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55556         InvoiceRequestFeatures_free(this_obj_conv);
55557 }
55558
55559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55560         LDKBolt12InvoiceFeatures this_obj_conv;
55561         this_obj_conv.inner = untag_ptr(this_obj);
55562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55564         Bolt12InvoiceFeatures_free(this_obj_conv);
55565 }
55566
55567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55568         LDKBlindedHopFeatures this_obj_conv;
55569         this_obj_conv.inner = untag_ptr(this_obj);
55570         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55572         BlindedHopFeatures_free(this_obj_conv);
55573 }
55574
55575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55576         LDKChannelTypeFeatures this_obj_conv;
55577         this_obj_conv.inner = untag_ptr(this_obj);
55578         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55580         ChannelTypeFeatures_free(this_obj_conv);
55581 }
55582
55583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
55584         LDKInitFeatures ret_var = InitFeatures_empty();
55585         int64_t ret_ref = 0;
55586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55588         return ret_ref;
55589 }
55590
55591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55592         LDKInitFeatures this_arg_conv;
55593         this_arg_conv.inner = untag_ptr(this_arg);
55594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55596         this_arg_conv.is_owned = false;
55597         LDKInitFeatures other_conv;
55598         other_conv.inner = untag_ptr(other);
55599         other_conv.is_owned = ptr_is_owned(other);
55600         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55601         other_conv.is_owned = false;
55602         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55603         return ret_conv;
55604 }
55605
55606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55607         LDKInitFeatures this_arg_conv;
55608         this_arg_conv.inner = untag_ptr(this_arg);
55609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55611         this_arg_conv.is_owned = false;
55612         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
55613         return ret_conv;
55614 }
55615
55616 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) {
55617         LDKInitFeatures this_arg_conv;
55618         this_arg_conv.inner = untag_ptr(this_arg);
55619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55621         this_arg_conv.is_owned = false;
55622         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55623         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
55624         return tag_ptr(ret_conv, true);
55625 }
55626
55627 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) {
55628         LDKInitFeatures this_arg_conv;
55629         this_arg_conv.inner = untag_ptr(this_arg);
55630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55632         this_arg_conv.is_owned = false;
55633         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55634         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55635         return tag_ptr(ret_conv, true);
55636 }
55637
55638 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) {
55639         LDKInitFeatures this_arg_conv;
55640         this_arg_conv.inner = untag_ptr(this_arg);
55641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55643         this_arg_conv.is_owned = false;
55644         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55645         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
55646         return tag_ptr(ret_conv, true);
55647 }
55648
55649 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) {
55650         LDKInitFeatures this_arg_conv;
55651         this_arg_conv.inner = untag_ptr(this_arg);
55652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55654         this_arg_conv.is_owned = false;
55655         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55656         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55657         return tag_ptr(ret_conv, true);
55658 }
55659
55660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
55661         LDKNodeFeatures ret_var = NodeFeatures_empty();
55662         int64_t ret_ref = 0;
55663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55665         return ret_ref;
55666 }
55667
55668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55669         LDKNodeFeatures this_arg_conv;
55670         this_arg_conv.inner = untag_ptr(this_arg);
55671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55673         this_arg_conv.is_owned = false;
55674         LDKNodeFeatures other_conv;
55675         other_conv.inner = untag_ptr(other);
55676         other_conv.is_owned = ptr_is_owned(other);
55677         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55678         other_conv.is_owned = false;
55679         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55680         return ret_conv;
55681 }
55682
55683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55684         LDKNodeFeatures this_arg_conv;
55685         this_arg_conv.inner = untag_ptr(this_arg);
55686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55688         this_arg_conv.is_owned = false;
55689         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
55690         return ret_conv;
55691 }
55692
55693 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) {
55694         LDKNodeFeatures this_arg_conv;
55695         this_arg_conv.inner = untag_ptr(this_arg);
55696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55698         this_arg_conv.is_owned = false;
55699         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55700         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
55701         return tag_ptr(ret_conv, true);
55702 }
55703
55704 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) {
55705         LDKNodeFeatures this_arg_conv;
55706         this_arg_conv.inner = untag_ptr(this_arg);
55707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55709         this_arg_conv.is_owned = false;
55710         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55711         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55712         return tag_ptr(ret_conv, true);
55713 }
55714
55715 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) {
55716         LDKNodeFeatures this_arg_conv;
55717         this_arg_conv.inner = untag_ptr(this_arg);
55718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55720         this_arg_conv.is_owned = false;
55721         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55722         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
55723         return tag_ptr(ret_conv, true);
55724 }
55725
55726 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) {
55727         LDKNodeFeatures this_arg_conv;
55728         this_arg_conv.inner = untag_ptr(this_arg);
55729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55731         this_arg_conv.is_owned = false;
55732         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55733         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55734         return tag_ptr(ret_conv, true);
55735 }
55736
55737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
55738         LDKChannelFeatures ret_var = ChannelFeatures_empty();
55739         int64_t ret_ref = 0;
55740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55742         return ret_ref;
55743 }
55744
55745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55746         LDKChannelFeatures this_arg_conv;
55747         this_arg_conv.inner = untag_ptr(this_arg);
55748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55750         this_arg_conv.is_owned = false;
55751         LDKChannelFeatures other_conv;
55752         other_conv.inner = untag_ptr(other);
55753         other_conv.is_owned = ptr_is_owned(other);
55754         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55755         other_conv.is_owned = false;
55756         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55757         return ret_conv;
55758 }
55759
55760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55761         LDKChannelFeatures this_arg_conv;
55762         this_arg_conv.inner = untag_ptr(this_arg);
55763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55765         this_arg_conv.is_owned = false;
55766         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
55767         return ret_conv;
55768 }
55769
55770 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) {
55771         LDKChannelFeatures this_arg_conv;
55772         this_arg_conv.inner = untag_ptr(this_arg);
55773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55775         this_arg_conv.is_owned = false;
55776         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55777         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
55778         return tag_ptr(ret_conv, true);
55779 }
55780
55781 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) {
55782         LDKChannelFeatures this_arg_conv;
55783         this_arg_conv.inner = untag_ptr(this_arg);
55784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55786         this_arg_conv.is_owned = false;
55787         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55788         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55789         return tag_ptr(ret_conv, true);
55790 }
55791
55792 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) {
55793         LDKChannelFeatures this_arg_conv;
55794         this_arg_conv.inner = untag_ptr(this_arg);
55795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55797         this_arg_conv.is_owned = false;
55798         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55799         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
55800         return tag_ptr(ret_conv, true);
55801 }
55802
55803 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) {
55804         LDKChannelFeatures this_arg_conv;
55805         this_arg_conv.inner = untag_ptr(this_arg);
55806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55808         this_arg_conv.is_owned = false;
55809         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55810         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55811         return tag_ptr(ret_conv, true);
55812 }
55813
55814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
55815         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
55816         int64_t ret_ref = 0;
55817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55819         return ret_ref;
55820 }
55821
55822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55823         LDKBolt11InvoiceFeatures this_arg_conv;
55824         this_arg_conv.inner = untag_ptr(this_arg);
55825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55827         this_arg_conv.is_owned = false;
55828         LDKBolt11InvoiceFeatures other_conv;
55829         other_conv.inner = untag_ptr(other);
55830         other_conv.is_owned = ptr_is_owned(other);
55831         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55832         other_conv.is_owned = false;
55833         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55834         return ret_conv;
55835 }
55836
55837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55838         LDKBolt11InvoiceFeatures this_arg_conv;
55839         this_arg_conv.inner = untag_ptr(this_arg);
55840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55842         this_arg_conv.is_owned = false;
55843         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
55844         return ret_conv;
55845 }
55846
55847 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) {
55848         LDKBolt11InvoiceFeatures this_arg_conv;
55849         this_arg_conv.inner = untag_ptr(this_arg);
55850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55852         this_arg_conv.is_owned = false;
55853         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55854         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
55855         return tag_ptr(ret_conv, true);
55856 }
55857
55858 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) {
55859         LDKBolt11InvoiceFeatures this_arg_conv;
55860         this_arg_conv.inner = untag_ptr(this_arg);
55861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55863         this_arg_conv.is_owned = false;
55864         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55865         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55866         return tag_ptr(ret_conv, true);
55867 }
55868
55869 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) {
55870         LDKBolt11InvoiceFeatures this_arg_conv;
55871         this_arg_conv.inner = untag_ptr(this_arg);
55872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55874         this_arg_conv.is_owned = false;
55875         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55876         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
55877         return tag_ptr(ret_conv, true);
55878 }
55879
55880 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) {
55881         LDKBolt11InvoiceFeatures this_arg_conv;
55882         this_arg_conv.inner = untag_ptr(this_arg);
55883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55885         this_arg_conv.is_owned = false;
55886         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55887         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55888         return tag_ptr(ret_conv, true);
55889 }
55890
55891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
55892         LDKOfferFeatures ret_var = OfferFeatures_empty();
55893         int64_t ret_ref = 0;
55894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55896         return ret_ref;
55897 }
55898
55899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55900         LDKOfferFeatures this_arg_conv;
55901         this_arg_conv.inner = untag_ptr(this_arg);
55902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55904         this_arg_conv.is_owned = false;
55905         LDKOfferFeatures other_conv;
55906         other_conv.inner = untag_ptr(other);
55907         other_conv.is_owned = ptr_is_owned(other);
55908         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55909         other_conv.is_owned = false;
55910         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55911         return ret_conv;
55912 }
55913
55914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55915         LDKOfferFeatures this_arg_conv;
55916         this_arg_conv.inner = untag_ptr(this_arg);
55917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55919         this_arg_conv.is_owned = false;
55920         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
55921         return ret_conv;
55922 }
55923
55924 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) {
55925         LDKOfferFeatures this_arg_conv;
55926         this_arg_conv.inner = untag_ptr(this_arg);
55927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55929         this_arg_conv.is_owned = false;
55930         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55931         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
55932         return tag_ptr(ret_conv, true);
55933 }
55934
55935 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) {
55936         LDKOfferFeatures this_arg_conv;
55937         this_arg_conv.inner = untag_ptr(this_arg);
55938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55940         this_arg_conv.is_owned = false;
55941         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55942         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55943         return tag_ptr(ret_conv, true);
55944 }
55945
55946 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) {
55947         LDKOfferFeatures this_arg_conv;
55948         this_arg_conv.inner = untag_ptr(this_arg);
55949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55951         this_arg_conv.is_owned = false;
55952         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55953         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
55954         return tag_ptr(ret_conv, true);
55955 }
55956
55957 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) {
55958         LDKOfferFeatures this_arg_conv;
55959         this_arg_conv.inner = untag_ptr(this_arg);
55960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55962         this_arg_conv.is_owned = false;
55963         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55964         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55965         return tag_ptr(ret_conv, true);
55966 }
55967
55968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
55969         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
55970         int64_t ret_ref = 0;
55971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55973         return ret_ref;
55974 }
55975
55976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
55977         LDKInvoiceRequestFeatures this_arg_conv;
55978         this_arg_conv.inner = untag_ptr(this_arg);
55979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55981         this_arg_conv.is_owned = false;
55982         LDKInvoiceRequestFeatures other_conv;
55983         other_conv.inner = untag_ptr(other);
55984         other_conv.is_owned = ptr_is_owned(other);
55985         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55986         other_conv.is_owned = false;
55987         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55988         return ret_conv;
55989 }
55990
55991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
55992         LDKInvoiceRequestFeatures this_arg_conv;
55993         this_arg_conv.inner = untag_ptr(this_arg);
55994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55996         this_arg_conv.is_owned = false;
55997         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
55998         return ret_conv;
55999 }
56000
56001 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) {
56002         LDKInvoiceRequestFeatures this_arg_conv;
56003         this_arg_conv.inner = untag_ptr(this_arg);
56004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56006         this_arg_conv.is_owned = false;
56007         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56008         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
56009         return tag_ptr(ret_conv, true);
56010 }
56011
56012 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) {
56013         LDKInvoiceRequestFeatures this_arg_conv;
56014         this_arg_conv.inner = untag_ptr(this_arg);
56015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56017         this_arg_conv.is_owned = false;
56018         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56019         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56020         return tag_ptr(ret_conv, true);
56021 }
56022
56023 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) {
56024         LDKInvoiceRequestFeatures this_arg_conv;
56025         this_arg_conv.inner = untag_ptr(this_arg);
56026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56028         this_arg_conv.is_owned = false;
56029         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56030         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
56031         return tag_ptr(ret_conv, true);
56032 }
56033
56034 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) {
56035         LDKInvoiceRequestFeatures this_arg_conv;
56036         this_arg_conv.inner = untag_ptr(this_arg);
56037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56039         this_arg_conv.is_owned = false;
56040         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56041         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56042         return tag_ptr(ret_conv, true);
56043 }
56044
56045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
56046         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
56047         int64_t ret_ref = 0;
56048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56050         return ret_ref;
56051 }
56052
56053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
56054         LDKBolt12InvoiceFeatures this_arg_conv;
56055         this_arg_conv.inner = untag_ptr(this_arg);
56056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56058         this_arg_conv.is_owned = false;
56059         LDKBolt12InvoiceFeatures other_conv;
56060         other_conv.inner = untag_ptr(other);
56061         other_conv.is_owned = ptr_is_owned(other);
56062         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56063         other_conv.is_owned = false;
56064         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56065         return ret_conv;
56066 }
56067
56068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
56069         LDKBolt12InvoiceFeatures this_arg_conv;
56070         this_arg_conv.inner = untag_ptr(this_arg);
56071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56073         this_arg_conv.is_owned = false;
56074         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
56075         return ret_conv;
56076 }
56077
56078 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) {
56079         LDKBolt12InvoiceFeatures this_arg_conv;
56080         this_arg_conv.inner = untag_ptr(this_arg);
56081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56083         this_arg_conv.is_owned = false;
56084         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56085         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
56086         return tag_ptr(ret_conv, true);
56087 }
56088
56089 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) {
56090         LDKBolt12InvoiceFeatures this_arg_conv;
56091         this_arg_conv.inner = untag_ptr(this_arg);
56092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56094         this_arg_conv.is_owned = false;
56095         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56096         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56097         return tag_ptr(ret_conv, true);
56098 }
56099
56100 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) {
56101         LDKBolt12InvoiceFeatures this_arg_conv;
56102         this_arg_conv.inner = untag_ptr(this_arg);
56103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56105         this_arg_conv.is_owned = false;
56106         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56107         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
56108         return tag_ptr(ret_conv, true);
56109 }
56110
56111 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) {
56112         LDKBolt12InvoiceFeatures this_arg_conv;
56113         this_arg_conv.inner = untag_ptr(this_arg);
56114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56116         this_arg_conv.is_owned = false;
56117         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56118         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56119         return tag_ptr(ret_conv, true);
56120 }
56121
56122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
56123         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
56124         int64_t ret_ref = 0;
56125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56127         return ret_ref;
56128 }
56129
56130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
56131         LDKBlindedHopFeatures this_arg_conv;
56132         this_arg_conv.inner = untag_ptr(this_arg);
56133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56135         this_arg_conv.is_owned = false;
56136         LDKBlindedHopFeatures other_conv;
56137         other_conv.inner = untag_ptr(other);
56138         other_conv.is_owned = ptr_is_owned(other);
56139         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56140         other_conv.is_owned = false;
56141         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56142         return ret_conv;
56143 }
56144
56145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
56146         LDKBlindedHopFeatures this_arg_conv;
56147         this_arg_conv.inner = untag_ptr(this_arg);
56148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56150         this_arg_conv.is_owned = false;
56151         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
56152         return ret_conv;
56153 }
56154
56155 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) {
56156         LDKBlindedHopFeatures this_arg_conv;
56157         this_arg_conv.inner = untag_ptr(this_arg);
56158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56160         this_arg_conv.is_owned = false;
56161         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56162         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
56163         return tag_ptr(ret_conv, true);
56164 }
56165
56166 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) {
56167         LDKBlindedHopFeatures this_arg_conv;
56168         this_arg_conv.inner = untag_ptr(this_arg);
56169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56171         this_arg_conv.is_owned = false;
56172         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56173         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56174         return tag_ptr(ret_conv, true);
56175 }
56176
56177 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) {
56178         LDKBlindedHopFeatures this_arg_conv;
56179         this_arg_conv.inner = untag_ptr(this_arg);
56180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56182         this_arg_conv.is_owned = false;
56183         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56184         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
56185         return tag_ptr(ret_conv, true);
56186 }
56187
56188 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) {
56189         LDKBlindedHopFeatures this_arg_conv;
56190         this_arg_conv.inner = untag_ptr(this_arg);
56191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56193         this_arg_conv.is_owned = false;
56194         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56195         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56196         return tag_ptr(ret_conv, true);
56197 }
56198
56199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
56200         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
56201         int64_t ret_ref = 0;
56202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56204         return ret_ref;
56205 }
56206
56207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
56208         LDKChannelTypeFeatures this_arg_conv;
56209         this_arg_conv.inner = untag_ptr(this_arg);
56210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56212         this_arg_conv.is_owned = false;
56213         LDKChannelTypeFeatures other_conv;
56214         other_conv.inner = untag_ptr(other);
56215         other_conv.is_owned = ptr_is_owned(other);
56216         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56217         other_conv.is_owned = false;
56218         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56219         return ret_conv;
56220 }
56221
56222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
56223         LDKChannelTypeFeatures this_arg_conv;
56224         this_arg_conv.inner = untag_ptr(this_arg);
56225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56227         this_arg_conv.is_owned = false;
56228         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
56229         return ret_conv;
56230 }
56231
56232 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) {
56233         LDKChannelTypeFeatures this_arg_conv;
56234         this_arg_conv.inner = untag_ptr(this_arg);
56235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56237         this_arg_conv.is_owned = false;
56238         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56239         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
56240         return tag_ptr(ret_conv, true);
56241 }
56242
56243 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) {
56244         LDKChannelTypeFeatures this_arg_conv;
56245         this_arg_conv.inner = untag_ptr(this_arg);
56246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56248         this_arg_conv.is_owned = false;
56249         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56250         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56251         return tag_ptr(ret_conv, true);
56252 }
56253
56254 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) {
56255         LDKChannelTypeFeatures this_arg_conv;
56256         this_arg_conv.inner = untag_ptr(this_arg);
56257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56259         this_arg_conv.is_owned = false;
56260         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56261         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
56262         return tag_ptr(ret_conv, true);
56263 }
56264
56265 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) {
56266         LDKChannelTypeFeatures this_arg_conv;
56267         this_arg_conv.inner = untag_ptr(this_arg);
56268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56270         this_arg_conv.is_owned = false;
56271         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56272         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56273         return tag_ptr(ret_conv, true);
56274 }
56275
56276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56277         LDKInitFeatures obj_conv;
56278         obj_conv.inner = untag_ptr(obj);
56279         obj_conv.is_owned = ptr_is_owned(obj);
56280         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56281         obj_conv.is_owned = false;
56282         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
56283         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56284         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56285         CVec_u8Z_free(ret_var);
56286         return ret_arr;
56287 }
56288
56289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56290         LDKu8slice ser_ref;
56291         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56292         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56293         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
56294         *ret_conv = InitFeatures_read(ser_ref);
56295         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56296         return tag_ptr(ret_conv, true);
56297 }
56298
56299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56300         LDKChannelFeatures obj_conv;
56301         obj_conv.inner = untag_ptr(obj);
56302         obj_conv.is_owned = ptr_is_owned(obj);
56303         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56304         obj_conv.is_owned = false;
56305         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
56306         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56307         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56308         CVec_u8Z_free(ret_var);
56309         return ret_arr;
56310 }
56311
56312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56313         LDKu8slice ser_ref;
56314         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56315         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56316         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
56317         *ret_conv = ChannelFeatures_read(ser_ref);
56318         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56319         return tag_ptr(ret_conv, true);
56320 }
56321
56322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56323         LDKNodeFeatures obj_conv;
56324         obj_conv.inner = untag_ptr(obj);
56325         obj_conv.is_owned = ptr_is_owned(obj);
56326         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56327         obj_conv.is_owned = false;
56328         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
56329         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56330         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56331         CVec_u8Z_free(ret_var);
56332         return ret_arr;
56333 }
56334
56335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56336         LDKu8slice ser_ref;
56337         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56338         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56339         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
56340         *ret_conv = NodeFeatures_read(ser_ref);
56341         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56342         return tag_ptr(ret_conv, true);
56343 }
56344
56345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56346         LDKBolt11InvoiceFeatures obj_conv;
56347         obj_conv.inner = untag_ptr(obj);
56348         obj_conv.is_owned = ptr_is_owned(obj);
56349         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56350         obj_conv.is_owned = false;
56351         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
56352         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56353         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56354         CVec_u8Z_free(ret_var);
56355         return ret_arr;
56356 }
56357
56358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56359         LDKu8slice ser_ref;
56360         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56361         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56362         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
56363         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
56364         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56365         return tag_ptr(ret_conv, true);
56366 }
56367
56368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56369         LDKBolt12InvoiceFeatures obj_conv;
56370         obj_conv.inner = untag_ptr(obj);
56371         obj_conv.is_owned = ptr_is_owned(obj);
56372         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56373         obj_conv.is_owned = false;
56374         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
56375         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56376         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56377         CVec_u8Z_free(ret_var);
56378         return ret_arr;
56379 }
56380
56381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56382         LDKu8slice ser_ref;
56383         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56384         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56385         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
56386         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
56387         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56388         return tag_ptr(ret_conv, true);
56389 }
56390
56391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56392         LDKBlindedHopFeatures obj_conv;
56393         obj_conv.inner = untag_ptr(obj);
56394         obj_conv.is_owned = ptr_is_owned(obj);
56395         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56396         obj_conv.is_owned = false;
56397         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
56398         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56399         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56400         CVec_u8Z_free(ret_var);
56401         return ret_arr;
56402 }
56403
56404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56405         LDKu8slice ser_ref;
56406         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56407         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56408         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
56409         *ret_conv = BlindedHopFeatures_read(ser_ref);
56410         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56411         return tag_ptr(ret_conv, true);
56412 }
56413
56414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56415         LDKChannelTypeFeatures obj_conv;
56416         obj_conv.inner = untag_ptr(obj);
56417         obj_conv.is_owned = ptr_is_owned(obj);
56418         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56419         obj_conv.is_owned = false;
56420         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
56421         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56422         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56423         CVec_u8Z_free(ret_var);
56424         return ret_arr;
56425 }
56426
56427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56428         LDKu8slice ser_ref;
56429         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56430         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56431         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
56432         *ret_conv = ChannelTypeFeatures_read(ser_ref);
56433         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56434         return tag_ptr(ret_conv, true);
56435 }
56436
56437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56438         LDKInitFeatures this_arg_conv;
56439         this_arg_conv.inner = untag_ptr(this_arg);
56440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56442         this_arg_conv.is_owned = false;
56443         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
56444 }
56445
56446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56447         LDKInitFeatures this_arg_conv;
56448         this_arg_conv.inner = untag_ptr(this_arg);
56449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56451         this_arg_conv.is_owned = false;
56452         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
56453 }
56454
56455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
56456         LDKInitFeatures this_arg_conv;
56457         this_arg_conv.inner = untag_ptr(this_arg);
56458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56460         this_arg_conv.is_owned = false;
56461         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
56462         return ret_conv;
56463 }
56464
56465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56466         LDKNodeFeatures this_arg_conv;
56467         this_arg_conv.inner = untag_ptr(this_arg);
56468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56470         this_arg_conv.is_owned = false;
56471         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
56472 }
56473
56474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56475         LDKNodeFeatures this_arg_conv;
56476         this_arg_conv.inner = untag_ptr(this_arg);
56477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56479         this_arg_conv.is_owned = false;
56480         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
56481 }
56482
56483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
56484         LDKNodeFeatures this_arg_conv;
56485         this_arg_conv.inner = untag_ptr(this_arg);
56486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56488         this_arg_conv.is_owned = false;
56489         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
56490         return ret_conv;
56491 }
56492
56493 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
56494         LDKInitFeatures this_arg_conv;
56495         this_arg_conv.inner = untag_ptr(this_arg);
56496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56498         this_arg_conv.is_owned = false;
56499         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
56500         return ret_conv;
56501 }
56502
56503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
56504         LDKNodeFeatures this_arg_conv;
56505         this_arg_conv.inner = untag_ptr(this_arg);
56506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56508         this_arg_conv.is_owned = false;
56509         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
56510         return ret_conv;
56511 }
56512
56513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56514         LDKInitFeatures this_arg_conv;
56515         this_arg_conv.inner = untag_ptr(this_arg);
56516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56518         this_arg_conv.is_owned = false;
56519         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
56520 }
56521
56522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56523         LDKInitFeatures this_arg_conv;
56524         this_arg_conv.inner = untag_ptr(this_arg);
56525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56527         this_arg_conv.is_owned = false;
56528         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
56529 }
56530
56531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
56532         LDKInitFeatures this_arg_conv;
56533         this_arg_conv.inner = untag_ptr(this_arg);
56534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56536         this_arg_conv.is_owned = false;
56537         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
56538         return ret_conv;
56539 }
56540
56541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56542         LDKInitFeatures this_arg_conv;
56543         this_arg_conv.inner = untag_ptr(this_arg);
56544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56546         this_arg_conv.is_owned = false;
56547         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56548 }
56549
56550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56551         LDKInitFeatures this_arg_conv;
56552         this_arg_conv.inner = untag_ptr(this_arg);
56553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56555         this_arg_conv.is_owned = false;
56556         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56557 }
56558
56559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
56560         LDKInitFeatures this_arg_conv;
56561         this_arg_conv.inner = untag_ptr(this_arg);
56562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56564         this_arg_conv.is_owned = false;
56565         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56566         return ret_conv;
56567 }
56568
56569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56570         LDKNodeFeatures this_arg_conv;
56571         this_arg_conv.inner = untag_ptr(this_arg);
56572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56574         this_arg_conv.is_owned = false;
56575         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56576 }
56577
56578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56579         LDKNodeFeatures this_arg_conv;
56580         this_arg_conv.inner = untag_ptr(this_arg);
56581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56583         this_arg_conv.is_owned = false;
56584         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56585 }
56586
56587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
56588         LDKNodeFeatures this_arg_conv;
56589         this_arg_conv.inner = untag_ptr(this_arg);
56590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56592         this_arg_conv.is_owned = false;
56593         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56594         return ret_conv;
56595 }
56596
56597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
56598         LDKInitFeatures this_arg_conv;
56599         this_arg_conv.inner = untag_ptr(this_arg);
56600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56602         this_arg_conv.is_owned = false;
56603         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56604         return ret_conv;
56605 }
56606
56607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
56608         LDKNodeFeatures this_arg_conv;
56609         this_arg_conv.inner = untag_ptr(this_arg);
56610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56612         this_arg_conv.is_owned = false;
56613         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56614         return ret_conv;
56615 }
56616
56617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56618         LDKInitFeatures this_arg_conv;
56619         this_arg_conv.inner = untag_ptr(this_arg);
56620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56622         this_arg_conv.is_owned = false;
56623         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
56624 }
56625
56626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56627         LDKInitFeatures this_arg_conv;
56628         this_arg_conv.inner = untag_ptr(this_arg);
56629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56631         this_arg_conv.is_owned = false;
56632         InitFeatures_set_gossip_queries_required(&this_arg_conv);
56633 }
56634
56635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56636         LDKInitFeatures this_arg_conv;
56637         this_arg_conv.inner = untag_ptr(this_arg);
56638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56640         this_arg_conv.is_owned = false;
56641         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
56642         return ret_conv;
56643 }
56644
56645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56646         LDKNodeFeatures this_arg_conv;
56647         this_arg_conv.inner = untag_ptr(this_arg);
56648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56650         this_arg_conv.is_owned = false;
56651         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
56652 }
56653
56654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56655         LDKNodeFeatures this_arg_conv;
56656         this_arg_conv.inner = untag_ptr(this_arg);
56657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56659         this_arg_conv.is_owned = false;
56660         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
56661 }
56662
56663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56664         LDKNodeFeatures this_arg_conv;
56665         this_arg_conv.inner = untag_ptr(this_arg);
56666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56668         this_arg_conv.is_owned = false;
56669         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
56670         return ret_conv;
56671 }
56672
56673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56674         LDKInitFeatures this_arg_conv;
56675         this_arg_conv.inner = untag_ptr(this_arg);
56676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56678         this_arg_conv.is_owned = false;
56679         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
56680         return ret_conv;
56681 }
56682
56683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
56684         LDKNodeFeatures this_arg_conv;
56685         this_arg_conv.inner = untag_ptr(this_arg);
56686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56688         this_arg_conv.is_owned = false;
56689         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
56690         return ret_conv;
56691 }
56692
56693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56694         LDKInitFeatures this_arg_conv;
56695         this_arg_conv.inner = untag_ptr(this_arg);
56696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56698         this_arg_conv.is_owned = false;
56699         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
56700 }
56701
56702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56703         LDKInitFeatures this_arg_conv;
56704         this_arg_conv.inner = untag_ptr(this_arg);
56705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56707         this_arg_conv.is_owned = false;
56708         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
56709 }
56710
56711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56712         LDKInitFeatures this_arg_conv;
56713         this_arg_conv.inner = untag_ptr(this_arg);
56714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56716         this_arg_conv.is_owned = false;
56717         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
56718         return ret_conv;
56719 }
56720
56721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56722         LDKNodeFeatures this_arg_conv;
56723         this_arg_conv.inner = untag_ptr(this_arg);
56724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56726         this_arg_conv.is_owned = false;
56727         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
56728 }
56729
56730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56731         LDKNodeFeatures this_arg_conv;
56732         this_arg_conv.inner = untag_ptr(this_arg);
56733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56735         this_arg_conv.is_owned = false;
56736         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
56737 }
56738
56739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56740         LDKNodeFeatures this_arg_conv;
56741         this_arg_conv.inner = untag_ptr(this_arg);
56742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56744         this_arg_conv.is_owned = false;
56745         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
56746         return ret_conv;
56747 }
56748
56749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56750         LDKBolt11InvoiceFeatures this_arg_conv;
56751         this_arg_conv.inner = untag_ptr(this_arg);
56752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56754         this_arg_conv.is_owned = false;
56755         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
56756 }
56757
56758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56759         LDKBolt11InvoiceFeatures this_arg_conv;
56760         this_arg_conv.inner = untag_ptr(this_arg);
56761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56763         this_arg_conv.is_owned = false;
56764         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
56765 }
56766
56767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56768         LDKBolt11InvoiceFeatures this_arg_conv;
56769         this_arg_conv.inner = untag_ptr(this_arg);
56770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56772         this_arg_conv.is_owned = false;
56773         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
56774         return ret_conv;
56775 }
56776
56777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56778         LDKInitFeatures this_arg_conv;
56779         this_arg_conv.inner = untag_ptr(this_arg);
56780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56782         this_arg_conv.is_owned = false;
56783         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
56784         return ret_conv;
56785 }
56786
56787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56788         LDKNodeFeatures this_arg_conv;
56789         this_arg_conv.inner = untag_ptr(this_arg);
56790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56792         this_arg_conv.is_owned = false;
56793         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
56794         return ret_conv;
56795 }
56796
56797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
56798         LDKBolt11InvoiceFeatures this_arg_conv;
56799         this_arg_conv.inner = untag_ptr(this_arg);
56800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56802         this_arg_conv.is_owned = false;
56803         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
56804         return ret_conv;
56805 }
56806
56807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56808         LDKInitFeatures this_arg_conv;
56809         this_arg_conv.inner = untag_ptr(this_arg);
56810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56812         this_arg_conv.is_owned = false;
56813         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
56814 }
56815
56816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56817         LDKInitFeatures this_arg_conv;
56818         this_arg_conv.inner = untag_ptr(this_arg);
56819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56821         this_arg_conv.is_owned = false;
56822         InitFeatures_set_static_remote_key_required(&this_arg_conv);
56823 }
56824
56825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56826         LDKInitFeatures this_arg_conv;
56827         this_arg_conv.inner = untag_ptr(this_arg);
56828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56830         this_arg_conv.is_owned = false;
56831         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
56832         return ret_conv;
56833 }
56834
56835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56836         LDKNodeFeatures this_arg_conv;
56837         this_arg_conv.inner = untag_ptr(this_arg);
56838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56840         this_arg_conv.is_owned = false;
56841         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
56842 }
56843
56844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56845         LDKNodeFeatures this_arg_conv;
56846         this_arg_conv.inner = untag_ptr(this_arg);
56847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56849         this_arg_conv.is_owned = false;
56850         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
56851 }
56852
56853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56854         LDKNodeFeatures this_arg_conv;
56855         this_arg_conv.inner = untag_ptr(this_arg);
56856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56858         this_arg_conv.is_owned = false;
56859         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
56860         return ret_conv;
56861 }
56862
56863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56864         LDKChannelTypeFeatures this_arg_conv;
56865         this_arg_conv.inner = untag_ptr(this_arg);
56866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56868         this_arg_conv.is_owned = false;
56869         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
56870 }
56871
56872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56873         LDKChannelTypeFeatures this_arg_conv;
56874         this_arg_conv.inner = untag_ptr(this_arg);
56875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56877         this_arg_conv.is_owned = false;
56878         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
56879 }
56880
56881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56882         LDKChannelTypeFeatures this_arg_conv;
56883         this_arg_conv.inner = untag_ptr(this_arg);
56884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56886         this_arg_conv.is_owned = false;
56887         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
56888         return ret_conv;
56889 }
56890
56891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56892         LDKInitFeatures this_arg_conv;
56893         this_arg_conv.inner = untag_ptr(this_arg);
56894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56896         this_arg_conv.is_owned = false;
56897         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
56898         return ret_conv;
56899 }
56900
56901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56902         LDKNodeFeatures this_arg_conv;
56903         this_arg_conv.inner = untag_ptr(this_arg);
56904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56906         this_arg_conv.is_owned = false;
56907         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
56908         return ret_conv;
56909 }
56910
56911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
56912         LDKChannelTypeFeatures this_arg_conv;
56913         this_arg_conv.inner = untag_ptr(this_arg);
56914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56916         this_arg_conv.is_owned = false;
56917         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
56918         return ret_conv;
56919 }
56920
56921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56922         LDKInitFeatures this_arg_conv;
56923         this_arg_conv.inner = untag_ptr(this_arg);
56924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56926         this_arg_conv.is_owned = false;
56927         InitFeatures_set_payment_secret_optional(&this_arg_conv);
56928 }
56929
56930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56931         LDKInitFeatures this_arg_conv;
56932         this_arg_conv.inner = untag_ptr(this_arg);
56933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56935         this_arg_conv.is_owned = false;
56936         InitFeatures_set_payment_secret_required(&this_arg_conv);
56937 }
56938
56939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56940         LDKInitFeatures this_arg_conv;
56941         this_arg_conv.inner = untag_ptr(this_arg);
56942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56944         this_arg_conv.is_owned = false;
56945         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
56946         return ret_conv;
56947 }
56948
56949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56950         LDKNodeFeatures this_arg_conv;
56951         this_arg_conv.inner = untag_ptr(this_arg);
56952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56954         this_arg_conv.is_owned = false;
56955         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
56956 }
56957
56958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56959         LDKNodeFeatures this_arg_conv;
56960         this_arg_conv.inner = untag_ptr(this_arg);
56961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56963         this_arg_conv.is_owned = false;
56964         NodeFeatures_set_payment_secret_required(&this_arg_conv);
56965 }
56966
56967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56968         LDKNodeFeatures this_arg_conv;
56969         this_arg_conv.inner = untag_ptr(this_arg);
56970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56972         this_arg_conv.is_owned = false;
56973         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
56974         return ret_conv;
56975 }
56976
56977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
56978         LDKBolt11InvoiceFeatures this_arg_conv;
56979         this_arg_conv.inner = untag_ptr(this_arg);
56980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56982         this_arg_conv.is_owned = false;
56983         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
56984 }
56985
56986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
56987         LDKBolt11InvoiceFeatures this_arg_conv;
56988         this_arg_conv.inner = untag_ptr(this_arg);
56989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56991         this_arg_conv.is_owned = false;
56992         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
56993 }
56994
56995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
56996         LDKBolt11InvoiceFeatures this_arg_conv;
56997         this_arg_conv.inner = untag_ptr(this_arg);
56998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57000         this_arg_conv.is_owned = false;
57001         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
57002         return ret_conv;
57003 }
57004
57005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
57006         LDKInitFeatures this_arg_conv;
57007         this_arg_conv.inner = untag_ptr(this_arg);
57008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57010         this_arg_conv.is_owned = false;
57011         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
57012         return ret_conv;
57013 }
57014
57015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
57016         LDKNodeFeatures this_arg_conv;
57017         this_arg_conv.inner = untag_ptr(this_arg);
57018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57020         this_arg_conv.is_owned = false;
57021         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
57022         return ret_conv;
57023 }
57024
57025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
57026         LDKBolt11InvoiceFeatures this_arg_conv;
57027         this_arg_conv.inner = untag_ptr(this_arg);
57028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57030         this_arg_conv.is_owned = false;
57031         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
57032         return ret_conv;
57033 }
57034
57035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57036         LDKInitFeatures this_arg_conv;
57037         this_arg_conv.inner = untag_ptr(this_arg);
57038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57040         this_arg_conv.is_owned = false;
57041         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
57042 }
57043
57044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57045         LDKInitFeatures this_arg_conv;
57046         this_arg_conv.inner = untag_ptr(this_arg);
57047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57049         this_arg_conv.is_owned = false;
57050         InitFeatures_set_basic_mpp_required(&this_arg_conv);
57051 }
57052
57053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57054         LDKInitFeatures this_arg_conv;
57055         this_arg_conv.inner = untag_ptr(this_arg);
57056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57058         this_arg_conv.is_owned = false;
57059         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
57060         return ret_conv;
57061 }
57062
57063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57064         LDKNodeFeatures this_arg_conv;
57065         this_arg_conv.inner = untag_ptr(this_arg);
57066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57068         this_arg_conv.is_owned = false;
57069         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
57070 }
57071
57072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57073         LDKNodeFeatures this_arg_conv;
57074         this_arg_conv.inner = untag_ptr(this_arg);
57075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57077         this_arg_conv.is_owned = false;
57078         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
57079 }
57080
57081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57082         LDKNodeFeatures this_arg_conv;
57083         this_arg_conv.inner = untag_ptr(this_arg);
57084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57086         this_arg_conv.is_owned = false;
57087         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
57088         return ret_conv;
57089 }
57090
57091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57092         LDKBolt11InvoiceFeatures this_arg_conv;
57093         this_arg_conv.inner = untag_ptr(this_arg);
57094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57096         this_arg_conv.is_owned = false;
57097         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57098 }
57099
57100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57101         LDKBolt11InvoiceFeatures this_arg_conv;
57102         this_arg_conv.inner = untag_ptr(this_arg);
57103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57105         this_arg_conv.is_owned = false;
57106         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57107 }
57108
57109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57110         LDKBolt11InvoiceFeatures this_arg_conv;
57111         this_arg_conv.inner = untag_ptr(this_arg);
57112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57114         this_arg_conv.is_owned = false;
57115         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57116         return ret_conv;
57117 }
57118
57119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57120         LDKBolt12InvoiceFeatures this_arg_conv;
57121         this_arg_conv.inner = untag_ptr(this_arg);
57122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57124         this_arg_conv.is_owned = false;
57125         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57126 }
57127
57128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57129         LDKBolt12InvoiceFeatures this_arg_conv;
57130         this_arg_conv.inner = untag_ptr(this_arg);
57131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57133         this_arg_conv.is_owned = false;
57134         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57135 }
57136
57137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57138         LDKBolt12InvoiceFeatures this_arg_conv;
57139         this_arg_conv.inner = untag_ptr(this_arg);
57140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57142         this_arg_conv.is_owned = false;
57143         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57144         return ret_conv;
57145 }
57146
57147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57148         LDKInitFeatures this_arg_conv;
57149         this_arg_conv.inner = untag_ptr(this_arg);
57150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57152         this_arg_conv.is_owned = false;
57153         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
57154         return ret_conv;
57155 }
57156
57157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57158         LDKNodeFeatures this_arg_conv;
57159         this_arg_conv.inner = untag_ptr(this_arg);
57160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57162         this_arg_conv.is_owned = false;
57163         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
57164         return ret_conv;
57165 }
57166
57167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57168         LDKBolt11InvoiceFeatures this_arg_conv;
57169         this_arg_conv.inner = untag_ptr(this_arg);
57170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57172         this_arg_conv.is_owned = false;
57173         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57174         return ret_conv;
57175 }
57176
57177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
57178         LDKBolt12InvoiceFeatures this_arg_conv;
57179         this_arg_conv.inner = untag_ptr(this_arg);
57180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57182         this_arg_conv.is_owned = false;
57183         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57184         return ret_conv;
57185 }
57186
57187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57188         LDKInitFeatures this_arg_conv;
57189         this_arg_conv.inner = untag_ptr(this_arg);
57190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57192         this_arg_conv.is_owned = false;
57193         InitFeatures_set_wumbo_optional(&this_arg_conv);
57194 }
57195
57196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57197         LDKInitFeatures this_arg_conv;
57198         this_arg_conv.inner = untag_ptr(this_arg);
57199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57201         this_arg_conv.is_owned = false;
57202         InitFeatures_set_wumbo_required(&this_arg_conv);
57203 }
57204
57205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
57206         LDKInitFeatures this_arg_conv;
57207         this_arg_conv.inner = untag_ptr(this_arg);
57208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57210         this_arg_conv.is_owned = false;
57211         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
57212         return ret_conv;
57213 }
57214
57215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57216         LDKNodeFeatures this_arg_conv;
57217         this_arg_conv.inner = untag_ptr(this_arg);
57218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57220         this_arg_conv.is_owned = false;
57221         NodeFeatures_set_wumbo_optional(&this_arg_conv);
57222 }
57223
57224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57225         LDKNodeFeatures this_arg_conv;
57226         this_arg_conv.inner = untag_ptr(this_arg);
57227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57229         this_arg_conv.is_owned = false;
57230         NodeFeatures_set_wumbo_required(&this_arg_conv);
57231 }
57232
57233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
57234         LDKNodeFeatures this_arg_conv;
57235         this_arg_conv.inner = untag_ptr(this_arg);
57236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57238         this_arg_conv.is_owned = false;
57239         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
57240         return ret_conv;
57241 }
57242
57243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
57244         LDKInitFeatures this_arg_conv;
57245         this_arg_conv.inner = untag_ptr(this_arg);
57246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57248         this_arg_conv.is_owned = false;
57249         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
57250         return ret_conv;
57251 }
57252
57253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
57254         LDKNodeFeatures this_arg_conv;
57255         this_arg_conv.inner = untag_ptr(this_arg);
57256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57258         this_arg_conv.is_owned = false;
57259         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
57260         return ret_conv;
57261 }
57262
57263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57264         LDKInitFeatures this_arg_conv;
57265         this_arg_conv.inner = untag_ptr(this_arg);
57266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57268         this_arg_conv.is_owned = false;
57269         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57270 }
57271
57272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57273         LDKInitFeatures this_arg_conv;
57274         this_arg_conv.inner = untag_ptr(this_arg);
57275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57277         this_arg_conv.is_owned = false;
57278         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57279 }
57280
57281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57282         LDKInitFeatures this_arg_conv;
57283         this_arg_conv.inner = untag_ptr(this_arg);
57284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57286         this_arg_conv.is_owned = false;
57287         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57288         return ret_conv;
57289 }
57290
57291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57292         LDKNodeFeatures this_arg_conv;
57293         this_arg_conv.inner = untag_ptr(this_arg);
57294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57296         this_arg_conv.is_owned = false;
57297         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57298 }
57299
57300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57301         LDKNodeFeatures this_arg_conv;
57302         this_arg_conv.inner = untag_ptr(this_arg);
57303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57305         this_arg_conv.is_owned = false;
57306         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57307 }
57308
57309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57310         LDKNodeFeatures this_arg_conv;
57311         this_arg_conv.inner = untag_ptr(this_arg);
57312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57314         this_arg_conv.is_owned = false;
57315         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57316         return ret_conv;
57317 }
57318
57319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57320         LDKChannelTypeFeatures this_arg_conv;
57321         this_arg_conv.inner = untag_ptr(this_arg);
57322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57324         this_arg_conv.is_owned = false;
57325         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57326 }
57327
57328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57329         LDKChannelTypeFeatures this_arg_conv;
57330         this_arg_conv.inner = untag_ptr(this_arg);
57331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57333         this_arg_conv.is_owned = false;
57334         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57335 }
57336
57337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57338         LDKChannelTypeFeatures this_arg_conv;
57339         this_arg_conv.inner = untag_ptr(this_arg);
57340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57342         this_arg_conv.is_owned = false;
57343         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57344         return ret_conv;
57345 }
57346
57347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57348         LDKInitFeatures this_arg_conv;
57349         this_arg_conv.inner = untag_ptr(this_arg);
57350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57352         this_arg_conv.is_owned = false;
57353         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57354         return ret_conv;
57355 }
57356
57357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57358         LDKNodeFeatures this_arg_conv;
57359         this_arg_conv.inner = untag_ptr(this_arg);
57360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57362         this_arg_conv.is_owned = false;
57363         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57364         return ret_conv;
57365 }
57366
57367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57368         LDKChannelTypeFeatures this_arg_conv;
57369         this_arg_conv.inner = untag_ptr(this_arg);
57370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57372         this_arg_conv.is_owned = false;
57373         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57374         return ret_conv;
57375 }
57376
57377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57378         LDKInitFeatures this_arg_conv;
57379         this_arg_conv.inner = untag_ptr(this_arg);
57380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57382         this_arg_conv.is_owned = false;
57383         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57384 }
57385
57386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57387         LDKInitFeatures this_arg_conv;
57388         this_arg_conv.inner = untag_ptr(this_arg);
57389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57391         this_arg_conv.is_owned = false;
57392         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57393 }
57394
57395 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57396         LDKInitFeatures this_arg_conv;
57397         this_arg_conv.inner = untag_ptr(this_arg);
57398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57400         this_arg_conv.is_owned = false;
57401         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57402         return ret_conv;
57403 }
57404
57405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57406         LDKNodeFeatures this_arg_conv;
57407         this_arg_conv.inner = untag_ptr(this_arg);
57408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57410         this_arg_conv.is_owned = false;
57411         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57412 }
57413
57414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57415         LDKNodeFeatures this_arg_conv;
57416         this_arg_conv.inner = untag_ptr(this_arg);
57417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57419         this_arg_conv.is_owned = false;
57420         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57421 }
57422
57423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57424         LDKNodeFeatures this_arg_conv;
57425         this_arg_conv.inner = untag_ptr(this_arg);
57426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57428         this_arg_conv.is_owned = false;
57429         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57430         return ret_conv;
57431 }
57432
57433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57434         LDKChannelTypeFeatures this_arg_conv;
57435         this_arg_conv.inner = untag_ptr(this_arg);
57436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57438         this_arg_conv.is_owned = false;
57439         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57440 }
57441
57442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57443         LDKChannelTypeFeatures this_arg_conv;
57444         this_arg_conv.inner = untag_ptr(this_arg);
57445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57447         this_arg_conv.is_owned = false;
57448         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57449 }
57450
57451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57452         LDKChannelTypeFeatures this_arg_conv;
57453         this_arg_conv.inner = untag_ptr(this_arg);
57454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57456         this_arg_conv.is_owned = false;
57457         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57458         return ret_conv;
57459 }
57460
57461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57462         LDKInitFeatures this_arg_conv;
57463         this_arg_conv.inner = untag_ptr(this_arg);
57464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57466         this_arg_conv.is_owned = false;
57467         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57468         return ret_conv;
57469 }
57470
57471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57472         LDKNodeFeatures this_arg_conv;
57473         this_arg_conv.inner = untag_ptr(this_arg);
57474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57476         this_arg_conv.is_owned = false;
57477         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57478         return ret_conv;
57479 }
57480
57481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
57482         LDKChannelTypeFeatures this_arg_conv;
57483         this_arg_conv.inner = untag_ptr(this_arg);
57484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57486         this_arg_conv.is_owned = false;
57487         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57488         return ret_conv;
57489 }
57490
57491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57492         LDKInitFeatures this_arg_conv;
57493         this_arg_conv.inner = untag_ptr(this_arg);
57494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57496         this_arg_conv.is_owned = false;
57497         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57498 }
57499
57500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57501         LDKInitFeatures this_arg_conv;
57502         this_arg_conv.inner = untag_ptr(this_arg);
57503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57505         this_arg_conv.is_owned = false;
57506         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57507 }
57508
57509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
57510         LDKInitFeatures this_arg_conv;
57511         this_arg_conv.inner = untag_ptr(this_arg);
57512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57514         this_arg_conv.is_owned = false;
57515         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57516         return ret_conv;
57517 }
57518
57519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57520         LDKNodeFeatures this_arg_conv;
57521         this_arg_conv.inner = untag_ptr(this_arg);
57522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57524         this_arg_conv.is_owned = false;
57525         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57526 }
57527
57528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57529         LDKNodeFeatures this_arg_conv;
57530         this_arg_conv.inner = untag_ptr(this_arg);
57531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57533         this_arg_conv.is_owned = false;
57534         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57535 }
57536
57537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
57538         LDKNodeFeatures this_arg_conv;
57539         this_arg_conv.inner = untag_ptr(this_arg);
57540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57542         this_arg_conv.is_owned = false;
57543         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57544         return ret_conv;
57545 }
57546
57547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
57548         LDKInitFeatures this_arg_conv;
57549         this_arg_conv.inner = untag_ptr(this_arg);
57550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57552         this_arg_conv.is_owned = false;
57553         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57554         return ret_conv;
57555 }
57556
57557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
57558         LDKNodeFeatures this_arg_conv;
57559         this_arg_conv.inner = untag_ptr(this_arg);
57560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57562         this_arg_conv.is_owned = false;
57563         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57564         return ret_conv;
57565 }
57566
57567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57568         LDKInitFeatures this_arg_conv;
57569         this_arg_conv.inner = untag_ptr(this_arg);
57570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57572         this_arg_conv.is_owned = false;
57573         InitFeatures_set_taproot_optional(&this_arg_conv);
57574 }
57575
57576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57577         LDKInitFeatures this_arg_conv;
57578         this_arg_conv.inner = untag_ptr(this_arg);
57579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57581         this_arg_conv.is_owned = false;
57582         InitFeatures_set_taproot_required(&this_arg_conv);
57583 }
57584
57585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57586         LDKInitFeatures this_arg_conv;
57587         this_arg_conv.inner = untag_ptr(this_arg);
57588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57590         this_arg_conv.is_owned = false;
57591         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
57592         return ret_conv;
57593 }
57594
57595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57596         LDKNodeFeatures this_arg_conv;
57597         this_arg_conv.inner = untag_ptr(this_arg);
57598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57600         this_arg_conv.is_owned = false;
57601         NodeFeatures_set_taproot_optional(&this_arg_conv);
57602 }
57603
57604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57605         LDKNodeFeatures this_arg_conv;
57606         this_arg_conv.inner = untag_ptr(this_arg);
57607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57609         this_arg_conv.is_owned = false;
57610         NodeFeatures_set_taproot_required(&this_arg_conv);
57611 }
57612
57613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57614         LDKNodeFeatures this_arg_conv;
57615         this_arg_conv.inner = untag_ptr(this_arg);
57616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57618         this_arg_conv.is_owned = false;
57619         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
57620         return ret_conv;
57621 }
57622
57623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57624         LDKChannelTypeFeatures this_arg_conv;
57625         this_arg_conv.inner = untag_ptr(this_arg);
57626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57628         this_arg_conv.is_owned = false;
57629         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
57630 }
57631
57632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57633         LDKChannelTypeFeatures this_arg_conv;
57634         this_arg_conv.inner = untag_ptr(this_arg);
57635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57637         this_arg_conv.is_owned = false;
57638         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
57639 }
57640
57641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57642         LDKChannelTypeFeatures this_arg_conv;
57643         this_arg_conv.inner = untag_ptr(this_arg);
57644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57646         this_arg_conv.is_owned = false;
57647         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
57648         return ret_conv;
57649 }
57650
57651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57652         LDKInitFeatures this_arg_conv;
57653         this_arg_conv.inner = untag_ptr(this_arg);
57654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57656         this_arg_conv.is_owned = false;
57657         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
57658         return ret_conv;
57659 }
57660
57661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57662         LDKNodeFeatures this_arg_conv;
57663         this_arg_conv.inner = untag_ptr(this_arg);
57664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57666         this_arg_conv.is_owned = false;
57667         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
57668         return ret_conv;
57669 }
57670
57671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
57672         LDKChannelTypeFeatures this_arg_conv;
57673         this_arg_conv.inner = untag_ptr(this_arg);
57674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57676         this_arg_conv.is_owned = false;
57677         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
57678         return ret_conv;
57679 }
57680
57681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57682         LDKInitFeatures this_arg_conv;
57683         this_arg_conv.inner = untag_ptr(this_arg);
57684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57686         this_arg_conv.is_owned = false;
57687         InitFeatures_set_onion_messages_optional(&this_arg_conv);
57688 }
57689
57690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57691         LDKInitFeatures this_arg_conv;
57692         this_arg_conv.inner = untag_ptr(this_arg);
57693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57695         this_arg_conv.is_owned = false;
57696         InitFeatures_set_onion_messages_required(&this_arg_conv);
57697 }
57698
57699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57700         LDKInitFeatures this_arg_conv;
57701         this_arg_conv.inner = untag_ptr(this_arg);
57702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57704         this_arg_conv.is_owned = false;
57705         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
57706         return ret_conv;
57707 }
57708
57709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57710         LDKNodeFeatures this_arg_conv;
57711         this_arg_conv.inner = untag_ptr(this_arg);
57712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57714         this_arg_conv.is_owned = false;
57715         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
57716 }
57717
57718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57719         LDKNodeFeatures this_arg_conv;
57720         this_arg_conv.inner = untag_ptr(this_arg);
57721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57723         this_arg_conv.is_owned = false;
57724         NodeFeatures_set_onion_messages_required(&this_arg_conv);
57725 }
57726
57727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57728         LDKNodeFeatures this_arg_conv;
57729         this_arg_conv.inner = untag_ptr(this_arg);
57730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57732         this_arg_conv.is_owned = false;
57733         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
57734         return ret_conv;
57735 }
57736
57737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57738         LDKInitFeatures this_arg_conv;
57739         this_arg_conv.inner = untag_ptr(this_arg);
57740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57742         this_arg_conv.is_owned = false;
57743         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
57744         return ret_conv;
57745 }
57746
57747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
57748         LDKNodeFeatures this_arg_conv;
57749         this_arg_conv.inner = untag_ptr(this_arg);
57750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57752         this_arg_conv.is_owned = false;
57753         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
57754         return ret_conv;
57755 }
57756
57757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57758         LDKInitFeatures this_arg_conv;
57759         this_arg_conv.inner = untag_ptr(this_arg);
57760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57762         this_arg_conv.is_owned = false;
57763         InitFeatures_set_channel_type_optional(&this_arg_conv);
57764 }
57765
57766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57767         LDKInitFeatures this_arg_conv;
57768         this_arg_conv.inner = untag_ptr(this_arg);
57769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57771         this_arg_conv.is_owned = false;
57772         InitFeatures_set_channel_type_required(&this_arg_conv);
57773 }
57774
57775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57776         LDKInitFeatures this_arg_conv;
57777         this_arg_conv.inner = untag_ptr(this_arg);
57778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57780         this_arg_conv.is_owned = false;
57781         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
57782         return ret_conv;
57783 }
57784
57785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57786         LDKNodeFeatures this_arg_conv;
57787         this_arg_conv.inner = untag_ptr(this_arg);
57788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57790         this_arg_conv.is_owned = false;
57791         NodeFeatures_set_channel_type_optional(&this_arg_conv);
57792 }
57793
57794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57795         LDKNodeFeatures this_arg_conv;
57796         this_arg_conv.inner = untag_ptr(this_arg);
57797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57799         this_arg_conv.is_owned = false;
57800         NodeFeatures_set_channel_type_required(&this_arg_conv);
57801 }
57802
57803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57804         LDKNodeFeatures this_arg_conv;
57805         this_arg_conv.inner = untag_ptr(this_arg);
57806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57808         this_arg_conv.is_owned = false;
57809         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
57810         return ret_conv;
57811 }
57812
57813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57814         LDKInitFeatures this_arg_conv;
57815         this_arg_conv.inner = untag_ptr(this_arg);
57816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57818         this_arg_conv.is_owned = false;
57819         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
57820         return ret_conv;
57821 }
57822
57823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
57824         LDKNodeFeatures this_arg_conv;
57825         this_arg_conv.inner = untag_ptr(this_arg);
57826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57828         this_arg_conv.is_owned = false;
57829         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
57830         return ret_conv;
57831 }
57832
57833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57834         LDKInitFeatures this_arg_conv;
57835         this_arg_conv.inner = untag_ptr(this_arg);
57836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57838         this_arg_conv.is_owned = false;
57839         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
57840 }
57841
57842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57843         LDKInitFeatures this_arg_conv;
57844         this_arg_conv.inner = untag_ptr(this_arg);
57845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57847         this_arg_conv.is_owned = false;
57848         InitFeatures_set_scid_privacy_required(&this_arg_conv);
57849 }
57850
57851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57852         LDKInitFeatures this_arg_conv;
57853         this_arg_conv.inner = untag_ptr(this_arg);
57854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57856         this_arg_conv.is_owned = false;
57857         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
57858         return ret_conv;
57859 }
57860
57861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57862         LDKNodeFeatures this_arg_conv;
57863         this_arg_conv.inner = untag_ptr(this_arg);
57864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57866         this_arg_conv.is_owned = false;
57867         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
57868 }
57869
57870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57871         LDKNodeFeatures this_arg_conv;
57872         this_arg_conv.inner = untag_ptr(this_arg);
57873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57875         this_arg_conv.is_owned = false;
57876         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
57877 }
57878
57879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57880         LDKNodeFeatures this_arg_conv;
57881         this_arg_conv.inner = untag_ptr(this_arg);
57882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57884         this_arg_conv.is_owned = false;
57885         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
57886         return ret_conv;
57887 }
57888
57889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57890         LDKChannelTypeFeatures this_arg_conv;
57891         this_arg_conv.inner = untag_ptr(this_arg);
57892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57894         this_arg_conv.is_owned = false;
57895         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
57896 }
57897
57898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57899         LDKChannelTypeFeatures this_arg_conv;
57900         this_arg_conv.inner = untag_ptr(this_arg);
57901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57903         this_arg_conv.is_owned = false;
57904         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
57905 }
57906
57907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57908         LDKChannelTypeFeatures this_arg_conv;
57909         this_arg_conv.inner = untag_ptr(this_arg);
57910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57912         this_arg_conv.is_owned = false;
57913         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
57914         return ret_conv;
57915 }
57916
57917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57918         LDKInitFeatures this_arg_conv;
57919         this_arg_conv.inner = untag_ptr(this_arg);
57920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57922         this_arg_conv.is_owned = false;
57923         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
57924         return ret_conv;
57925 }
57926
57927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57928         LDKNodeFeatures this_arg_conv;
57929         this_arg_conv.inner = untag_ptr(this_arg);
57930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57932         this_arg_conv.is_owned = false;
57933         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
57934         return ret_conv;
57935 }
57936
57937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
57938         LDKChannelTypeFeatures this_arg_conv;
57939         this_arg_conv.inner = untag_ptr(this_arg);
57940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57942         this_arg_conv.is_owned = false;
57943         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
57944         return ret_conv;
57945 }
57946
57947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57948         LDKBolt11InvoiceFeatures this_arg_conv;
57949         this_arg_conv.inner = untag_ptr(this_arg);
57950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57952         this_arg_conv.is_owned = false;
57953         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
57954 }
57955
57956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57957         LDKBolt11InvoiceFeatures this_arg_conv;
57958         this_arg_conv.inner = untag_ptr(this_arg);
57959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57961         this_arg_conv.is_owned = false;
57962         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
57963 }
57964
57965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
57966         LDKBolt11InvoiceFeatures this_arg_conv;
57967         this_arg_conv.inner = untag_ptr(this_arg);
57968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57970         this_arg_conv.is_owned = false;
57971         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
57972         return ret_conv;
57973 }
57974
57975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
57976         LDKBolt11InvoiceFeatures this_arg_conv;
57977         this_arg_conv.inner = untag_ptr(this_arg);
57978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57980         this_arg_conv.is_owned = false;
57981         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
57982         return ret_conv;
57983 }
57984
57985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
57986         LDKInitFeatures this_arg_conv;
57987         this_arg_conv.inner = untag_ptr(this_arg);
57988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57990         this_arg_conv.is_owned = false;
57991         InitFeatures_set_zero_conf_optional(&this_arg_conv);
57992 }
57993
57994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
57995         LDKInitFeatures this_arg_conv;
57996         this_arg_conv.inner = untag_ptr(this_arg);
57997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57999         this_arg_conv.is_owned = false;
58000         InitFeatures_set_zero_conf_required(&this_arg_conv);
58001 }
58002
58003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58004         LDKInitFeatures this_arg_conv;
58005         this_arg_conv.inner = untag_ptr(this_arg);
58006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58008         this_arg_conv.is_owned = false;
58009         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
58010         return ret_conv;
58011 }
58012
58013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
58014         LDKNodeFeatures this_arg_conv;
58015         this_arg_conv.inner = untag_ptr(this_arg);
58016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58018         this_arg_conv.is_owned = false;
58019         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
58020 }
58021
58022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
58023         LDKNodeFeatures this_arg_conv;
58024         this_arg_conv.inner = untag_ptr(this_arg);
58025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58027         this_arg_conv.is_owned = false;
58028         NodeFeatures_set_zero_conf_required(&this_arg_conv);
58029 }
58030
58031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58032         LDKNodeFeatures this_arg_conv;
58033         this_arg_conv.inner = untag_ptr(this_arg);
58034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58036         this_arg_conv.is_owned = false;
58037         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
58038         return ret_conv;
58039 }
58040
58041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
58042         LDKChannelTypeFeatures this_arg_conv;
58043         this_arg_conv.inner = untag_ptr(this_arg);
58044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58046         this_arg_conv.is_owned = false;
58047         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
58048 }
58049
58050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
58051         LDKChannelTypeFeatures this_arg_conv;
58052         this_arg_conv.inner = untag_ptr(this_arg);
58053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58055         this_arg_conv.is_owned = false;
58056         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
58057 }
58058
58059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58060         LDKChannelTypeFeatures this_arg_conv;
58061         this_arg_conv.inner = untag_ptr(this_arg);
58062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58064         this_arg_conv.is_owned = false;
58065         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
58066         return ret_conv;
58067 }
58068
58069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58070         LDKInitFeatures this_arg_conv;
58071         this_arg_conv.inner = untag_ptr(this_arg);
58072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58074         this_arg_conv.is_owned = false;
58075         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
58076         return ret_conv;
58077 }
58078
58079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58080         LDKNodeFeatures this_arg_conv;
58081         this_arg_conv.inner = untag_ptr(this_arg);
58082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58084         this_arg_conv.is_owned = false;
58085         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
58086         return ret_conv;
58087 }
58088
58089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
58090         LDKChannelTypeFeatures this_arg_conv;
58091         this_arg_conv.inner = untag_ptr(this_arg);
58092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58094         this_arg_conv.is_owned = false;
58095         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
58096         return ret_conv;
58097 }
58098
58099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
58100         LDKNodeFeatures this_arg_conv;
58101         this_arg_conv.inner = untag_ptr(this_arg);
58102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58104         this_arg_conv.is_owned = false;
58105         NodeFeatures_set_keysend_optional(&this_arg_conv);
58106 }
58107
58108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
58109         LDKNodeFeatures this_arg_conv;
58110         this_arg_conv.inner = untag_ptr(this_arg);
58111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58113         this_arg_conv.is_owned = false;
58114         NodeFeatures_set_keysend_required(&this_arg_conv);
58115 }
58116
58117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
58118         LDKNodeFeatures this_arg_conv;
58119         this_arg_conv.inner = untag_ptr(this_arg);
58120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58122         this_arg_conv.is_owned = false;
58123         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
58124         return ret_conv;
58125 }
58126
58127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
58128         LDKNodeFeatures this_arg_conv;
58129         this_arg_conv.inner = untag_ptr(this_arg);
58130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58132         this_arg_conv.is_owned = false;
58133         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
58134         return ret_conv;
58135 }
58136
58137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58138         LDKShutdownScript this_obj_conv;
58139         this_obj_conv.inner = untag_ptr(this_obj);
58140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58142         ShutdownScript_free(this_obj_conv);
58143 }
58144
58145 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
58146         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
58147         int64_t ret_ref = 0;
58148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58150         return ret_ref;
58151 }
58152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58153         LDKShutdownScript arg_conv;
58154         arg_conv.inner = untag_ptr(arg);
58155         arg_conv.is_owned = ptr_is_owned(arg);
58156         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58157         arg_conv.is_owned = false;
58158         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
58159         return ret_conv;
58160 }
58161
58162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58163         LDKShutdownScript orig_conv;
58164         orig_conv.inner = untag_ptr(orig);
58165         orig_conv.is_owned = ptr_is_owned(orig);
58166         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58167         orig_conv.is_owned = false;
58168         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
58169         int64_t ret_ref = 0;
58170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58172         return ret_ref;
58173 }
58174
58175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58176         LDKShutdownScript a_conv;
58177         a_conv.inner = untag_ptr(a);
58178         a_conv.is_owned = ptr_is_owned(a);
58179         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58180         a_conv.is_owned = false;
58181         LDKShutdownScript b_conv;
58182         b_conv.inner = untag_ptr(b);
58183         b_conv.is_owned = ptr_is_owned(b);
58184         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58185         b_conv.is_owned = false;
58186         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
58187         return ret_conv;
58188 }
58189
58190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58191         LDKInvalidShutdownScript this_obj_conv;
58192         this_obj_conv.inner = untag_ptr(this_obj);
58193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58195         InvalidShutdownScript_free(this_obj_conv);
58196 }
58197
58198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
58199         LDKInvalidShutdownScript this_ptr_conv;
58200         this_ptr_conv.inner = untag_ptr(this_ptr);
58201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58203         this_ptr_conv.is_owned = false;
58204         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
58205         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58206         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58207         return ret_arr;
58208 }
58209
58210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58211         LDKInvalidShutdownScript this_ptr_conv;
58212         this_ptr_conv.inner = untag_ptr(this_ptr);
58213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58215         this_ptr_conv.is_owned = false;
58216         LDKCVec_u8Z val_ref;
58217         val_ref.datalen = (*env)->GetArrayLength(env, val);
58218         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58219         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
58220         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
58221 }
58222
58223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
58224         LDKCVec_u8Z script_arg_ref;
58225         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
58226         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58227         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
58228         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
58229         int64_t ret_ref = 0;
58230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58232         return ret_ref;
58233 }
58234
58235 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
58236         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
58237         int64_t ret_ref = 0;
58238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58240         return ret_ref;
58241 }
58242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58243         LDKInvalidShutdownScript arg_conv;
58244         arg_conv.inner = untag_ptr(arg);
58245         arg_conv.is_owned = ptr_is_owned(arg);
58246         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58247         arg_conv.is_owned = false;
58248         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
58249         return ret_conv;
58250 }
58251
58252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58253         LDKInvalidShutdownScript orig_conv;
58254         orig_conv.inner = untag_ptr(orig);
58255         orig_conv.is_owned = ptr_is_owned(orig);
58256         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58257         orig_conv.is_owned = false;
58258         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
58259         int64_t ret_ref = 0;
58260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58262         return ret_ref;
58263 }
58264
58265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
58266         LDKShutdownScript obj_conv;
58267         obj_conv.inner = untag_ptr(obj);
58268         obj_conv.is_owned = ptr_is_owned(obj);
58269         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58270         obj_conv.is_owned = false;
58271         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
58272         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58273         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58274         CVec_u8Z_free(ret_var);
58275         return ret_arr;
58276 }
58277
58278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58279         LDKu8slice ser_ref;
58280         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58281         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58282         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
58283         *ret_conv = ShutdownScript_read(ser_ref);
58284         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58285         return tag_ptr(ret_conv, true);
58286 }
58287
58288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
58289         uint8_t pubkey_hash_arr[20];
58290         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
58291         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
58292         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
58293         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
58294         int64_t ret_ref = 0;
58295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58297         return ret_ref;
58298 }
58299
58300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
58301         uint8_t script_hash_arr[32];
58302         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
58303         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
58304         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
58305         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
58306         int64_t ret_ref = 0;
58307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58309         return ret_ref;
58310 }
58311
58312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
58313         
58314         LDKu8slice program_ref;
58315         program_ref.datalen = (*env)->GetArrayLength(env, program);
58316         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
58317         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
58318         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
58319         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
58320         return tag_ptr(ret_conv, true);
58321 }
58322
58323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
58324         LDKShutdownScript this_arg_conv;
58325         this_arg_conv.inner = untag_ptr(this_arg);
58326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58328         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
58329         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
58330         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58331         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58332         CVec_u8Z_free(ret_var);
58333         return ret_arr;
58334 }
58335
58336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
58337         LDKShutdownScript this_arg_conv;
58338         this_arg_conv.inner = untag_ptr(this_arg);
58339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58341         this_arg_conv.is_owned = false;
58342         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58343         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
58344         return ret_arr;
58345 }
58346
58347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
58348         LDKShutdownScript this_arg_conv;
58349         this_arg_conv.inner = untag_ptr(this_arg);
58350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58352         this_arg_conv.is_owned = false;
58353         LDKInitFeatures features_conv;
58354         features_conv.inner = untag_ptr(features);
58355         features_conv.is_owned = ptr_is_owned(features);
58356         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58357         features_conv.is_owned = false;
58358         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
58359         return ret_conv;
58360 }
58361
58362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58363         if (!ptr_is_owned(this_ptr)) return;
58364         void* this_ptr_ptr = untag_ptr(this_ptr);
58365         CHECK_ACCESS(this_ptr_ptr);
58366         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
58367         FREE(untag_ptr(this_ptr));
58368         Retry_free(this_ptr_conv);
58369 }
58370
58371 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
58372         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58373         *ret_copy = Retry_clone(arg);
58374         int64_t ret_ref = tag_ptr(ret_copy, true);
58375         return ret_ref;
58376 }
58377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58378         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
58379         int64_t ret_conv = Retry_clone_ptr(arg_conv);
58380         return ret_conv;
58381 }
58382
58383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58384         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
58385         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58386         *ret_copy = Retry_clone(orig_conv);
58387         int64_t ret_ref = tag_ptr(ret_copy, true);
58388         return ret_ref;
58389 }
58390
58391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
58392         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58393         *ret_copy = Retry_attempts(a);
58394         int64_t ret_ref = tag_ptr(ret_copy, true);
58395         return ret_ref;
58396 }
58397
58398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
58399         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58400         *ret_copy = Retry_timeout(a);
58401         int64_t ret_ref = tag_ptr(ret_copy, true);
58402         return ret_ref;
58403 }
58404
58405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58406         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
58407         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
58408         jboolean ret_conv = Retry_eq(a_conv, b_conv);
58409         return ret_conv;
58410 }
58411
58412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
58413         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
58414         int64_t ret_conv = Retry_hash(o_conv);
58415         return ret_conv;
58416 }
58417
58418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
58419         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
58420         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
58421         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58422         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58423         CVec_u8Z_free(ret_var);
58424         return ret_arr;
58425 }
58426
58427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58428         LDKu8slice ser_ref;
58429         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58430         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58431         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
58432         *ret_conv = Retry_read(ser_ref);
58433         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58434         return tag_ptr(ret_conv, true);
58435 }
58436
58437 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58438         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
58439         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
58440         return ret_conv;
58441 }
58442
58443 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
58444         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
58445         return ret_conv;
58446 }
58447
58448 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
58449         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
58450         return ret_conv;
58451 }
58452
58453 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
58454         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
58455         return ret_conv;
58456 }
58457
58458 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58459         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
58460         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
58461         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
58462         return ret_conv;
58463 }
58464
58465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58466         if (!ptr_is_owned(this_ptr)) return;
58467         void* this_ptr_ptr = untag_ptr(this_ptr);
58468         CHECK_ACCESS(this_ptr_ptr);
58469         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
58470         FREE(untag_ptr(this_ptr));
58471         PaymentSendFailure_free(this_ptr_conv);
58472 }
58473
58474 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
58475         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58476         *ret_copy = PaymentSendFailure_clone(arg);
58477         int64_t ret_ref = tag_ptr(ret_copy, true);
58478         return ret_ref;
58479 }
58480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58481         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
58482         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
58483         return ret_conv;
58484 }
58485
58486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58487         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
58488         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58489         *ret_copy = PaymentSendFailure_clone(orig_conv);
58490         int64_t ret_ref = tag_ptr(ret_copy, true);
58491         return ret_ref;
58492 }
58493
58494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
58495         void* a_ptr = untag_ptr(a);
58496         CHECK_ACCESS(a_ptr);
58497         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
58498         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
58499         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58500         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
58501         int64_t ret_ref = tag_ptr(ret_copy, true);
58502         return ret_ref;
58503 }
58504
58505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
58506         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
58507         a_constr.datalen = (*env)->GetArrayLength(env, a);
58508         if (a_constr.datalen > 0)
58509                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58510         else
58511                 a_constr.data = NULL;
58512         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
58513         for (size_t w = 0; w < a_constr.datalen; w++) {
58514                 int64_t a_conv_22 = a_vals[w];
58515                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
58516                 CHECK_ACCESS(a_conv_22_ptr);
58517                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
58518                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
58519                 a_constr.data[w] = a_conv_22_conv;
58520         }
58521         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
58522         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58523         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
58524         int64_t ret_ref = tag_ptr(ret_copy, true);
58525         return ret_ref;
58526 }
58527
58528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
58529         LDKCVec_APIErrorZ a_constr;
58530         a_constr.datalen = (*env)->GetArrayLength(env, a);
58531         if (a_constr.datalen > 0)
58532                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
58533         else
58534                 a_constr.data = NULL;
58535         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
58536         for (size_t k = 0; k < a_constr.datalen; k++) {
58537                 int64_t a_conv_10 = a_vals[k];
58538                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
58539                 CHECK_ACCESS(a_conv_10_ptr);
58540                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
58541                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
58542                 a_constr.data[k] = a_conv_10_conv;
58543         }
58544         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
58545         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58546         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
58547         int64_t ret_ref = tag_ptr(ret_copy, true);
58548         return ret_ref;
58549 }
58550
58551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
58552         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58553         *ret_copy = PaymentSendFailure_duplicate_payment();
58554         int64_t ret_ref = tag_ptr(ret_copy, true);
58555         return ret_ref;
58556 }
58557
58558 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) {
58559         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
58560         results_constr.datalen = (*env)->GetArrayLength(env, results);
58561         if (results_constr.datalen > 0)
58562                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58563         else
58564                 results_constr.data = NULL;
58565         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
58566         for (size_t w = 0; w < results_constr.datalen; w++) {
58567                 int64_t results_conv_22 = results_vals[w];
58568                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
58569                 CHECK_ACCESS(results_conv_22_ptr);
58570                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
58571                 results_constr.data[w] = results_conv_22_conv;
58572         }
58573         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
58574         LDKRouteParameters failed_paths_retry_conv;
58575         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
58576         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
58577         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
58578         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
58579         LDKThirtyTwoBytes payment_id_ref;
58580         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
58581         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
58582         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58583         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
58584         int64_t ret_ref = tag_ptr(ret_copy, true);
58585         return ret_ref;
58586 }
58587
58588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58589         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
58590         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
58591         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
58592         return ret_conv;
58593 }
58594
58595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58596         if (!ptr_is_owned(this_ptr)) return;
58597         void* this_ptr_ptr = untag_ptr(this_ptr);
58598         CHECK_ACCESS(this_ptr_ptr);
58599         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
58600         FREE(untag_ptr(this_ptr));
58601         ProbeSendFailure_free(this_ptr_conv);
58602 }
58603
58604 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
58605         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58606         *ret_copy = ProbeSendFailure_clone(arg);
58607         int64_t ret_ref = tag_ptr(ret_copy, true);
58608         return ret_ref;
58609 }
58610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58611         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
58612         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
58613         return ret_conv;
58614 }
58615
58616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58617         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
58618         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58619         *ret_copy = ProbeSendFailure_clone(orig_conv);
58620         int64_t ret_ref = tag_ptr(ret_copy, true);
58621         return ret_ref;
58622 }
58623
58624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
58625         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58626         *ret_copy = ProbeSendFailure_route_not_found();
58627         int64_t ret_ref = tag_ptr(ret_copy, true);
58628         return ret_ref;
58629 }
58630
58631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
58632         void* a_ptr = untag_ptr(a);
58633         CHECK_ACCESS(a_ptr);
58634         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
58635         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
58636         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58637         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
58638         int64_t ret_ref = tag_ptr(ret_copy, true);
58639         return ret_ref;
58640 }
58641
58642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58643         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
58644         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
58645         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
58646         return ret_conv;
58647 }
58648
58649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58650         LDKRecipientOnionFields this_obj_conv;
58651         this_obj_conv.inner = untag_ptr(this_obj);
58652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58654         RecipientOnionFields_free(this_obj_conv);
58655 }
58656
58657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
58658         LDKRecipientOnionFields this_ptr_conv;
58659         this_ptr_conv.inner = untag_ptr(this_ptr);
58660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58662         this_ptr_conv.is_owned = false;
58663         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
58664         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
58665         int64_t ret_ref = tag_ptr(ret_copy, true);
58666         return ret_ref;
58667 }
58668
58669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58670         LDKRecipientOnionFields this_ptr_conv;
58671         this_ptr_conv.inner = untag_ptr(this_ptr);
58672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58674         this_ptr_conv.is_owned = false;
58675         void* val_ptr = untag_ptr(val);
58676         CHECK_ACCESS(val_ptr);
58677         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
58678         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
58679         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
58680 }
58681
58682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
58683         LDKRecipientOnionFields this_ptr_conv;
58684         this_ptr_conv.inner = untag_ptr(this_ptr);
58685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58687         this_ptr_conv.is_owned = false;
58688         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58689         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
58690         int64_t ret_ref = tag_ptr(ret_copy, true);
58691         return ret_ref;
58692 }
58693
58694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58695         LDKRecipientOnionFields this_ptr_conv;
58696         this_ptr_conv.inner = untag_ptr(this_ptr);
58697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58699         this_ptr_conv.is_owned = false;
58700         void* val_ptr = untag_ptr(val);
58701         CHECK_ACCESS(val_ptr);
58702         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
58703         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
58704         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
58705 }
58706
58707 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
58708         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
58709         int64_t ret_ref = 0;
58710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58712         return ret_ref;
58713 }
58714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58715         LDKRecipientOnionFields arg_conv;
58716         arg_conv.inner = untag_ptr(arg);
58717         arg_conv.is_owned = ptr_is_owned(arg);
58718         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58719         arg_conv.is_owned = false;
58720         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
58721         return ret_conv;
58722 }
58723
58724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58725         LDKRecipientOnionFields orig_conv;
58726         orig_conv.inner = untag_ptr(orig);
58727         orig_conv.is_owned = ptr_is_owned(orig);
58728         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58729         orig_conv.is_owned = false;
58730         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
58731         int64_t ret_ref = 0;
58732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58734         return ret_ref;
58735 }
58736
58737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58738         LDKRecipientOnionFields a_conv;
58739         a_conv.inner = untag_ptr(a);
58740         a_conv.is_owned = ptr_is_owned(a);
58741         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58742         a_conv.is_owned = false;
58743         LDKRecipientOnionFields b_conv;
58744         b_conv.inner = untag_ptr(b);
58745         b_conv.is_owned = ptr_is_owned(b);
58746         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58747         b_conv.is_owned = false;
58748         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
58749         return ret_conv;
58750 }
58751
58752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
58753         LDKRecipientOnionFields obj_conv;
58754         obj_conv.inner = untag_ptr(obj);
58755         obj_conv.is_owned = ptr_is_owned(obj);
58756         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58757         obj_conv.is_owned = false;
58758         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
58759         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58760         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58761         CVec_u8Z_free(ret_var);
58762         return ret_arr;
58763 }
58764
58765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58766         LDKu8slice ser_ref;
58767         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58768         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58769         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
58770         *ret_conv = RecipientOnionFields_read(ser_ref);
58771         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58772         return tag_ptr(ret_conv, true);
58773 }
58774
58775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
58776         LDKThirtyTwoBytes payment_secret_ref;
58777         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
58778         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
58779         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
58780         int64_t ret_ref = 0;
58781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58783         return ret_ref;
58784 }
58785
58786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
58787         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
58788         int64_t ret_ref = 0;
58789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58791         return ret_ref;
58792 }
58793
58794 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) {
58795         LDKRecipientOnionFields this_arg_conv;
58796         this_arg_conv.inner = untag_ptr(this_arg);
58797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58799         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
58800         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
58801         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
58802         if (custom_tlvs_constr.datalen > 0)
58803                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
58804         else
58805                 custom_tlvs_constr.data = NULL;
58806         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
58807         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
58808                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
58809                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
58810                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
58811                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
58812                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
58813                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
58814         }
58815         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
58816         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
58817         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
58818         return tag_ptr(ret_conv, true);
58819 }
58820
58821 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
58822         LDKRecipientOnionFields this_arg_conv;
58823         this_arg_conv.inner = untag_ptr(this_arg);
58824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58826         this_arg_conv.is_owned = false;
58827         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
58828         int64_tArray ret_arr = NULL;
58829         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58830         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58831         for (size_t x = 0; x < ret_var.datalen; x++) {
58832                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
58833                 *ret_conv_23_conv = ret_var.data[x];
58834                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
58835         }
58836         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58837         FREE(ret_var.data);
58838         return ret_arr;
58839 }
58840
58841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58842         if (!ptr_is_owned(this_ptr)) return;
58843         void* this_ptr_ptr = untag_ptr(this_ptr);
58844         CHECK_ACCESS(this_ptr_ptr);
58845         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
58846         FREE(untag_ptr(this_ptr));
58847         CustomMessageReader_free(this_ptr_conv);
58848 }
58849
58850 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
58851         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58852         *ret_ret = Type_clone(arg);
58853         return tag_ptr(ret_ret, true);
58854 }
58855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58856         void* arg_ptr = untag_ptr(arg);
58857         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
58858         LDKType* arg_conv = (LDKType*)arg_ptr;
58859         int64_t ret_conv = Type_clone_ptr(arg_conv);
58860         return ret_conv;
58861 }
58862
58863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58864         void* orig_ptr = untag_ptr(orig);
58865         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
58866         LDKType* orig_conv = (LDKType*)orig_ptr;
58867         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
58868         *ret_ret = Type_clone(orig_conv);
58869         return tag_ptr(ret_ret, true);
58870 }
58871
58872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
58873         if (!ptr_is_owned(this_ptr)) return;
58874         void* this_ptr_ptr = untag_ptr(this_ptr);
58875         CHECK_ACCESS(this_ptr_ptr);
58876         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
58877         FREE(untag_ptr(this_ptr));
58878         Type_free(this_ptr_conv);
58879 }
58880
58881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58882         LDKOffer this_obj_conv;
58883         this_obj_conv.inner = untag_ptr(this_obj);
58884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58886         Offer_free(this_obj_conv);
58887 }
58888
58889 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
58890         LDKOffer ret_var = Offer_clone(arg);
58891         int64_t ret_ref = 0;
58892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58894         return ret_ref;
58895 }
58896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58897         LDKOffer arg_conv;
58898         arg_conv.inner = untag_ptr(arg);
58899         arg_conv.is_owned = ptr_is_owned(arg);
58900         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58901         arg_conv.is_owned = false;
58902         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
58903         return ret_conv;
58904 }
58905
58906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58907         LDKOffer orig_conv;
58908         orig_conv.inner = untag_ptr(orig);
58909         orig_conv.is_owned = ptr_is_owned(orig);
58910         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58911         orig_conv.is_owned = false;
58912         LDKOffer ret_var = Offer_clone(&orig_conv);
58913         int64_t ret_ref = 0;
58914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58916         return ret_ref;
58917 }
58918
58919 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
58920         LDKOffer this_arg_conv;
58921         this_arg_conv.inner = untag_ptr(this_arg);
58922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58924         this_arg_conv.is_owned = false;
58925         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
58926         jobjectArray ret_arr = NULL;
58927         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
58928         ;
58929         for (size_t i = 0; i < ret_var.datalen; i++) {
58930                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
58931                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
58932                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
58933         }
58934         
58935         FREE(ret_var.data);
58936         return ret_arr;
58937 }
58938
58939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
58940         LDKOffer this_arg_conv;
58941         this_arg_conv.inner = untag_ptr(this_arg);
58942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58944         this_arg_conv.is_owned = false;
58945         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
58946         *ret_copy = Offer_metadata(&this_arg_conv);
58947         int64_t ret_ref = tag_ptr(ret_copy, true);
58948         return ret_ref;
58949 }
58950
58951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
58952         LDKOffer this_arg_conv;
58953         this_arg_conv.inner = untag_ptr(this_arg);
58954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58956         this_arg_conv.is_owned = false;
58957         LDKAmount ret_var = Offer_amount(&this_arg_conv);
58958         int64_t ret_ref = 0;
58959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58961         return ret_ref;
58962 }
58963
58964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
58965         LDKOffer this_arg_conv;
58966         this_arg_conv.inner = untag_ptr(this_arg);
58967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58969         this_arg_conv.is_owned = false;
58970         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
58971         int64_t ret_ref = 0;
58972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58974         return ret_ref;
58975 }
58976
58977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
58978         LDKOffer this_arg_conv;
58979         this_arg_conv.inner = untag_ptr(this_arg);
58980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58982         this_arg_conv.is_owned = false;
58983         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
58984         int64_t ret_ref = 0;
58985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58987         return ret_ref;
58988 }
58989
58990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
58991         LDKOffer this_arg_conv;
58992         this_arg_conv.inner = untag_ptr(this_arg);
58993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58995         this_arg_conv.is_owned = false;
58996         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
58997         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
58998         int64_t ret_ref = tag_ptr(ret_copy, true);
58999         return ret_ref;
59000 }
59001
59002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
59003         LDKOffer this_arg_conv;
59004         this_arg_conv.inner = untag_ptr(this_arg);
59005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59007         this_arg_conv.is_owned = false;
59008         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
59009         int64_t ret_ref = 0;
59010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59012         return ret_ref;
59013 }
59014
59015 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
59016         LDKOffer this_arg_conv;
59017         this_arg_conv.inner = untag_ptr(this_arg);
59018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59020         this_arg_conv.is_owned = false;
59021         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
59022         int64_tArray ret_arr = NULL;
59023         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59024         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59025         for (size_t n = 0; n < ret_var.datalen; n++) {
59026                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59027                 int64_t ret_conv_13_ref = 0;
59028                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59029                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59030                 ret_arr_ptr[n] = ret_conv_13_ref;
59031         }
59032         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59033         FREE(ret_var.data);
59034         return ret_arr;
59035 }
59036
59037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59038         LDKOffer this_arg_conv;
59039         this_arg_conv.inner = untag_ptr(this_arg);
59040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59042         this_arg_conv.is_owned = false;
59043         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
59044         int64_t ret_ref = 0;
59045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59047         return ret_ref;
59048 }
59049
59050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59051         LDKOffer this_arg_conv;
59052         this_arg_conv.inner = untag_ptr(this_arg);
59053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59055         this_arg_conv.is_owned = false;
59056         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59057         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
59058         return ret_arr;
59059 }
59060
59061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
59062         LDKOffer this_arg_conv;
59063         this_arg_conv.inner = untag_ptr(this_arg);
59064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59066         this_arg_conv.is_owned = false;
59067         LDKThirtyTwoBytes chain_ref;
59068         CHECK((*env)->GetArrayLength(env, chain) == 32);
59069         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
59070         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
59071         return ret_conv;
59072 }
59073
59074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
59075         LDKOffer this_arg_conv;
59076         this_arg_conv.inner = untag_ptr(this_arg);
59077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59079         this_arg_conv.is_owned = false;
59080         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
59081         return ret_conv;
59082 }
59083
59084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
59085         LDKOffer this_arg_conv;
59086         this_arg_conv.inner = untag_ptr(this_arg);
59087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59089         this_arg_conv.is_owned = false;
59090         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
59091         return ret_conv;
59092 }
59093
59094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59095         LDKOffer this_arg_conv;
59096         this_arg_conv.inner = untag_ptr(this_arg);
59097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59099         this_arg_conv.is_owned = false;
59100         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
59101         return ret_conv;
59102 }
59103
59104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
59105         LDKOffer obj_conv;
59106         obj_conv.inner = untag_ptr(obj);
59107         obj_conv.is_owned = ptr_is_owned(obj);
59108         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59109         obj_conv.is_owned = false;
59110         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
59111         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59112         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59113         CVec_u8Z_free(ret_var);
59114         return ret_arr;
59115 }
59116
59117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59118         LDKAmount this_obj_conv;
59119         this_obj_conv.inner = untag_ptr(this_obj);
59120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59122         Amount_free(this_obj_conv);
59123 }
59124
59125 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
59126         LDKAmount ret_var = Amount_clone(arg);
59127         int64_t ret_ref = 0;
59128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59130         return ret_ref;
59131 }
59132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59133         LDKAmount arg_conv;
59134         arg_conv.inner = untag_ptr(arg);
59135         arg_conv.is_owned = ptr_is_owned(arg);
59136         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59137         arg_conv.is_owned = false;
59138         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
59139         return ret_conv;
59140 }
59141
59142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59143         LDKAmount orig_conv;
59144         orig_conv.inner = untag_ptr(orig);
59145         orig_conv.is_owned = ptr_is_owned(orig);
59146         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59147         orig_conv.is_owned = false;
59148         LDKAmount ret_var = Amount_clone(&orig_conv);
59149         int64_t ret_ref = 0;
59150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59152         return ret_ref;
59153 }
59154
59155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59156         LDKQuantity this_obj_conv;
59157         this_obj_conv.inner = untag_ptr(this_obj);
59158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59160         Quantity_free(this_obj_conv);
59161 }
59162
59163 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
59164         LDKQuantity ret_var = Quantity_clone(arg);
59165         int64_t ret_ref = 0;
59166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59168         return ret_ref;
59169 }
59170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59171         LDKQuantity arg_conv;
59172         arg_conv.inner = untag_ptr(arg);
59173         arg_conv.is_owned = ptr_is_owned(arg);
59174         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59175         arg_conv.is_owned = false;
59176         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
59177         return ret_conv;
59178 }
59179
59180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59181         LDKQuantity orig_conv;
59182         orig_conv.inner = untag_ptr(orig);
59183         orig_conv.is_owned = ptr_is_owned(orig);
59184         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59185         orig_conv.is_owned = false;
59186         LDKQuantity ret_var = Quantity_clone(&orig_conv);
59187         int64_t ret_ref = 0;
59188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59190         return ret_ref;
59191 }
59192
59193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
59194         LDKStr s_conv = java_to_owned_str(env, s);
59195         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
59196         *ret_conv = Offer_from_str(s_conv);
59197         return tag_ptr(ret_conv, true);
59198 }
59199
59200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59201         LDKUnsignedBolt12Invoice this_obj_conv;
59202         this_obj_conv.inner = untag_ptr(this_obj);
59203         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59205         UnsignedBolt12Invoice_free(this_obj_conv);
59206 }
59207
59208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59209         LDKUnsignedBolt12Invoice this_arg_conv;
59210         this_arg_conv.inner = untag_ptr(this_arg);
59211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59213         this_arg_conv.is_owned = false;
59214         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
59215         int64_t ret_ref = 0;
59216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59218         return ret_ref;
59219 }
59220
59221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59222         LDKBolt12Invoice this_obj_conv;
59223         this_obj_conv.inner = untag_ptr(this_obj);
59224         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59226         Bolt12Invoice_free(this_obj_conv);
59227 }
59228
59229 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
59230         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
59231         int64_t ret_ref = 0;
59232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59234         return ret_ref;
59235 }
59236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59237         LDKBolt12Invoice arg_conv;
59238         arg_conv.inner = untag_ptr(arg);
59239         arg_conv.is_owned = ptr_is_owned(arg);
59240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59241         arg_conv.is_owned = false;
59242         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
59243         return ret_conv;
59244 }
59245
59246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59247         LDKBolt12Invoice orig_conv;
59248         orig_conv.inner = untag_ptr(orig);
59249         orig_conv.is_owned = ptr_is_owned(orig);
59250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59251         orig_conv.is_owned = false;
59252         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
59253         int64_t ret_ref = 0;
59254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59256         return ret_ref;
59257 }
59258
59259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
59260         LDKUnsignedBolt12Invoice this_arg_conv;
59261         this_arg_conv.inner = untag_ptr(this_arg);
59262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59264         this_arg_conv.is_owned = false;
59265         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59266         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
59267         int64_t ret_ref = tag_ptr(ret_copy, true);
59268         return ret_ref;
59269 }
59270
59271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
59272         LDKUnsignedBolt12Invoice this_arg_conv;
59273         this_arg_conv.inner = untag_ptr(this_arg);
59274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59276         this_arg_conv.is_owned = false;
59277         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59278         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
59279         return ret_arr;
59280 }
59281
59282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59283         LDKUnsignedBolt12Invoice this_arg_conv;
59284         this_arg_conv.inner = untag_ptr(this_arg);
59285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59287         this_arg_conv.is_owned = false;
59288         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59289         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
59290         int64_t ret_ref = tag_ptr(ret_copy, true);
59291         return ret_ref;
59292 }
59293
59294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
59295         LDKUnsignedBolt12Invoice this_arg_conv;
59296         this_arg_conv.inner = untag_ptr(this_arg);
59297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59299         this_arg_conv.is_owned = false;
59300         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
59301         int64_t ret_ref = 0;
59302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59304         return ret_ref;
59305 }
59306
59307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59308         LDKUnsignedBolt12Invoice this_arg_conv;
59309         this_arg_conv.inner = untag_ptr(this_arg);
59310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59312         this_arg_conv.is_owned = false;
59313         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
59314         int64_t ret_ref = 0;
59315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59317         return ret_ref;
59318 }
59319
59320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
59321         LDKUnsignedBolt12Invoice this_arg_conv;
59322         this_arg_conv.inner = untag_ptr(this_arg);
59323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59325         this_arg_conv.is_owned = false;
59326         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
59327         int64_t ret_ref = 0;
59328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59330         return ret_ref;
59331 }
59332
59333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59334         LDKUnsignedBolt12Invoice this_arg_conv;
59335         this_arg_conv.inner = untag_ptr(this_arg);
59336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59338         this_arg_conv.is_owned = false;
59339         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59340         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
59341         int64_t ret_ref = tag_ptr(ret_copy, true);
59342         return ret_ref;
59343 }
59344
59345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
59346         LDKUnsignedBolt12Invoice this_arg_conv;
59347         this_arg_conv.inner = untag_ptr(this_arg);
59348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59350         this_arg_conv.is_owned = false;
59351         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
59352         int64_t ret_ref = 0;
59353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59355         return ret_ref;
59356 }
59357
59358 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
59359         LDKUnsignedBolt12Invoice this_arg_conv;
59360         this_arg_conv.inner = untag_ptr(this_arg);
59361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59363         this_arg_conv.is_owned = false;
59364         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
59365         int64_tArray ret_arr = NULL;
59366         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59367         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59368         for (size_t n = 0; n < ret_var.datalen; n++) {
59369                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59370                 int64_t ret_conv_13_ref = 0;
59371                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59372                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59373                 ret_arr_ptr[n] = ret_conv_13_ref;
59374         }
59375         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59376         FREE(ret_var.data);
59377         return ret_arr;
59378 }
59379
59380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59381         LDKUnsignedBolt12Invoice this_arg_conv;
59382         this_arg_conv.inner = untag_ptr(this_arg);
59383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59385         this_arg_conv.is_owned = false;
59386         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
59387         int64_t ret_ref = 0;
59388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59390         return ret_ref;
59391 }
59392
59393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59394         LDKUnsignedBolt12Invoice this_arg_conv;
59395         this_arg_conv.inner = untag_ptr(this_arg);
59396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59398         this_arg_conv.is_owned = false;
59399         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
59400         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59401         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59402         return ret_arr;
59403 }
59404
59405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59406         LDKUnsignedBolt12Invoice this_arg_conv;
59407         this_arg_conv.inner = untag_ptr(this_arg);
59408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59410         this_arg_conv.is_owned = false;
59411         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
59412         int64_t ret_ref = 0;
59413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59415         return ret_ref;
59416 }
59417
59418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59419         LDKUnsignedBolt12Invoice this_arg_conv;
59420         this_arg_conv.inner = untag_ptr(this_arg);
59421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59423         this_arg_conv.is_owned = false;
59424         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59425         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
59426         int64_t ret_ref = tag_ptr(ret_copy, true);
59427         return ret_ref;
59428 }
59429
59430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
59431         LDKUnsignedBolt12Invoice this_arg_conv;
59432         this_arg_conv.inner = untag_ptr(this_arg);
59433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59435         this_arg_conv.is_owned = false;
59436         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59437         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
59438         return ret_arr;
59439 }
59440
59441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
59442         LDKUnsignedBolt12Invoice this_arg_conv;
59443         this_arg_conv.inner = untag_ptr(this_arg);
59444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59446         this_arg_conv.is_owned = false;
59447         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
59448         int64_t ret_ref = 0;
59449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59451         return ret_ref;
59452 }
59453
59454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
59455         LDKUnsignedBolt12Invoice this_arg_conv;
59456         this_arg_conv.inner = untag_ptr(this_arg);
59457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59459         this_arg_conv.is_owned = false;
59460         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
59461         return ret_conv;
59462 }
59463
59464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59465         LDKUnsignedBolt12Invoice this_arg_conv;
59466         this_arg_conv.inner = untag_ptr(this_arg);
59467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59469         this_arg_conv.is_owned = false;
59470         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
59471         return ret_conv;
59472 }
59473
59474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
59475         LDKUnsignedBolt12Invoice this_arg_conv;
59476         this_arg_conv.inner = untag_ptr(this_arg);
59477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59479         this_arg_conv.is_owned = false;
59480         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
59481         return ret_conv;
59482 }
59483
59484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59485         LDKUnsignedBolt12Invoice this_arg_conv;
59486         this_arg_conv.inner = untag_ptr(this_arg);
59487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59489         this_arg_conv.is_owned = false;
59490         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59491         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
59492         return ret_arr;
59493 }
59494
59495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
59496         LDKUnsignedBolt12Invoice this_arg_conv;
59497         this_arg_conv.inner = untag_ptr(this_arg);
59498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59500         this_arg_conv.is_owned = false;
59501         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
59502         return ret_conv;
59503 }
59504
59505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59506         LDKUnsignedBolt12Invoice this_arg_conv;
59507         this_arg_conv.inner = untag_ptr(this_arg);
59508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59510         this_arg_conv.is_owned = false;
59511         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
59512         int64_t ret_ref = 0;
59513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59515         return ret_ref;
59516 }
59517
59518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59519         LDKUnsignedBolt12Invoice this_arg_conv;
59520         this_arg_conv.inner = untag_ptr(this_arg);
59521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59523         this_arg_conv.is_owned = false;
59524         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59525         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
59526         return ret_arr;
59527 }
59528
59529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
59530         LDKBolt12Invoice this_arg_conv;
59531         this_arg_conv.inner = untag_ptr(this_arg);
59532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59534         this_arg_conv.is_owned = false;
59535         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59536         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
59537         int64_t ret_ref = tag_ptr(ret_copy, true);
59538         return ret_ref;
59539 }
59540
59541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
59542         LDKBolt12Invoice this_arg_conv;
59543         this_arg_conv.inner = untag_ptr(this_arg);
59544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59546         this_arg_conv.is_owned = false;
59547         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59548         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
59549         return ret_arr;
59550 }
59551
59552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59553         LDKBolt12Invoice this_arg_conv;
59554         this_arg_conv.inner = untag_ptr(this_arg);
59555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59557         this_arg_conv.is_owned = false;
59558         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59559         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
59560         int64_t ret_ref = tag_ptr(ret_copy, true);
59561         return ret_ref;
59562 }
59563
59564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
59565         LDKBolt12Invoice this_arg_conv;
59566         this_arg_conv.inner = untag_ptr(this_arg);
59567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59569         this_arg_conv.is_owned = false;
59570         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
59571         int64_t ret_ref = 0;
59572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59574         return ret_ref;
59575 }
59576
59577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59578         LDKBolt12Invoice this_arg_conv;
59579         this_arg_conv.inner = untag_ptr(this_arg);
59580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59582         this_arg_conv.is_owned = false;
59583         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
59584         int64_t ret_ref = 0;
59585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59587         return ret_ref;
59588 }
59589
59590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
59591         LDKBolt12Invoice this_arg_conv;
59592         this_arg_conv.inner = untag_ptr(this_arg);
59593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59595         this_arg_conv.is_owned = false;
59596         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
59597         int64_t ret_ref = 0;
59598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59600         return ret_ref;
59601 }
59602
59603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59604         LDKBolt12Invoice this_arg_conv;
59605         this_arg_conv.inner = untag_ptr(this_arg);
59606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59608         this_arg_conv.is_owned = false;
59609         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59610         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
59611         int64_t ret_ref = tag_ptr(ret_copy, true);
59612         return ret_ref;
59613 }
59614
59615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
59616         LDKBolt12Invoice this_arg_conv;
59617         this_arg_conv.inner = untag_ptr(this_arg);
59618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59620         this_arg_conv.is_owned = false;
59621         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
59622         int64_t ret_ref = 0;
59623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59625         return ret_ref;
59626 }
59627
59628 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
59629         LDKBolt12Invoice this_arg_conv;
59630         this_arg_conv.inner = untag_ptr(this_arg);
59631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59633         this_arg_conv.is_owned = false;
59634         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
59635         int64_tArray ret_arr = NULL;
59636         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59637         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59638         for (size_t n = 0; n < ret_var.datalen; n++) {
59639                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59640                 int64_t ret_conv_13_ref = 0;
59641                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59642                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59643                 ret_arr_ptr[n] = ret_conv_13_ref;
59644         }
59645         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59646         FREE(ret_var.data);
59647         return ret_arr;
59648 }
59649
59650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59651         LDKBolt12Invoice this_arg_conv;
59652         this_arg_conv.inner = untag_ptr(this_arg);
59653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59655         this_arg_conv.is_owned = false;
59656         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
59657         int64_t ret_ref = 0;
59658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59660         return ret_ref;
59661 }
59662
59663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
59664         LDKBolt12Invoice this_arg_conv;
59665         this_arg_conv.inner = untag_ptr(this_arg);
59666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59668         this_arg_conv.is_owned = false;
59669         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
59670         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59671         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59672         return ret_arr;
59673 }
59674
59675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59676         LDKBolt12Invoice this_arg_conv;
59677         this_arg_conv.inner = untag_ptr(this_arg);
59678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59680         this_arg_conv.is_owned = false;
59681         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
59682         int64_t ret_ref = 0;
59683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59685         return ret_ref;
59686 }
59687
59688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
59689         LDKBolt12Invoice this_arg_conv;
59690         this_arg_conv.inner = untag_ptr(this_arg);
59691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59693         this_arg_conv.is_owned = false;
59694         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59695         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
59696         int64_t ret_ref = tag_ptr(ret_copy, true);
59697         return ret_ref;
59698 }
59699
59700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
59701         LDKBolt12Invoice this_arg_conv;
59702         this_arg_conv.inner = untag_ptr(this_arg);
59703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59705         this_arg_conv.is_owned = false;
59706         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59707         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
59708         return ret_arr;
59709 }
59710
59711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
59712         LDKBolt12Invoice this_arg_conv;
59713         this_arg_conv.inner = untag_ptr(this_arg);
59714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59716         this_arg_conv.is_owned = false;
59717         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
59718         int64_t ret_ref = 0;
59719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59721         return ret_ref;
59722 }
59723
59724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
59725         LDKBolt12Invoice this_arg_conv;
59726         this_arg_conv.inner = untag_ptr(this_arg);
59727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59729         this_arg_conv.is_owned = false;
59730         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
59731         return ret_conv;
59732 }
59733
59734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
59735         LDKBolt12Invoice this_arg_conv;
59736         this_arg_conv.inner = untag_ptr(this_arg);
59737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59739         this_arg_conv.is_owned = false;
59740         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
59741         return ret_conv;
59742 }
59743
59744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
59745         LDKBolt12Invoice this_arg_conv;
59746         this_arg_conv.inner = untag_ptr(this_arg);
59747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59749         this_arg_conv.is_owned = false;
59750         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
59751         return ret_conv;
59752 }
59753
59754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59755         LDKBolt12Invoice this_arg_conv;
59756         this_arg_conv.inner = untag_ptr(this_arg);
59757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59759         this_arg_conv.is_owned = false;
59760         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59761         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
59762         return ret_arr;
59763 }
59764
59765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
59766         LDKBolt12Invoice this_arg_conv;
59767         this_arg_conv.inner = untag_ptr(this_arg);
59768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59770         this_arg_conv.is_owned = false;
59771         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
59772         return ret_conv;
59773 }
59774
59775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59776         LDKBolt12Invoice this_arg_conv;
59777         this_arg_conv.inner = untag_ptr(this_arg);
59778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59780         this_arg_conv.is_owned = false;
59781         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
59782         int64_t ret_ref = 0;
59783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59785         return ret_ref;
59786 }
59787
59788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
59789         LDKBolt12Invoice this_arg_conv;
59790         this_arg_conv.inner = untag_ptr(this_arg);
59791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59793         this_arg_conv.is_owned = false;
59794         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59795         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
59796         return ret_arr;
59797 }
59798
59799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
59800         LDKBolt12Invoice this_arg_conv;
59801         this_arg_conv.inner = untag_ptr(this_arg);
59802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59804         this_arg_conv.is_owned = false;
59805         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59806         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
59807         return ret_arr;
59808 }
59809
59810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
59811         LDKBolt12Invoice this_arg_conv;
59812         this_arg_conv.inner = untag_ptr(this_arg);
59813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59815         this_arg_conv.is_owned = false;
59816         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59817         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
59818         return ret_arr;
59819 }
59820
59821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
59822         LDKBolt12Invoice this_arg_conv;
59823         this_arg_conv.inner = untag_ptr(this_arg);
59824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59826         this_arg_conv.is_owned = false;
59827         LDKExpandedKey key_conv;
59828         key_conv.inner = untag_ptr(key);
59829         key_conv.is_owned = ptr_is_owned(key);
59830         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
59831         key_conv.is_owned = false;
59832         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
59833         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
59834         return tag_ptr(ret_conv, true);
59835 }
59836
59837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
59838         LDKUnsignedBolt12Invoice obj_conv;
59839         obj_conv.inner = untag_ptr(obj);
59840         obj_conv.is_owned = ptr_is_owned(obj);
59841         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59842         obj_conv.is_owned = false;
59843         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
59844         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59845         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59846         CVec_u8Z_free(ret_var);
59847         return ret_arr;
59848 }
59849
59850 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
59851         LDKBolt12Invoice obj_conv;
59852         obj_conv.inner = untag_ptr(obj);
59853         obj_conv.is_owned = ptr_is_owned(obj);
59854         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59855         obj_conv.is_owned = false;
59856         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
59857         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59858         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59859         CVec_u8Z_free(ret_var);
59860         return ret_arr;
59861 }
59862
59863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59864         LDKBlindedPayInfo this_obj_conv;
59865         this_obj_conv.inner = untag_ptr(this_obj);
59866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59868         BlindedPayInfo_free(this_obj_conv);
59869 }
59870
59871 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59872         LDKBlindedPayInfo this_ptr_conv;
59873         this_ptr_conv.inner = untag_ptr(this_ptr);
59874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59876         this_ptr_conv.is_owned = false;
59877         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
59878         return ret_conv;
59879 }
59880
59881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59882         LDKBlindedPayInfo this_ptr_conv;
59883         this_ptr_conv.inner = untag_ptr(this_ptr);
59884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59886         this_ptr_conv.is_owned = false;
59887         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
59888 }
59889
59890 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
59891         LDKBlindedPayInfo this_ptr_conv;
59892         this_ptr_conv.inner = untag_ptr(this_ptr);
59893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59895         this_ptr_conv.is_owned = false;
59896         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
59897         return ret_conv;
59898 }
59899
59900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59901         LDKBlindedPayInfo this_ptr_conv;
59902         this_ptr_conv.inner = untag_ptr(this_ptr);
59903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59905         this_ptr_conv.is_owned = false;
59906         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
59907 }
59908
59909 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59910         LDKBlindedPayInfo this_ptr_conv;
59911         this_ptr_conv.inner = untag_ptr(this_ptr);
59912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59914         this_ptr_conv.is_owned = false;
59915         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
59916         return ret_conv;
59917 }
59918
59919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
59920         LDKBlindedPayInfo this_ptr_conv;
59921         this_ptr_conv.inner = untag_ptr(this_ptr);
59922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59924         this_ptr_conv.is_owned = false;
59925         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
59926 }
59927
59928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59929         LDKBlindedPayInfo this_ptr_conv;
59930         this_ptr_conv.inner = untag_ptr(this_ptr);
59931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59933         this_ptr_conv.is_owned = false;
59934         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
59935         return ret_conv;
59936 }
59937
59938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59939         LDKBlindedPayInfo this_ptr_conv;
59940         this_ptr_conv.inner = untag_ptr(this_ptr);
59941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59943         this_ptr_conv.is_owned = false;
59944         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
59945 }
59946
59947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59948         LDKBlindedPayInfo this_ptr_conv;
59949         this_ptr_conv.inner = untag_ptr(this_ptr);
59950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59952         this_ptr_conv.is_owned = false;
59953         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
59954         return ret_conv;
59955 }
59956
59957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59958         LDKBlindedPayInfo this_ptr_conv;
59959         this_ptr_conv.inner = untag_ptr(this_ptr);
59960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59962         this_ptr_conv.is_owned = false;
59963         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
59964 }
59965
59966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59967         LDKBlindedPayInfo this_ptr_conv;
59968         this_ptr_conv.inner = untag_ptr(this_ptr);
59969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59971         this_ptr_conv.is_owned = false;
59972         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
59973         int64_t ret_ref = 0;
59974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59976         return ret_ref;
59977 }
59978
59979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59980         LDKBlindedPayInfo this_ptr_conv;
59981         this_ptr_conv.inner = untag_ptr(this_ptr);
59982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59984         this_ptr_conv.is_owned = false;
59985         LDKBlindedHopFeatures val_conv;
59986         val_conv.inner = untag_ptr(val);
59987         val_conv.is_owned = ptr_is_owned(val);
59988         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59989         val_conv = BlindedHopFeatures_clone(&val_conv);
59990         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
59991 }
59992
59993 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) {
59994         LDKBlindedHopFeatures features_arg_conv;
59995         features_arg_conv.inner = untag_ptr(features_arg);
59996         features_arg_conv.is_owned = ptr_is_owned(features_arg);
59997         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
59998         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
59999         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);
60000         int64_t ret_ref = 0;
60001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60003         return ret_ref;
60004 }
60005
60006 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
60007         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
60008         int64_t ret_ref = 0;
60009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60011         return ret_ref;
60012 }
60013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60014         LDKBlindedPayInfo arg_conv;
60015         arg_conv.inner = untag_ptr(arg);
60016         arg_conv.is_owned = ptr_is_owned(arg);
60017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60018         arg_conv.is_owned = false;
60019         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
60020         return ret_conv;
60021 }
60022
60023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60024         LDKBlindedPayInfo orig_conv;
60025         orig_conv.inner = untag_ptr(orig);
60026         orig_conv.is_owned = ptr_is_owned(orig);
60027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60028         orig_conv.is_owned = false;
60029         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
60030         int64_t ret_ref = 0;
60031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60033         return ret_ref;
60034 }
60035
60036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
60037         LDKBlindedPayInfo o_conv;
60038         o_conv.inner = untag_ptr(o);
60039         o_conv.is_owned = ptr_is_owned(o);
60040         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60041         o_conv.is_owned = false;
60042         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
60043         return ret_conv;
60044 }
60045
60046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60047         LDKBlindedPayInfo a_conv;
60048         a_conv.inner = untag_ptr(a);
60049         a_conv.is_owned = ptr_is_owned(a);
60050         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60051         a_conv.is_owned = false;
60052         LDKBlindedPayInfo b_conv;
60053         b_conv.inner = untag_ptr(b);
60054         b_conv.is_owned = ptr_is_owned(b);
60055         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60056         b_conv.is_owned = false;
60057         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
60058         return ret_conv;
60059 }
60060
60061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
60062         LDKBlindedPayInfo obj_conv;
60063         obj_conv.inner = untag_ptr(obj);
60064         obj_conv.is_owned = ptr_is_owned(obj);
60065         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60066         obj_conv.is_owned = false;
60067         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
60068         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60069         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60070         CVec_u8Z_free(ret_var);
60071         return ret_arr;
60072 }
60073
60074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60075         LDKu8slice ser_ref;
60076         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60077         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60078         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
60079         *ret_conv = BlindedPayInfo_read(ser_ref);
60080         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60081         return tag_ptr(ret_conv, true);
60082 }
60083
60084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60085         LDKInvoiceError this_obj_conv;
60086         this_obj_conv.inner = untag_ptr(this_obj);
60087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60089         InvoiceError_free(this_obj_conv);
60090 }
60091
60092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
60093         LDKInvoiceError this_ptr_conv;
60094         this_ptr_conv.inner = untag_ptr(this_ptr);
60095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60097         this_ptr_conv.is_owned = false;
60098         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
60099         int64_t ret_ref = 0;
60100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60102         return ret_ref;
60103 }
60104
60105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60106         LDKInvoiceError this_ptr_conv;
60107         this_ptr_conv.inner = untag_ptr(this_ptr);
60108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60110         this_ptr_conv.is_owned = false;
60111         LDKErroneousField val_conv;
60112         val_conv.inner = untag_ptr(val);
60113         val_conv.is_owned = ptr_is_owned(val);
60114         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60115         val_conv = ErroneousField_clone(&val_conv);
60116         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
60117 }
60118
60119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
60120         LDKInvoiceError this_ptr_conv;
60121         this_ptr_conv.inner = untag_ptr(this_ptr);
60122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60124         this_ptr_conv.is_owned = false;
60125         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
60126         int64_t ret_ref = 0;
60127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60129         return ret_ref;
60130 }
60131
60132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60133         LDKInvoiceError this_ptr_conv;
60134         this_ptr_conv.inner = untag_ptr(this_ptr);
60135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60137         this_ptr_conv.is_owned = false;
60138         LDKUntrustedString val_conv;
60139         val_conv.inner = untag_ptr(val);
60140         val_conv.is_owned = ptr_is_owned(val);
60141         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60142         val_conv = UntrustedString_clone(&val_conv);
60143         InvoiceError_set_message(&this_ptr_conv, val_conv);
60144 }
60145
60146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
60147         LDKErroneousField erroneous_field_arg_conv;
60148         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
60149         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
60150         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
60151         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
60152         LDKUntrustedString message_arg_conv;
60153         message_arg_conv.inner = untag_ptr(message_arg);
60154         message_arg_conv.is_owned = ptr_is_owned(message_arg);
60155         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
60156         message_arg_conv = UntrustedString_clone(&message_arg_conv);
60157         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
60158         int64_t ret_ref = 0;
60159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60161         return ret_ref;
60162 }
60163
60164 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
60165         LDKInvoiceError ret_var = InvoiceError_clone(arg);
60166         int64_t ret_ref = 0;
60167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60169         return ret_ref;
60170 }
60171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60172         LDKInvoiceError arg_conv;
60173         arg_conv.inner = untag_ptr(arg);
60174         arg_conv.is_owned = ptr_is_owned(arg);
60175         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60176         arg_conv.is_owned = false;
60177         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
60178         return ret_conv;
60179 }
60180
60181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60182         LDKInvoiceError orig_conv;
60183         orig_conv.inner = untag_ptr(orig);
60184         orig_conv.is_owned = ptr_is_owned(orig);
60185         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60186         orig_conv.is_owned = false;
60187         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
60188         int64_t ret_ref = 0;
60189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60191         return ret_ref;
60192 }
60193
60194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60195         LDKErroneousField this_obj_conv;
60196         this_obj_conv.inner = untag_ptr(this_obj);
60197         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60199         ErroneousField_free(this_obj_conv);
60200 }
60201
60202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
60203         LDKErroneousField this_ptr_conv;
60204         this_ptr_conv.inner = untag_ptr(this_ptr);
60205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60207         this_ptr_conv.is_owned = false;
60208         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
60209         return ret_conv;
60210 }
60211
60212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60213         LDKErroneousField this_ptr_conv;
60214         this_ptr_conv.inner = untag_ptr(this_ptr);
60215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60217         this_ptr_conv.is_owned = false;
60218         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
60219 }
60220
60221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
60222         LDKErroneousField this_ptr_conv;
60223         this_ptr_conv.inner = untag_ptr(this_ptr);
60224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60226         this_ptr_conv.is_owned = false;
60227         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60228         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
60229         int64_t ret_ref = tag_ptr(ret_copy, true);
60230         return ret_ref;
60231 }
60232
60233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60234         LDKErroneousField this_ptr_conv;
60235         this_ptr_conv.inner = untag_ptr(this_ptr);
60236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60238         this_ptr_conv.is_owned = false;
60239         void* val_ptr = untag_ptr(val);
60240         CHECK_ACCESS(val_ptr);
60241         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
60242         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
60243         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
60244 }
60245
60246 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) {
60247         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
60248         CHECK_ACCESS(suggested_value_arg_ptr);
60249         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
60250         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
60251         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
60252         int64_t ret_ref = 0;
60253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60255         return ret_ref;
60256 }
60257
60258 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
60259         LDKErroneousField ret_var = ErroneousField_clone(arg);
60260         int64_t ret_ref = 0;
60261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60263         return ret_ref;
60264 }
60265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60266         LDKErroneousField arg_conv;
60267         arg_conv.inner = untag_ptr(arg);
60268         arg_conv.is_owned = ptr_is_owned(arg);
60269         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60270         arg_conv.is_owned = false;
60271         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
60272         return ret_conv;
60273 }
60274
60275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60276         LDKErroneousField orig_conv;
60277         orig_conv.inner = untag_ptr(orig);
60278         orig_conv.is_owned = ptr_is_owned(orig);
60279         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60280         orig_conv.is_owned = false;
60281         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
60282         int64_t ret_ref = 0;
60283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60285         return ret_ref;
60286 }
60287
60288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string(JNIEnv *env, jclass clz, jstring s) {
60289         LDKStr s_conv = java_to_owned_str(env, s);
60290         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
60291         int64_t ret_ref = 0;
60292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60294         return ret_ref;
60295 }
60296
60297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
60298         LDKInvoiceError obj_conv;
60299         obj_conv.inner = untag_ptr(obj);
60300         obj_conv.is_owned = ptr_is_owned(obj);
60301         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60302         obj_conv.is_owned = false;
60303         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
60304         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60305         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60306         CVec_u8Z_free(ret_var);
60307         return ret_arr;
60308 }
60309
60310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60311         LDKu8slice ser_ref;
60312         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60313         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60314         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
60315         *ret_conv = InvoiceError_read(ser_ref);
60316         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60317         return tag_ptr(ret_conv, true);
60318 }
60319
60320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60321         LDKUnsignedInvoiceRequest this_obj_conv;
60322         this_obj_conv.inner = untag_ptr(this_obj);
60323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60325         UnsignedInvoiceRequest_free(this_obj_conv);
60326 }
60327
60328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
60329         LDKUnsignedInvoiceRequest this_arg_conv;
60330         this_arg_conv.inner = untag_ptr(this_arg);
60331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60333         this_arg_conv.is_owned = false;
60334         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
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
60341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60342         LDKInvoiceRequest this_obj_conv;
60343         this_obj_conv.inner = untag_ptr(this_obj);
60344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60346         InvoiceRequest_free(this_obj_conv);
60347 }
60348
60349 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
60350         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
60351         int64_t ret_ref = 0;
60352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60354         return ret_ref;
60355 }
60356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60357         LDKInvoiceRequest arg_conv;
60358         arg_conv.inner = untag_ptr(arg);
60359         arg_conv.is_owned = ptr_is_owned(arg);
60360         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60361         arg_conv.is_owned = false;
60362         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
60363         return ret_conv;
60364 }
60365
60366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60367         LDKInvoiceRequest orig_conv;
60368         orig_conv.inner = untag_ptr(orig);
60369         orig_conv.is_owned = ptr_is_owned(orig);
60370         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60371         orig_conv.is_owned = false;
60372         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
60373         int64_t ret_ref = 0;
60374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60376         return ret_ref;
60377 }
60378
60379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60380         LDKVerifiedInvoiceRequest this_obj_conv;
60381         this_obj_conv.inner = untag_ptr(this_obj);
60382         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60384         VerifiedInvoiceRequest_free(this_obj_conv);
60385 }
60386
60387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
60388         LDKVerifiedInvoiceRequest this_ptr_conv;
60389         this_ptr_conv.inner = untag_ptr(this_ptr);
60390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60392         this_ptr_conv.is_owned = false;
60393         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
60394         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
60395         int64_t ret_ref = tag_ptr(ret_copy, true);
60396         return ret_ref;
60397 }
60398
60399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60400         LDKVerifiedInvoiceRequest this_ptr_conv;
60401         this_ptr_conv.inner = untag_ptr(this_ptr);
60402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60404         this_ptr_conv.is_owned = false;
60405         void* val_ptr = untag_ptr(val);
60406         CHECK_ACCESS(val_ptr);
60407         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
60408         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
60409         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
60410 }
60411
60412 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
60413         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
60414         int64_t ret_ref = 0;
60415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60417         return ret_ref;
60418 }
60419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60420         LDKVerifiedInvoiceRequest arg_conv;
60421         arg_conv.inner = untag_ptr(arg);
60422         arg_conv.is_owned = ptr_is_owned(arg);
60423         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60424         arg_conv.is_owned = false;
60425         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
60426         return ret_conv;
60427 }
60428
60429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60430         LDKVerifiedInvoiceRequest orig_conv;
60431         orig_conv.inner = untag_ptr(orig);
60432         orig_conv.is_owned = ptr_is_owned(orig);
60433         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60434         orig_conv.is_owned = false;
60435         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
60436         int64_t ret_ref = 0;
60437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60439         return ret_ref;
60440 }
60441
60442 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60443         LDKUnsignedInvoiceRequest this_arg_conv;
60444         this_arg_conv.inner = untag_ptr(this_arg);
60445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60447         this_arg_conv.is_owned = false;
60448         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
60449         jobjectArray ret_arr = NULL;
60450         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60451         ;
60452         for (size_t i = 0; i < ret_var.datalen; i++) {
60453                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60454                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60455                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60456         }
60457         
60458         FREE(ret_var.data);
60459         return ret_arr;
60460 }
60461
60462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60463         LDKUnsignedInvoiceRequest this_arg_conv;
60464         this_arg_conv.inner = untag_ptr(this_arg);
60465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60467         this_arg_conv.is_owned = false;
60468         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60469         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
60470         int64_t ret_ref = tag_ptr(ret_copy, true);
60471         return ret_ref;
60472 }
60473
60474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60475         LDKUnsignedInvoiceRequest this_arg_conv;
60476         this_arg_conv.inner = untag_ptr(this_arg);
60477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60479         this_arg_conv.is_owned = false;
60480         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
60481         int64_t ret_ref = 0;
60482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60484         return ret_ref;
60485 }
60486
60487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60488         LDKUnsignedInvoiceRequest this_arg_conv;
60489         this_arg_conv.inner = untag_ptr(this_arg);
60490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60492         this_arg_conv.is_owned = false;
60493         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
60494         int64_t ret_ref = 0;
60495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60497         return ret_ref;
60498 }
60499
60500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60501         LDKUnsignedInvoiceRequest this_arg_conv;
60502         this_arg_conv.inner = untag_ptr(this_arg);
60503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60505         this_arg_conv.is_owned = false;
60506         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
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
60513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60514         LDKUnsignedInvoiceRequest this_arg_conv;
60515         this_arg_conv.inner = untag_ptr(this_arg);
60516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60518         this_arg_conv.is_owned = false;
60519         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60520         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
60521         int64_t ret_ref = tag_ptr(ret_copy, true);
60522         return ret_ref;
60523 }
60524
60525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60526         LDKUnsignedInvoiceRequest this_arg_conv;
60527         this_arg_conv.inner = untag_ptr(this_arg);
60528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60530         this_arg_conv.is_owned = false;
60531         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
60532         int64_t ret_ref = 0;
60533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60535         return ret_ref;
60536 }
60537
60538 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60539         LDKUnsignedInvoiceRequest this_arg_conv;
60540         this_arg_conv.inner = untag_ptr(this_arg);
60541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60543         this_arg_conv.is_owned = false;
60544         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
60545         int64_tArray ret_arr = NULL;
60546         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60547         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60548         for (size_t n = 0; n < ret_var.datalen; n++) {
60549                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60550                 int64_t ret_conv_13_ref = 0;
60551                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60552                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60553                 ret_arr_ptr[n] = ret_conv_13_ref;
60554         }
60555         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60556         FREE(ret_var.data);
60557         return ret_arr;
60558 }
60559
60560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60561         LDKUnsignedInvoiceRequest this_arg_conv;
60562         this_arg_conv.inner = untag_ptr(this_arg);
60563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60565         this_arg_conv.is_owned = false;
60566         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
60567         int64_t ret_ref = 0;
60568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60570         return ret_ref;
60571 }
60572
60573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
60574         LDKUnsignedInvoiceRequest this_arg_conv;
60575         this_arg_conv.inner = untag_ptr(this_arg);
60576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60578         this_arg_conv.is_owned = false;
60579         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60580         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
60581         return ret_arr;
60582 }
60583
60584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60585         LDKUnsignedInvoiceRequest this_arg_conv;
60586         this_arg_conv.inner = untag_ptr(this_arg);
60587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60589         this_arg_conv.is_owned = false;
60590         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
60591         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60592         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60593         return ret_arr;
60594 }
60595
60596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60597         LDKUnsignedInvoiceRequest this_arg_conv;
60598         this_arg_conv.inner = untag_ptr(this_arg);
60599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60601         this_arg_conv.is_owned = false;
60602         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60603         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
60604         return ret_arr;
60605 }
60606
60607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60608         LDKUnsignedInvoiceRequest this_arg_conv;
60609         this_arg_conv.inner = untag_ptr(this_arg);
60610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60612         this_arg_conv.is_owned = false;
60613         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60614         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
60615         int64_t ret_ref = tag_ptr(ret_copy, true);
60616         return ret_ref;
60617 }
60618
60619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60620         LDKUnsignedInvoiceRequest this_arg_conv;
60621         this_arg_conv.inner = untag_ptr(this_arg);
60622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60624         this_arg_conv.is_owned = false;
60625         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
60626         int64_t ret_ref = 0;
60627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60629         return ret_ref;
60630 }
60631
60632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60633         LDKUnsignedInvoiceRequest this_arg_conv;
60634         this_arg_conv.inner = untag_ptr(this_arg);
60635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60637         this_arg_conv.is_owned = false;
60638         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60639         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
60640         int64_t ret_ref = tag_ptr(ret_copy, true);
60641         return ret_ref;
60642 }
60643
60644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60645         LDKUnsignedInvoiceRequest this_arg_conv;
60646         this_arg_conv.inner = untag_ptr(this_arg);
60647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60649         this_arg_conv.is_owned = false;
60650         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60651         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60652         return ret_arr;
60653 }
60654
60655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60656         LDKUnsignedInvoiceRequest this_arg_conv;
60657         this_arg_conv.inner = untag_ptr(this_arg);
60658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60660         this_arg_conv.is_owned = false;
60661         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
60662         int64_t ret_ref = 0;
60663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60665         return ret_ref;
60666 }
60667
60668 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60669         LDKInvoiceRequest this_arg_conv;
60670         this_arg_conv.inner = untag_ptr(this_arg);
60671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60673         this_arg_conv.is_owned = false;
60674         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
60675         jobjectArray ret_arr = NULL;
60676         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60677         ;
60678         for (size_t i = 0; i < ret_var.datalen; i++) {
60679                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60680                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60681                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60682         }
60683         
60684         FREE(ret_var.data);
60685         return ret_arr;
60686 }
60687
60688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60689         LDKInvoiceRequest this_arg_conv;
60690         this_arg_conv.inner = untag_ptr(this_arg);
60691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60693         this_arg_conv.is_owned = false;
60694         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60695         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
60696         int64_t ret_ref = tag_ptr(ret_copy, true);
60697         return ret_ref;
60698 }
60699
60700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60701         LDKInvoiceRequest this_arg_conv;
60702         this_arg_conv.inner = untag_ptr(this_arg);
60703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60705         this_arg_conv.is_owned = false;
60706         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
60707         int64_t ret_ref = 0;
60708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60710         return ret_ref;
60711 }
60712
60713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60714         LDKInvoiceRequest this_arg_conv;
60715         this_arg_conv.inner = untag_ptr(this_arg);
60716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60718         this_arg_conv.is_owned = false;
60719         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
60720         int64_t ret_ref = 0;
60721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60723         return ret_ref;
60724 }
60725
60726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60727         LDKInvoiceRequest this_arg_conv;
60728         this_arg_conv.inner = untag_ptr(this_arg);
60729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60731         this_arg_conv.is_owned = false;
60732         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
60733         int64_t ret_ref = 0;
60734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60736         return ret_ref;
60737 }
60738
60739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60740         LDKInvoiceRequest this_arg_conv;
60741         this_arg_conv.inner = untag_ptr(this_arg);
60742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60744         this_arg_conv.is_owned = false;
60745         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60746         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
60747         int64_t ret_ref = tag_ptr(ret_copy, true);
60748         return ret_ref;
60749 }
60750
60751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
60752         LDKInvoiceRequest this_arg_conv;
60753         this_arg_conv.inner = untag_ptr(this_arg);
60754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60756         this_arg_conv.is_owned = false;
60757         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
60758         int64_t ret_ref = 0;
60759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60761         return ret_ref;
60762 }
60763
60764 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
60765         LDKInvoiceRequest this_arg_conv;
60766         this_arg_conv.inner = untag_ptr(this_arg);
60767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60769         this_arg_conv.is_owned = false;
60770         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
60771         int64_tArray ret_arr = NULL;
60772         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60773         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60774         for (size_t n = 0; n < ret_var.datalen; n++) {
60775                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60776                 int64_t ret_conv_13_ref = 0;
60777                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60778                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60779                 ret_arr_ptr[n] = ret_conv_13_ref;
60780         }
60781         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60782         FREE(ret_var.data);
60783         return ret_arr;
60784 }
60785
60786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60787         LDKInvoiceRequest this_arg_conv;
60788         this_arg_conv.inner = untag_ptr(this_arg);
60789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60791         this_arg_conv.is_owned = false;
60792         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
60793         int64_t ret_ref = 0;
60794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60796         return ret_ref;
60797 }
60798
60799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
60800         LDKInvoiceRequest this_arg_conv;
60801         this_arg_conv.inner = untag_ptr(this_arg);
60802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60804         this_arg_conv.is_owned = false;
60805         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60806         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
60807         return ret_arr;
60808 }
60809
60810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60811         LDKInvoiceRequest this_arg_conv;
60812         this_arg_conv.inner = untag_ptr(this_arg);
60813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60815         this_arg_conv.is_owned = false;
60816         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
60817         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60818         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60819         return ret_arr;
60820 }
60821
60822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
60823         LDKInvoiceRequest this_arg_conv;
60824         this_arg_conv.inner = untag_ptr(this_arg);
60825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60827         this_arg_conv.is_owned = false;
60828         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60829         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
60830         return ret_arr;
60831 }
60832
60833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
60834         LDKInvoiceRequest this_arg_conv;
60835         this_arg_conv.inner = untag_ptr(this_arg);
60836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60838         this_arg_conv.is_owned = false;
60839         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60840         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
60841         int64_t ret_ref = tag_ptr(ret_copy, true);
60842         return ret_ref;
60843 }
60844
60845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60846         LDKInvoiceRequest this_arg_conv;
60847         this_arg_conv.inner = untag_ptr(this_arg);
60848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60850         this_arg_conv.is_owned = false;
60851         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
60852         int64_t ret_ref = 0;
60853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60855         return ret_ref;
60856 }
60857
60858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
60859         LDKInvoiceRequest this_arg_conv;
60860         this_arg_conv.inner = untag_ptr(this_arg);
60861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60863         this_arg_conv.is_owned = false;
60864         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60865         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
60866         int64_t ret_ref = tag_ptr(ret_copy, true);
60867         return ret_ref;
60868 }
60869
60870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
60871         LDKInvoiceRequest this_arg_conv;
60872         this_arg_conv.inner = untag_ptr(this_arg);
60873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60875         this_arg_conv.is_owned = false;
60876         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60877         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
60878         return ret_arr;
60879 }
60880
60881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
60882         LDKInvoiceRequest this_arg_conv;
60883         this_arg_conv.inner = untag_ptr(this_arg);
60884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60886         this_arg_conv.is_owned = false;
60887         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
60888         int64_t ret_ref = 0;
60889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60891         return ret_ref;
60892 }
60893
60894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
60895         LDKInvoiceRequest this_arg_conv;
60896         this_arg_conv.inner = untag_ptr(this_arg);
60897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60899         this_arg_conv.is_owned = false;
60900         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60901         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
60902         return ret_arr;
60903 }
60904
60905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
60906         LDKInvoiceRequest this_arg_conv;
60907         this_arg_conv.inner = untag_ptr(this_arg);
60908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60910         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
60911         LDKExpandedKey key_conv;
60912         key_conv.inner = untag_ptr(key);
60913         key_conv.is_owned = ptr_is_owned(key);
60914         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
60915         key_conv.is_owned = false;
60916         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
60917         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
60918         return tag_ptr(ret_conv, true);
60919 }
60920
60921 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
60922         LDKVerifiedInvoiceRequest this_arg_conv;
60923         this_arg_conv.inner = untag_ptr(this_arg);
60924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60926         this_arg_conv.is_owned = false;
60927         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
60928         jobjectArray ret_arr = NULL;
60929         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
60930         ;
60931         for (size_t i = 0; i < ret_var.datalen; i++) {
60932                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
60933                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
60934                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
60935         }
60936         
60937         FREE(ret_var.data);
60938         return ret_arr;
60939 }
60940
60941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
60942         LDKVerifiedInvoiceRequest this_arg_conv;
60943         this_arg_conv.inner = untag_ptr(this_arg);
60944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60946         this_arg_conv.is_owned = false;
60947         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60948         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
60949         int64_t ret_ref = tag_ptr(ret_copy, true);
60950         return ret_ref;
60951 }
60952
60953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60954         LDKVerifiedInvoiceRequest this_arg_conv;
60955         this_arg_conv.inner = untag_ptr(this_arg);
60956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60958         this_arg_conv.is_owned = false;
60959         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
60960         int64_t ret_ref = 0;
60961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60963         return ret_ref;
60964 }
60965
60966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
60967         LDKVerifiedInvoiceRequest this_arg_conv;
60968         this_arg_conv.inner = untag_ptr(this_arg);
60969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60971         this_arg_conv.is_owned = false;
60972         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
60973         int64_t ret_ref = 0;
60974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60976         return ret_ref;
60977 }
60978
60979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60980         LDKVerifiedInvoiceRequest this_arg_conv;
60981         this_arg_conv.inner = untag_ptr(this_arg);
60982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60984         this_arg_conv.is_owned = false;
60985         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
60986         int64_t ret_ref = 0;
60987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60989         return ret_ref;
60990 }
60991
60992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
60993         LDKVerifiedInvoiceRequest this_arg_conv;
60994         this_arg_conv.inner = untag_ptr(this_arg);
60995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60997         this_arg_conv.is_owned = false;
60998         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60999         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
61000         int64_t ret_ref = tag_ptr(ret_copy, true);
61001         return ret_ref;
61002 }
61003
61004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
61005         LDKVerifiedInvoiceRequest this_arg_conv;
61006         this_arg_conv.inner = untag_ptr(this_arg);
61007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61009         this_arg_conv.is_owned = false;
61010         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
61011         int64_t ret_ref = 0;
61012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61014         return ret_ref;
61015 }
61016
61017 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
61018         LDKVerifiedInvoiceRequest this_arg_conv;
61019         this_arg_conv.inner = untag_ptr(this_arg);
61020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61022         this_arg_conv.is_owned = false;
61023         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
61024         int64_tArray ret_arr = NULL;
61025         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
61026         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
61027         for (size_t n = 0; n < ret_var.datalen; n++) {
61028                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61029                 int64_t ret_conv_13_ref = 0;
61030                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61031                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61032                 ret_arr_ptr[n] = ret_conv_13_ref;
61033         }
61034         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
61035         FREE(ret_var.data);
61036         return ret_arr;
61037 }
61038
61039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
61040         LDKVerifiedInvoiceRequest this_arg_conv;
61041         this_arg_conv.inner = untag_ptr(this_arg);
61042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61044         this_arg_conv.is_owned = false;
61045         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
61046         int64_t ret_ref = 0;
61047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61049         return ret_ref;
61050 }
61051
61052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
61053         LDKVerifiedInvoiceRequest this_arg_conv;
61054         this_arg_conv.inner = untag_ptr(this_arg);
61055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61057         this_arg_conv.is_owned = false;
61058         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
61059         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
61060         return ret_arr;
61061 }
61062
61063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
61064         LDKVerifiedInvoiceRequest this_arg_conv;
61065         this_arg_conv.inner = untag_ptr(this_arg);
61066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61068         this_arg_conv.is_owned = false;
61069         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
61070         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61071         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61072         return ret_arr;
61073 }
61074
61075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
61076         LDKVerifiedInvoiceRequest this_arg_conv;
61077         this_arg_conv.inner = untag_ptr(this_arg);
61078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61080         this_arg_conv.is_owned = false;
61081         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61082         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
61083         return ret_arr;
61084 }
61085
61086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
61087         LDKVerifiedInvoiceRequest this_arg_conv;
61088         this_arg_conv.inner = untag_ptr(this_arg);
61089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61091         this_arg_conv.is_owned = false;
61092         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61093         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
61094         int64_t ret_ref = tag_ptr(ret_copy, true);
61095         return ret_ref;
61096 }
61097
61098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
61099         LDKVerifiedInvoiceRequest this_arg_conv;
61100         this_arg_conv.inner = untag_ptr(this_arg);
61101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61103         this_arg_conv.is_owned = false;
61104         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
61105         int64_t ret_ref = 0;
61106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61108         return ret_ref;
61109 }
61110
61111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
61112         LDKVerifiedInvoiceRequest this_arg_conv;
61113         this_arg_conv.inner = untag_ptr(this_arg);
61114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61116         this_arg_conv.is_owned = false;
61117         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61118         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
61119         int64_t ret_ref = tag_ptr(ret_copy, true);
61120         return ret_ref;
61121 }
61122
61123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
61124         LDKVerifiedInvoiceRequest this_arg_conv;
61125         this_arg_conv.inner = untag_ptr(this_arg);
61126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61128         this_arg_conv.is_owned = false;
61129         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
61130         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
61131         return ret_arr;
61132 }
61133
61134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
61135         LDKVerifiedInvoiceRequest this_arg_conv;
61136         this_arg_conv.inner = untag_ptr(this_arg);
61137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61139         this_arg_conv.is_owned = false;
61140         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
61141         int64_t ret_ref = 0;
61142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61144         return ret_ref;
61145 }
61146
61147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
61148         LDKUnsignedInvoiceRequest obj_conv;
61149         obj_conv.inner = untag_ptr(obj);
61150         obj_conv.is_owned = ptr_is_owned(obj);
61151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61152         obj_conv.is_owned = false;
61153         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
61154         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61155         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61156         CVec_u8Z_free(ret_var);
61157         return ret_arr;
61158 }
61159
61160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
61161         LDKInvoiceRequest obj_conv;
61162         obj_conv.inner = untag_ptr(obj);
61163         obj_conv.is_owned = ptr_is_owned(obj);
61164         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61165         obj_conv.is_owned = false;
61166         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
61167         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61168         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61169         CVec_u8Z_free(ret_var);
61170         return ret_arr;
61171 }
61172
61173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61174         LDKTaggedHash this_obj_conv;
61175         this_obj_conv.inner = untag_ptr(this_obj);
61176         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61178         TaggedHash_free(this_obj_conv);
61179 }
61180
61181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61182         LDKBolt12ParseError this_obj_conv;
61183         this_obj_conv.inner = untag_ptr(this_obj);
61184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61186         Bolt12ParseError_free(this_obj_conv);
61187 }
61188
61189 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
61190         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
61191         int64_t ret_ref = 0;
61192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61194         return ret_ref;
61195 }
61196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61197         LDKBolt12ParseError arg_conv;
61198         arg_conv.inner = untag_ptr(arg);
61199         arg_conv.is_owned = ptr_is_owned(arg);
61200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61201         arg_conv.is_owned = false;
61202         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
61203         return ret_conv;
61204 }
61205
61206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61207         LDKBolt12ParseError orig_conv;
61208         orig_conv.inner = untag_ptr(orig);
61209         orig_conv.is_owned = ptr_is_owned(orig);
61210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61211         orig_conv.is_owned = false;
61212         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
61213         int64_t ret_ref = 0;
61214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61216         return ret_ref;
61217 }
61218
61219 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61220         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
61221         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
61222         return ret_conv;
61223 }
61224
61225 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
61226         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
61227         return ret_conv;
61228 }
61229
61230 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
61231         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
61232         return ret_conv;
61233 }
61234
61235 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
61236         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
61237         return ret_conv;
61238 }
61239
61240 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
61241         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
61242         return ret_conv;
61243 }
61244
61245 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
61246         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
61247         return ret_conv;
61248 }
61249
61250 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
61251         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
61252         return ret_conv;
61253 }
61254
61255 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
61256         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
61257         return ret_conv;
61258 }
61259
61260 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
61261         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
61262         return ret_conv;
61263 }
61264
61265 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
61266         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
61267         return ret_conv;
61268 }
61269
61270 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
61271         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
61272         return ret_conv;
61273 }
61274
61275 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
61276         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
61277         return ret_conv;
61278 }
61279
61280 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
61281         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
61282         return ret_conv;
61283 }
61284
61285 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
61286         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
61287         return ret_conv;
61288 }
61289
61290 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
61291         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
61292         return ret_conv;
61293 }
61294
61295 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
61296         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
61297         return ret_conv;
61298 }
61299
61300 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
61301         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
61302         return ret_conv;
61303 }
61304
61305 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
61306         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
61307         return ret_conv;
61308 }
61309
61310 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
61311         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
61312         return ret_conv;
61313 }
61314
61315 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
61316         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
61317         return ret_conv;
61318 }
61319
61320 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
61321         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
61322         return ret_conv;
61323 }
61324
61325 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
61326         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
61327         return ret_conv;
61328 }
61329
61330 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id(JNIEnv *env, jclass clz) {
61331         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_duplicate_payment_id());
61332         return ret_conv;
61333 }
61334
61335 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
61336         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
61337         return ret_conv;
61338 }
61339
61340 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
61341         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
61342         return ret_conv;
61343 }
61344
61345 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
61346         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
61347         return ret_conv;
61348 }
61349
61350 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
61351         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
61352         return ret_conv;
61353 }
61354
61355 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
61356         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
61357         return ret_conv;
61358 }
61359
61360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61361         LDKRefund this_obj_conv;
61362         this_obj_conv.inner = untag_ptr(this_obj);
61363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61365         Refund_free(this_obj_conv);
61366 }
61367
61368 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
61369         LDKRefund ret_var = Refund_clone(arg);
61370         int64_t ret_ref = 0;
61371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61373         return ret_ref;
61374 }
61375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61376         LDKRefund arg_conv;
61377         arg_conv.inner = untag_ptr(arg);
61378         arg_conv.is_owned = ptr_is_owned(arg);
61379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61380         arg_conv.is_owned = false;
61381         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
61382         return ret_conv;
61383 }
61384
61385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61386         LDKRefund orig_conv;
61387         orig_conv.inner = untag_ptr(orig);
61388         orig_conv.is_owned = ptr_is_owned(orig);
61389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61390         orig_conv.is_owned = false;
61391         LDKRefund ret_var = Refund_clone(&orig_conv);
61392         int64_t ret_ref = 0;
61393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61395         return ret_ref;
61396 }
61397
61398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
61399         LDKRefund this_arg_conv;
61400         this_arg_conv.inner = untag_ptr(this_arg);
61401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61403         this_arg_conv.is_owned = false;
61404         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
61405         int64_t ret_ref = 0;
61406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61408         return ret_ref;
61409 }
61410
61411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
61412         LDKRefund this_arg_conv;
61413         this_arg_conv.inner = untag_ptr(this_arg);
61414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61416         this_arg_conv.is_owned = false;
61417         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61418         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
61419         int64_t ret_ref = tag_ptr(ret_copy, true);
61420         return ret_ref;
61421 }
61422
61423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
61424         LDKRefund this_arg_conv;
61425         this_arg_conv.inner = untag_ptr(this_arg);
61426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61428         this_arg_conv.is_owned = false;
61429         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
61430         return ret_conv;
61431 }
61432
61433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
61434         LDKRefund this_arg_conv;
61435         this_arg_conv.inner = untag_ptr(this_arg);
61436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61438         this_arg_conv.is_owned = false;
61439         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
61440         int64_t ret_ref = 0;
61441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61443         return ret_ref;
61444 }
61445
61446 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
61447         LDKRefund this_arg_conv;
61448         this_arg_conv.inner = untag_ptr(this_arg);
61449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61451         this_arg_conv.is_owned = false;
61452         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
61453         int64_tArray ret_arr = NULL;
61454         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
61455         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
61456         for (size_t n = 0; n < ret_var.datalen; n++) {
61457                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61458                 int64_t ret_conv_13_ref = 0;
61459                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61460                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61461                 ret_arr_ptr[n] = ret_conv_13_ref;
61462         }
61463         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
61464         FREE(ret_var.data);
61465         return ret_arr;
61466 }
61467
61468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
61469         LDKRefund this_arg_conv;
61470         this_arg_conv.inner = untag_ptr(this_arg);
61471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61473         this_arg_conv.is_owned = false;
61474         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
61475         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61476         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61477         return ret_arr;
61478 }
61479
61480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
61481         LDKRefund this_arg_conv;
61482         this_arg_conv.inner = untag_ptr(this_arg);
61483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61485         this_arg_conv.is_owned = false;
61486         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
61487         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
61488         return ret_arr;
61489 }
61490
61491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
61492         LDKRefund this_arg_conv;
61493         this_arg_conv.inner = untag_ptr(this_arg);
61494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61496         this_arg_conv.is_owned = false;
61497         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
61498         return ret_conv;
61499 }
61500
61501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
61502         LDKRefund this_arg_conv;
61503         this_arg_conv.inner = untag_ptr(this_arg);
61504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61506         this_arg_conv.is_owned = false;
61507         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
61508         int64_t ret_ref = 0;
61509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61511         return ret_ref;
61512 }
61513
61514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
61515         LDKRefund this_arg_conv;
61516         this_arg_conv.inner = untag_ptr(this_arg);
61517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61519         this_arg_conv.is_owned = false;
61520         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61521         *ret_copy = Refund_quantity(&this_arg_conv);
61522         int64_t ret_ref = tag_ptr(ret_copy, true);
61523         return ret_ref;
61524 }
61525
61526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
61527         LDKRefund this_arg_conv;
61528         this_arg_conv.inner = untag_ptr(this_arg);
61529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61531         this_arg_conv.is_owned = false;
61532         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
61533         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
61534         return ret_arr;
61535 }
61536
61537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
61538         LDKRefund this_arg_conv;
61539         this_arg_conv.inner = untag_ptr(this_arg);
61540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61542         this_arg_conv.is_owned = false;
61543         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
61544         int64_t ret_ref = 0;
61545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61547         return ret_ref;
61548 }
61549
61550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
61551         LDKRefund obj_conv;
61552         obj_conv.inner = untag_ptr(obj);
61553         obj_conv.is_owned = ptr_is_owned(obj);
61554         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61555         obj_conv.is_owned = false;
61556         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
61557         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61558         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61559         CVec_u8Z_free(ret_var);
61560         return ret_arr;
61561 }
61562
61563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
61564         LDKStr s_conv = java_to_owned_str(env, s);
61565         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
61566         *ret_conv = Refund_from_str(s_conv);
61567         return tag_ptr(ret_conv, true);
61568 }
61569
61570 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61571         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
61572         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
61573         return ret_conv;
61574 }
61575
61576 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
61577         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
61578         return ret_conv;
61579 }
61580
61581 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
61582         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
61583         return ret_conv;
61584 }
61585
61586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61587         if (!ptr_is_owned(this_ptr)) return;
61588         void* this_ptr_ptr = untag_ptr(this_ptr);
61589         CHECK_ACCESS(this_ptr_ptr);
61590         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
61591         FREE(untag_ptr(this_ptr));
61592         UtxoResult_free(this_ptr_conv);
61593 }
61594
61595 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
61596         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61597         *ret_copy = UtxoResult_clone(arg);
61598         int64_t ret_ref = tag_ptr(ret_copy, true);
61599         return ret_ref;
61600 }
61601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61602         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
61603         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
61604         return ret_conv;
61605 }
61606
61607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61608         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
61609         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61610         *ret_copy = UtxoResult_clone(orig_conv);
61611         int64_t ret_ref = tag_ptr(ret_copy, true);
61612         return ret_ref;
61613 }
61614
61615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
61616         void* a_ptr = untag_ptr(a);
61617         CHECK_ACCESS(a_ptr);
61618         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
61619         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
61620         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61621         *ret_copy = UtxoResult_sync(a_conv);
61622         int64_t ret_ref = tag_ptr(ret_copy, true);
61623         return ret_ref;
61624 }
61625
61626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
61627         LDKUtxoFuture a_conv;
61628         a_conv.inner = untag_ptr(a);
61629         a_conv.is_owned = ptr_is_owned(a);
61630         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61631         a_conv = UtxoFuture_clone(&a_conv);
61632         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
61633         *ret_copy = UtxoResult_async(a_conv);
61634         int64_t ret_ref = tag_ptr(ret_copy, true);
61635         return ret_ref;
61636 }
61637
61638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61639         if (!ptr_is_owned(this_ptr)) return;
61640         void* this_ptr_ptr = untag_ptr(this_ptr);
61641         CHECK_ACCESS(this_ptr_ptr);
61642         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
61643         FREE(untag_ptr(this_ptr));
61644         UtxoLookup_free(this_ptr_conv);
61645 }
61646
61647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61648         LDKUtxoFuture this_obj_conv;
61649         this_obj_conv.inner = untag_ptr(this_obj);
61650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61652         UtxoFuture_free(this_obj_conv);
61653 }
61654
61655 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
61656         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
61657         int64_t ret_ref = 0;
61658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61660         return ret_ref;
61661 }
61662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61663         LDKUtxoFuture arg_conv;
61664         arg_conv.inner = untag_ptr(arg);
61665         arg_conv.is_owned = ptr_is_owned(arg);
61666         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61667         arg_conv.is_owned = false;
61668         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
61669         return ret_conv;
61670 }
61671
61672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61673         LDKUtxoFuture orig_conv;
61674         orig_conv.inner = untag_ptr(orig);
61675         orig_conv.is_owned = ptr_is_owned(orig);
61676         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61677         orig_conv.is_owned = false;
61678         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
61679         int64_t ret_ref = 0;
61680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61682         return ret_ref;
61683 }
61684
61685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
61686         LDKUtxoFuture ret_var = UtxoFuture_new();
61687         int64_t ret_ref = 0;
61688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61690         return ret_ref;
61691 }
61692
61693 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) {
61694         LDKUtxoFuture this_arg_conv;
61695         this_arg_conv.inner = untag_ptr(this_arg);
61696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61698         this_arg_conv.is_owned = false;
61699         LDKNetworkGraph graph_conv;
61700         graph_conv.inner = untag_ptr(graph);
61701         graph_conv.is_owned = ptr_is_owned(graph);
61702         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61703         graph_conv.is_owned = false;
61704         void* result_ptr = untag_ptr(result);
61705         CHECK_ACCESS(result_ptr);
61706         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61707         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
61708 }
61709
61710 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) {
61711         LDKUtxoFuture this_arg_conv;
61712         this_arg_conv.inner = untag_ptr(this_arg);
61713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61715         this_arg_conv.is_owned = false;
61716         LDKNetworkGraph graph_conv;
61717         graph_conv.inner = untag_ptr(graph);
61718         graph_conv.is_owned = ptr_is_owned(graph);
61719         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
61720         graph_conv.is_owned = false;
61721         LDKP2PGossipSync gossip_conv;
61722         gossip_conv.inner = untag_ptr(gossip);
61723         gossip_conv.is_owned = ptr_is_owned(gossip);
61724         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
61725         gossip_conv.is_owned = false;
61726         void* result_ptr = untag_ptr(result);
61727         CHECK_ACCESS(result_ptr);
61728         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
61729         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
61730 }
61731
61732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61733         LDKNodeId this_obj_conv;
61734         this_obj_conv.inner = untag_ptr(this_obj);
61735         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61737         NodeId_free(this_obj_conv);
61738 }
61739
61740 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
61741         LDKNodeId ret_var = NodeId_clone(arg);
61742         int64_t ret_ref = 0;
61743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61745         return ret_ref;
61746 }
61747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61748         LDKNodeId arg_conv;
61749         arg_conv.inner = untag_ptr(arg);
61750         arg_conv.is_owned = ptr_is_owned(arg);
61751         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61752         arg_conv.is_owned = false;
61753         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
61754         return ret_conv;
61755 }
61756
61757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61758         LDKNodeId orig_conv;
61759         orig_conv.inner = untag_ptr(orig);
61760         orig_conv.is_owned = ptr_is_owned(orig);
61761         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61762         orig_conv.is_owned = false;
61763         LDKNodeId ret_var = NodeId_clone(&orig_conv);
61764         int64_t ret_ref = 0;
61765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61767         return ret_ref;
61768 }
61769
61770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
61771         LDKPublicKey pubkey_ref;
61772         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
61773         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
61774         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
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 int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
61782         LDKNodeId 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         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
61788         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61789         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61790         return ret_arr;
61791 }
61792
61793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
61794         LDKNodeId this_arg_conv;
61795         this_arg_conv.inner = untag_ptr(this_arg);
61796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61798         this_arg_conv.is_owned = false;
61799         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
61800         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
61801         return tag_ptr(ret_conv, true);
61802 }
61803
61804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
61805         LDKNodeId o_conv;
61806         o_conv.inner = untag_ptr(o);
61807         o_conv.is_owned = ptr_is_owned(o);
61808         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61809         o_conv.is_owned = false;
61810         int64_t ret_conv = NodeId_hash(&o_conv);
61811         return ret_conv;
61812 }
61813
61814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
61815         LDKNodeId obj_conv;
61816         obj_conv.inner = untag_ptr(obj);
61817         obj_conv.is_owned = ptr_is_owned(obj);
61818         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61819         obj_conv.is_owned = false;
61820         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
61821         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61822         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61823         CVec_u8Z_free(ret_var);
61824         return ret_arr;
61825 }
61826
61827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61828         LDKu8slice ser_ref;
61829         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61830         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61831         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
61832         *ret_conv = NodeId_read(ser_ref);
61833         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61834         return tag_ptr(ret_conv, true);
61835 }
61836
61837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61838         LDKNetworkGraph this_obj_conv;
61839         this_obj_conv.inner = untag_ptr(this_obj);
61840         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61842         NetworkGraph_free(this_obj_conv);
61843 }
61844
61845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61846         LDKReadOnlyNetworkGraph this_obj_conv;
61847         this_obj_conv.inner = untag_ptr(this_obj);
61848         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61850         ReadOnlyNetworkGraph_free(this_obj_conv);
61851 }
61852
61853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61854         if (!ptr_is_owned(this_ptr)) return;
61855         void* this_ptr_ptr = untag_ptr(this_ptr);
61856         CHECK_ACCESS(this_ptr_ptr);
61857         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
61858         FREE(untag_ptr(this_ptr));
61859         NetworkUpdate_free(this_ptr_conv);
61860 }
61861
61862 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
61863         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61864         *ret_copy = NetworkUpdate_clone(arg);
61865         int64_t ret_ref = tag_ptr(ret_copy, true);
61866         return ret_ref;
61867 }
61868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61869         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
61870         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
61871         return ret_conv;
61872 }
61873
61874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61875         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
61876         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61877         *ret_copy = NetworkUpdate_clone(orig_conv);
61878         int64_t ret_ref = tag_ptr(ret_copy, true);
61879         return ret_ref;
61880 }
61881
61882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
61883         LDKChannelUpdate msg_conv;
61884         msg_conv.inner = untag_ptr(msg);
61885         msg_conv.is_owned = ptr_is_owned(msg);
61886         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
61887         msg_conv = ChannelUpdate_clone(&msg_conv);
61888         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61889         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
61890         int64_t ret_ref = tag_ptr(ret_copy, true);
61891         return ret_ref;
61892 }
61893
61894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
61895         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61896         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
61897         int64_t ret_ref = tag_ptr(ret_copy, true);
61898         return ret_ref;
61899 }
61900
61901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
61902         LDKPublicKey node_id_ref;
61903         CHECK((*env)->GetArrayLength(env, node_id) == 33);
61904         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
61905         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
61906         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
61907         int64_t ret_ref = tag_ptr(ret_copy, true);
61908         return ret_ref;
61909 }
61910
61911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61912         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
61913         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
61914         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
61915         return ret_conv;
61916 }
61917
61918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
61919         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
61920         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
61921         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61922         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61923         CVec_u8Z_free(ret_var);
61924         return ret_arr;
61925 }
61926
61927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61928         LDKu8slice ser_ref;
61929         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61930         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61931         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
61932         *ret_conv = NetworkUpdate_read(ser_ref);
61933         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61934         return tag_ptr(ret_conv, true);
61935 }
61936
61937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61938         LDKP2PGossipSync this_obj_conv;
61939         this_obj_conv.inner = untag_ptr(this_obj);
61940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61942         P2PGossipSync_free(this_obj_conv);
61943 }
61944
61945 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) {
61946         LDKNetworkGraph network_graph_conv;
61947         network_graph_conv.inner = untag_ptr(network_graph);
61948         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61949         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61950         network_graph_conv.is_owned = false;
61951         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61952         CHECK_ACCESS(utxo_lookup_ptr);
61953         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61954         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61955         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61956                 // Manually implement clone for Java trait instances
61957                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61958                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61959                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61960                 }
61961         }
61962         void* logger_ptr = untag_ptr(logger);
61963         CHECK_ACCESS(logger_ptr);
61964         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61965         if (logger_conv.free == LDKLogger_JCalls_free) {
61966                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61967                 LDKLogger_JCalls_cloned(&logger_conv);
61968         }
61969         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
61970         int64_t ret_ref = 0;
61971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61973         return ret_ref;
61974 }
61975
61976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
61977         LDKP2PGossipSync this_arg_conv;
61978         this_arg_conv.inner = untag_ptr(this_arg);
61979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61981         this_arg_conv.is_owned = false;
61982         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
61983         CHECK_ACCESS(utxo_lookup_ptr);
61984         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
61985         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
61986         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
61987                 // Manually implement clone for Java trait instances
61988                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
61989                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61990                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
61991                 }
61992         }
61993         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
61994 }
61995
61996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
61997         LDKNetworkGraph this_arg_conv;
61998         this_arg_conv.inner = untag_ptr(this_arg);
61999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62001         this_arg_conv.is_owned = false;
62002         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
62003         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
62004 }
62005
62006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
62007         LDKNetworkGraph this_arg_conv;
62008         this_arg_conv.inner = untag_ptr(this_arg);
62009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62011         this_arg_conv.is_owned = false;
62012         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62013         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_chain_hash(&this_arg_conv).data);
62014         return ret_arr;
62015 }
62016
62017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
62018         LDKNodeAnnouncement msg_conv;
62019         msg_conv.inner = untag_ptr(msg);
62020         msg_conv.is_owned = ptr_is_owned(msg);
62021         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62022         msg_conv.is_owned = false;
62023         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62024         *ret_conv = verify_node_announcement(&msg_conv);
62025         return tag_ptr(ret_conv, true);
62026 }
62027
62028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
62029         LDKChannelAnnouncement msg_conv;
62030         msg_conv.inner = untag_ptr(msg);
62031         msg_conv.is_owned = ptr_is_owned(msg);
62032         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62033         msg_conv.is_owned = false;
62034         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62035         *ret_conv = verify_channel_announcement(&msg_conv);
62036         return tag_ptr(ret_conv, true);
62037 }
62038
62039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
62040         LDKP2PGossipSync this_arg_conv;
62041         this_arg_conv.inner = untag_ptr(this_arg);
62042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62044         this_arg_conv.is_owned = false;
62045         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
62046         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
62047         return tag_ptr(ret_ret, true);
62048 }
62049
62050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
62051         LDKP2PGossipSync this_arg_conv;
62052         this_arg_conv.inner = untag_ptr(this_arg);
62053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62055         this_arg_conv.is_owned = false;
62056         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
62057         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
62058         return tag_ptr(ret_ret, true);
62059 }
62060
62061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62062         LDKChannelUpdateInfo this_obj_conv;
62063         this_obj_conv.inner = untag_ptr(this_obj);
62064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62066         ChannelUpdateInfo_free(this_obj_conv);
62067 }
62068
62069 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
62070         LDKChannelUpdateInfo this_ptr_conv;
62071         this_ptr_conv.inner = untag_ptr(this_ptr);
62072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62074         this_ptr_conv.is_owned = false;
62075         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
62076         return ret_conv;
62077 }
62078
62079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62080         LDKChannelUpdateInfo this_ptr_conv;
62081         this_ptr_conv.inner = untag_ptr(this_ptr);
62082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62084         this_ptr_conv.is_owned = false;
62085         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
62086 }
62087
62088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
62089         LDKChannelUpdateInfo this_ptr_conv;
62090         this_ptr_conv.inner = untag_ptr(this_ptr);
62091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62093         this_ptr_conv.is_owned = false;
62094         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
62095         return ret_conv;
62096 }
62097
62098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
62099         LDKChannelUpdateInfo 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         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
62105 }
62106
62107 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
62108         LDKChannelUpdateInfo this_ptr_conv;
62109         this_ptr_conv.inner = untag_ptr(this_ptr);
62110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62112         this_ptr_conv.is_owned = false;
62113         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
62114         return ret_conv;
62115 }
62116
62117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
62118         LDKChannelUpdateInfo this_ptr_conv;
62119         this_ptr_conv.inner = untag_ptr(this_ptr);
62120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62122         this_ptr_conv.is_owned = false;
62123         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
62124 }
62125
62126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
62127         LDKChannelUpdateInfo this_ptr_conv;
62128         this_ptr_conv.inner = untag_ptr(this_ptr);
62129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62131         this_ptr_conv.is_owned = false;
62132         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
62133         return ret_conv;
62134 }
62135
62136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62137         LDKChannelUpdateInfo this_ptr_conv;
62138         this_ptr_conv.inner = untag_ptr(this_ptr);
62139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62141         this_ptr_conv.is_owned = false;
62142         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
62143 }
62144
62145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
62146         LDKChannelUpdateInfo this_ptr_conv;
62147         this_ptr_conv.inner = untag_ptr(this_ptr);
62148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62150         this_ptr_conv.is_owned = false;
62151         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
62152         return ret_conv;
62153 }
62154
62155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62156         LDKChannelUpdateInfo this_ptr_conv;
62157         this_ptr_conv.inner = untag_ptr(this_ptr);
62158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62160         this_ptr_conv.is_owned = false;
62161         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
62162 }
62163
62164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
62165         LDKChannelUpdateInfo this_ptr_conv;
62166         this_ptr_conv.inner = untag_ptr(this_ptr);
62167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62169         this_ptr_conv.is_owned = false;
62170         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
62171         int64_t ret_ref = 0;
62172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62174         return ret_ref;
62175 }
62176
62177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62178         LDKChannelUpdateInfo this_ptr_conv;
62179         this_ptr_conv.inner = untag_ptr(this_ptr);
62180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62182         this_ptr_conv.is_owned = false;
62183         LDKRoutingFees val_conv;
62184         val_conv.inner = untag_ptr(val);
62185         val_conv.is_owned = ptr_is_owned(val);
62186         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62187         val_conv = RoutingFees_clone(&val_conv);
62188         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
62189 }
62190
62191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
62192         LDKChannelUpdateInfo this_ptr_conv;
62193         this_ptr_conv.inner = untag_ptr(this_ptr);
62194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62196         this_ptr_conv.is_owned = false;
62197         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
62198         int64_t ret_ref = 0;
62199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62201         return ret_ref;
62202 }
62203
62204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62205         LDKChannelUpdateInfo this_ptr_conv;
62206         this_ptr_conv.inner = untag_ptr(this_ptr);
62207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62209         this_ptr_conv.is_owned = false;
62210         LDKChannelUpdate val_conv;
62211         val_conv.inner = untag_ptr(val);
62212         val_conv.is_owned = ptr_is_owned(val);
62213         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62214         val_conv = ChannelUpdate_clone(&val_conv);
62215         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
62216 }
62217
62218 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) {
62219         LDKRoutingFees fees_arg_conv;
62220         fees_arg_conv.inner = untag_ptr(fees_arg);
62221         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
62222         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
62223         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
62224         LDKChannelUpdate last_update_message_arg_conv;
62225         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
62226         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
62227         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
62228         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
62229         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);
62230         int64_t ret_ref = 0;
62231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62233         return ret_ref;
62234 }
62235
62236 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
62237         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
62238         int64_t ret_ref = 0;
62239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62241         return ret_ref;
62242 }
62243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62244         LDKChannelUpdateInfo arg_conv;
62245         arg_conv.inner = untag_ptr(arg);
62246         arg_conv.is_owned = ptr_is_owned(arg);
62247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62248         arg_conv.is_owned = false;
62249         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
62250         return ret_conv;
62251 }
62252
62253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62254         LDKChannelUpdateInfo orig_conv;
62255         orig_conv.inner = untag_ptr(orig);
62256         orig_conv.is_owned = ptr_is_owned(orig);
62257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62258         orig_conv.is_owned = false;
62259         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
62260         int64_t ret_ref = 0;
62261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62263         return ret_ref;
62264 }
62265
62266 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62267         LDKChannelUpdateInfo a_conv;
62268         a_conv.inner = untag_ptr(a);
62269         a_conv.is_owned = ptr_is_owned(a);
62270         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62271         a_conv.is_owned = false;
62272         LDKChannelUpdateInfo b_conv;
62273         b_conv.inner = untag_ptr(b);
62274         b_conv.is_owned = ptr_is_owned(b);
62275         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62276         b_conv.is_owned = false;
62277         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
62278         return ret_conv;
62279 }
62280
62281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
62282         LDKChannelUpdateInfo obj_conv;
62283         obj_conv.inner = untag_ptr(obj);
62284         obj_conv.is_owned = ptr_is_owned(obj);
62285         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62286         obj_conv.is_owned = false;
62287         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
62288         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62289         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62290         CVec_u8Z_free(ret_var);
62291         return ret_arr;
62292 }
62293
62294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62295         LDKu8slice ser_ref;
62296         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62297         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62298         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
62299         *ret_conv = ChannelUpdateInfo_read(ser_ref);
62300         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62301         return tag_ptr(ret_conv, true);
62302 }
62303
62304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62305         LDKChannelInfo this_obj_conv;
62306         this_obj_conv.inner = untag_ptr(this_obj);
62307         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62309         ChannelInfo_free(this_obj_conv);
62310 }
62311
62312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
62313         LDKChannelInfo this_ptr_conv;
62314         this_ptr_conv.inner = untag_ptr(this_ptr);
62315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62317         this_ptr_conv.is_owned = false;
62318         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
62319         int64_t ret_ref = 0;
62320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62322         return ret_ref;
62323 }
62324
62325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62326         LDKChannelInfo this_ptr_conv;
62327         this_ptr_conv.inner = untag_ptr(this_ptr);
62328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62330         this_ptr_conv.is_owned = false;
62331         LDKChannelFeatures val_conv;
62332         val_conv.inner = untag_ptr(val);
62333         val_conv.is_owned = ptr_is_owned(val);
62334         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62335         val_conv = ChannelFeatures_clone(&val_conv);
62336         ChannelInfo_set_features(&this_ptr_conv, val_conv);
62337 }
62338
62339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
62340         LDKChannelInfo this_ptr_conv;
62341         this_ptr_conv.inner = untag_ptr(this_ptr);
62342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62344         this_ptr_conv.is_owned = false;
62345         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
62346         int64_t ret_ref = 0;
62347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62349         return ret_ref;
62350 }
62351
62352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62353         LDKChannelInfo this_ptr_conv;
62354         this_ptr_conv.inner = untag_ptr(this_ptr);
62355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62357         this_ptr_conv.is_owned = false;
62358         LDKNodeId val_conv;
62359         val_conv.inner = untag_ptr(val);
62360         val_conv.is_owned = ptr_is_owned(val);
62361         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62362         val_conv = NodeId_clone(&val_conv);
62363         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
62364 }
62365
62366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
62367         LDKChannelInfo this_ptr_conv;
62368         this_ptr_conv.inner = untag_ptr(this_ptr);
62369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62371         this_ptr_conv.is_owned = false;
62372         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
62373         int64_t ret_ref = 0;
62374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62376         return ret_ref;
62377 }
62378
62379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62380         LDKChannelInfo this_ptr_conv;
62381         this_ptr_conv.inner = untag_ptr(this_ptr);
62382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62384         this_ptr_conv.is_owned = false;
62385         LDKChannelUpdateInfo val_conv;
62386         val_conv.inner = untag_ptr(val);
62387         val_conv.is_owned = ptr_is_owned(val);
62388         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62389         val_conv = ChannelUpdateInfo_clone(&val_conv);
62390         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
62391 }
62392
62393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
62394         LDKChannelInfo this_ptr_conv;
62395         this_ptr_conv.inner = untag_ptr(this_ptr);
62396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62398         this_ptr_conv.is_owned = false;
62399         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
62400         int64_t ret_ref = 0;
62401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62403         return ret_ref;
62404 }
62405
62406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62407         LDKChannelInfo this_ptr_conv;
62408         this_ptr_conv.inner = untag_ptr(this_ptr);
62409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62411         this_ptr_conv.is_owned = false;
62412         LDKNodeId val_conv;
62413         val_conv.inner = untag_ptr(val);
62414         val_conv.is_owned = ptr_is_owned(val);
62415         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62416         val_conv = NodeId_clone(&val_conv);
62417         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
62418 }
62419
62420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
62421         LDKChannelInfo this_ptr_conv;
62422         this_ptr_conv.inner = untag_ptr(this_ptr);
62423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62425         this_ptr_conv.is_owned = false;
62426         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
62427         int64_t ret_ref = 0;
62428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62430         return ret_ref;
62431 }
62432
62433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62434         LDKChannelInfo this_ptr_conv;
62435         this_ptr_conv.inner = untag_ptr(this_ptr);
62436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62438         this_ptr_conv.is_owned = false;
62439         LDKChannelUpdateInfo val_conv;
62440         val_conv.inner = untag_ptr(val);
62441         val_conv.is_owned = ptr_is_owned(val);
62442         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62443         val_conv = ChannelUpdateInfo_clone(&val_conv);
62444         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
62445 }
62446
62447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
62448         LDKChannelInfo this_ptr_conv;
62449         this_ptr_conv.inner = untag_ptr(this_ptr);
62450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62452         this_ptr_conv.is_owned = false;
62453         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
62454         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
62455         int64_t ret_ref = tag_ptr(ret_copy, true);
62456         return ret_ref;
62457 }
62458
62459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62460         LDKChannelInfo this_ptr_conv;
62461         this_ptr_conv.inner = untag_ptr(this_ptr);
62462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62464         this_ptr_conv.is_owned = false;
62465         void* val_ptr = untag_ptr(val);
62466         CHECK_ACCESS(val_ptr);
62467         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
62468         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
62469         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
62470 }
62471
62472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
62473         LDKChannelInfo this_ptr_conv;
62474         this_ptr_conv.inner = untag_ptr(this_ptr);
62475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62477         this_ptr_conv.is_owned = false;
62478         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
62479         int64_t ret_ref = 0;
62480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62482         return ret_ref;
62483 }
62484
62485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62486         LDKChannelInfo this_ptr_conv;
62487         this_ptr_conv.inner = untag_ptr(this_ptr);
62488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62490         this_ptr_conv.is_owned = false;
62491         LDKChannelAnnouncement val_conv;
62492         val_conv.inner = untag_ptr(val);
62493         val_conv.is_owned = ptr_is_owned(val);
62494         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62495         val_conv = ChannelAnnouncement_clone(&val_conv);
62496         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
62497 }
62498
62499 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
62500         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
62501         int64_t ret_ref = 0;
62502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62504         return ret_ref;
62505 }
62506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62507         LDKChannelInfo arg_conv;
62508         arg_conv.inner = untag_ptr(arg);
62509         arg_conv.is_owned = ptr_is_owned(arg);
62510         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62511         arg_conv.is_owned = false;
62512         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
62513         return ret_conv;
62514 }
62515
62516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62517         LDKChannelInfo orig_conv;
62518         orig_conv.inner = untag_ptr(orig);
62519         orig_conv.is_owned = ptr_is_owned(orig);
62520         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62521         orig_conv.is_owned = false;
62522         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
62523         int64_t ret_ref = 0;
62524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62526         return ret_ref;
62527 }
62528
62529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62530         LDKChannelInfo a_conv;
62531         a_conv.inner = untag_ptr(a);
62532         a_conv.is_owned = ptr_is_owned(a);
62533         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62534         a_conv.is_owned = false;
62535         LDKChannelInfo b_conv;
62536         b_conv.inner = untag_ptr(b);
62537         b_conv.is_owned = ptr_is_owned(b);
62538         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62539         b_conv.is_owned = false;
62540         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
62541         return ret_conv;
62542 }
62543
62544 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) {
62545         LDKChannelInfo this_arg_conv;
62546         this_arg_conv.inner = untag_ptr(this_arg);
62547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62549         this_arg_conv.is_owned = false;
62550         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
62551         int64_t ret_ref = 0;
62552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62554         return ret_ref;
62555 }
62556
62557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
62558         LDKChannelInfo obj_conv;
62559         obj_conv.inner = untag_ptr(obj);
62560         obj_conv.is_owned = ptr_is_owned(obj);
62561         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62562         obj_conv.is_owned = false;
62563         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
62564         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62565         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62566         CVec_u8Z_free(ret_var);
62567         return ret_arr;
62568 }
62569
62570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62571         LDKu8slice ser_ref;
62572         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62573         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62574         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
62575         *ret_conv = ChannelInfo_read(ser_ref);
62576         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62577         return tag_ptr(ret_conv, true);
62578 }
62579
62580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62581         LDKDirectedChannelInfo this_obj_conv;
62582         this_obj_conv.inner = untag_ptr(this_obj);
62583         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62585         DirectedChannelInfo_free(this_obj_conv);
62586 }
62587
62588 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
62589         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
62590         int64_t ret_ref = 0;
62591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62593         return ret_ref;
62594 }
62595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62596         LDKDirectedChannelInfo arg_conv;
62597         arg_conv.inner = untag_ptr(arg);
62598         arg_conv.is_owned = ptr_is_owned(arg);
62599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62600         arg_conv.is_owned = false;
62601         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
62602         return ret_conv;
62603 }
62604
62605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62606         LDKDirectedChannelInfo orig_conv;
62607         orig_conv.inner = untag_ptr(orig);
62608         orig_conv.is_owned = ptr_is_owned(orig);
62609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62610         orig_conv.is_owned = false;
62611         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
62612         int64_t ret_ref = 0;
62613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62615         return ret_ref;
62616 }
62617
62618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
62619         LDKDirectedChannelInfo this_arg_conv;
62620         this_arg_conv.inner = untag_ptr(this_arg);
62621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62623         this_arg_conv.is_owned = false;
62624         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
62625         int64_t ret_ref = 0;
62626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62628         return ret_ref;
62629 }
62630
62631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
62632         LDKDirectedChannelInfo this_arg_conv;
62633         this_arg_conv.inner = untag_ptr(this_arg);
62634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62636         this_arg_conv.is_owned = false;
62637         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
62638         return ret_conv;
62639 }
62640
62641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
62642         LDKDirectedChannelInfo this_arg_conv;
62643         this_arg_conv.inner = untag_ptr(this_arg);
62644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62646         this_arg_conv.is_owned = false;
62647         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62648         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
62649         int64_t ret_ref = tag_ptr(ret_copy, true);
62650         return ret_ref;
62651 }
62652
62653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62654         if (!ptr_is_owned(this_ptr)) return;
62655         void* this_ptr_ptr = untag_ptr(this_ptr);
62656         CHECK_ACCESS(this_ptr_ptr);
62657         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
62658         FREE(untag_ptr(this_ptr));
62659         EffectiveCapacity_free(this_ptr_conv);
62660 }
62661
62662 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
62663         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62664         *ret_copy = EffectiveCapacity_clone(arg);
62665         int64_t ret_ref = tag_ptr(ret_copy, true);
62666         return ret_ref;
62667 }
62668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62669         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
62670         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
62671         return ret_conv;
62672 }
62673
62674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62675         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
62676         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62677         *ret_copy = EffectiveCapacity_clone(orig_conv);
62678         int64_t ret_ref = tag_ptr(ret_copy, true);
62679         return ret_ref;
62680 }
62681
62682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
62683         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62684         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
62685         int64_t ret_ref = tag_ptr(ret_copy, true);
62686         return ret_ref;
62687 }
62688
62689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
62690         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62691         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
62692         int64_t ret_ref = tag_ptr(ret_copy, true);
62693         return ret_ref;
62694 }
62695
62696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
62697         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62698         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
62699         int64_t ret_ref = tag_ptr(ret_copy, true);
62700         return ret_ref;
62701 }
62702
62703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
62704         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62705         *ret_copy = EffectiveCapacity_infinite();
62706         int64_t ret_ref = tag_ptr(ret_copy, true);
62707         return ret_ref;
62708 }
62709
62710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
62711         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62712         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
62713         int64_t ret_ref = tag_ptr(ret_copy, true);
62714         return ret_ref;
62715 }
62716
62717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
62718         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
62719         *ret_copy = EffectiveCapacity_unknown();
62720         int64_t ret_ref = tag_ptr(ret_copy, true);
62721         return ret_ref;
62722 }
62723
62724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
62725         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
62726         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
62727         return ret_conv;
62728 }
62729
62730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62731         LDKRoutingFees this_obj_conv;
62732         this_obj_conv.inner = untag_ptr(this_obj);
62733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62735         RoutingFees_free(this_obj_conv);
62736 }
62737
62738 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
62739         LDKRoutingFees this_ptr_conv;
62740         this_ptr_conv.inner = untag_ptr(this_ptr);
62741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62743         this_ptr_conv.is_owned = false;
62744         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
62745         return ret_conv;
62746 }
62747
62748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62749         LDKRoutingFees this_ptr_conv;
62750         this_ptr_conv.inner = untag_ptr(this_ptr);
62751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62753         this_ptr_conv.is_owned = false;
62754         RoutingFees_set_base_msat(&this_ptr_conv, val);
62755 }
62756
62757 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
62758         LDKRoutingFees this_ptr_conv;
62759         this_ptr_conv.inner = untag_ptr(this_ptr);
62760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62762         this_ptr_conv.is_owned = false;
62763         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
62764         return ret_conv;
62765 }
62766
62767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62768         LDKRoutingFees this_ptr_conv;
62769         this_ptr_conv.inner = untag_ptr(this_ptr);
62770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62772         this_ptr_conv.is_owned = false;
62773         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
62774 }
62775
62776 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) {
62777         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
62778         int64_t ret_ref = 0;
62779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62781         return ret_ref;
62782 }
62783
62784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62785         LDKRoutingFees a_conv;
62786         a_conv.inner = untag_ptr(a);
62787         a_conv.is_owned = ptr_is_owned(a);
62788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62789         a_conv.is_owned = false;
62790         LDKRoutingFees b_conv;
62791         b_conv.inner = untag_ptr(b);
62792         b_conv.is_owned = ptr_is_owned(b);
62793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62794         b_conv.is_owned = false;
62795         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
62796         return ret_conv;
62797 }
62798
62799 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
62800         LDKRoutingFees ret_var = RoutingFees_clone(arg);
62801         int64_t ret_ref = 0;
62802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62804         return ret_ref;
62805 }
62806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62807         LDKRoutingFees arg_conv;
62808         arg_conv.inner = untag_ptr(arg);
62809         arg_conv.is_owned = ptr_is_owned(arg);
62810         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62811         arg_conv.is_owned = false;
62812         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
62813         return ret_conv;
62814 }
62815
62816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62817         LDKRoutingFees orig_conv;
62818         orig_conv.inner = untag_ptr(orig);
62819         orig_conv.is_owned = ptr_is_owned(orig);
62820         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62821         orig_conv.is_owned = false;
62822         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
62823         int64_t ret_ref = 0;
62824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62826         return ret_ref;
62827 }
62828
62829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
62830         LDKRoutingFees o_conv;
62831         o_conv.inner = untag_ptr(o);
62832         o_conv.is_owned = ptr_is_owned(o);
62833         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62834         o_conv.is_owned = false;
62835         int64_t ret_conv = RoutingFees_hash(&o_conv);
62836         return ret_conv;
62837 }
62838
62839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
62840         LDKRoutingFees obj_conv;
62841         obj_conv.inner = untag_ptr(obj);
62842         obj_conv.is_owned = ptr_is_owned(obj);
62843         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62844         obj_conv.is_owned = false;
62845         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
62846         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62847         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62848         CVec_u8Z_free(ret_var);
62849         return ret_arr;
62850 }
62851
62852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62853         LDKu8slice ser_ref;
62854         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62855         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62856         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
62857         *ret_conv = RoutingFees_read(ser_ref);
62858         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62859         return tag_ptr(ret_conv, true);
62860 }
62861
62862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62863         LDKNodeAnnouncementInfo this_obj_conv;
62864         this_obj_conv.inner = untag_ptr(this_obj);
62865         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62867         NodeAnnouncementInfo_free(this_obj_conv);
62868 }
62869
62870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
62871         LDKNodeAnnouncementInfo this_ptr_conv;
62872         this_ptr_conv.inner = untag_ptr(this_ptr);
62873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62875         this_ptr_conv.is_owned = false;
62876         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
62877         int64_t ret_ref = 0;
62878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62880         return ret_ref;
62881 }
62882
62883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62884         LDKNodeAnnouncementInfo this_ptr_conv;
62885         this_ptr_conv.inner = untag_ptr(this_ptr);
62886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62888         this_ptr_conv.is_owned = false;
62889         LDKNodeFeatures val_conv;
62890         val_conv.inner = untag_ptr(val);
62891         val_conv.is_owned = ptr_is_owned(val);
62892         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62893         val_conv = NodeFeatures_clone(&val_conv);
62894         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
62895 }
62896
62897 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
62898         LDKNodeAnnouncementInfo this_ptr_conv;
62899         this_ptr_conv.inner = untag_ptr(this_ptr);
62900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62902         this_ptr_conv.is_owned = false;
62903         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
62904         return ret_conv;
62905 }
62906
62907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
62908         LDKNodeAnnouncementInfo this_ptr_conv;
62909         this_ptr_conv.inner = untag_ptr(this_ptr);
62910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62912         this_ptr_conv.is_owned = false;
62913         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
62914 }
62915
62916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
62917         LDKNodeAnnouncementInfo this_ptr_conv;
62918         this_ptr_conv.inner = untag_ptr(this_ptr);
62919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62921         this_ptr_conv.is_owned = false;
62922         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
62923         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
62924         return ret_arr;
62925 }
62926
62927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62928         LDKNodeAnnouncementInfo this_ptr_conv;
62929         this_ptr_conv.inner = untag_ptr(this_ptr);
62930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62932         this_ptr_conv.is_owned = false;
62933         LDKThreeBytes val_ref;
62934         CHECK((*env)->GetArrayLength(env, val) == 3);
62935         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
62936         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
62937 }
62938
62939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
62940         LDKNodeAnnouncementInfo this_ptr_conv;
62941         this_ptr_conv.inner = untag_ptr(this_ptr);
62942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62944         this_ptr_conv.is_owned = false;
62945         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
62946         int64_t ret_ref = 0;
62947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62949         return ret_ref;
62950 }
62951
62952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62953         LDKNodeAnnouncementInfo this_ptr_conv;
62954         this_ptr_conv.inner = untag_ptr(this_ptr);
62955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62957         this_ptr_conv.is_owned = false;
62958         LDKNodeAlias val_conv;
62959         val_conv.inner = untag_ptr(val);
62960         val_conv.is_owned = ptr_is_owned(val);
62961         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62962         val_conv = NodeAlias_clone(&val_conv);
62963         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
62964 }
62965
62966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
62967         LDKNodeAnnouncementInfo this_ptr_conv;
62968         this_ptr_conv.inner = untag_ptr(this_ptr);
62969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62971         this_ptr_conv.is_owned = false;
62972         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
62973         int64_t ret_ref = 0;
62974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62976         return ret_ref;
62977 }
62978
62979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62980         LDKNodeAnnouncementInfo this_ptr_conv;
62981         this_ptr_conv.inner = untag_ptr(this_ptr);
62982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62984         this_ptr_conv.is_owned = false;
62985         LDKNodeAnnouncement val_conv;
62986         val_conv.inner = untag_ptr(val);
62987         val_conv.is_owned = ptr_is_owned(val);
62988         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62989         val_conv = NodeAnnouncement_clone(&val_conv);
62990         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
62991 }
62992
62993 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) {
62994         LDKNodeFeatures features_arg_conv;
62995         features_arg_conv.inner = untag_ptr(features_arg);
62996         features_arg_conv.is_owned = ptr_is_owned(features_arg);
62997         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
62998         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
62999         LDKThreeBytes rgb_arg_ref;
63000         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
63001         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
63002         LDKNodeAlias alias_arg_conv;
63003         alias_arg_conv.inner = untag_ptr(alias_arg);
63004         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
63005         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
63006         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
63007         LDKNodeAnnouncement announcement_message_arg_conv;
63008         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
63009         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
63010         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
63011         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
63012         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
63013         int64_t ret_ref = 0;
63014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63016         return ret_ref;
63017 }
63018
63019 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
63020         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
63021         int64_t ret_ref = 0;
63022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63024         return ret_ref;
63025 }
63026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63027         LDKNodeAnnouncementInfo arg_conv;
63028         arg_conv.inner = untag_ptr(arg);
63029         arg_conv.is_owned = ptr_is_owned(arg);
63030         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63031         arg_conv.is_owned = false;
63032         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
63033         return ret_conv;
63034 }
63035
63036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63037         LDKNodeAnnouncementInfo orig_conv;
63038         orig_conv.inner = untag_ptr(orig);
63039         orig_conv.is_owned = ptr_is_owned(orig);
63040         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63041         orig_conv.is_owned = false;
63042         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
63043         int64_t ret_ref = 0;
63044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63046         return ret_ref;
63047 }
63048
63049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63050         LDKNodeAnnouncementInfo a_conv;
63051         a_conv.inner = untag_ptr(a);
63052         a_conv.is_owned = ptr_is_owned(a);
63053         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63054         a_conv.is_owned = false;
63055         LDKNodeAnnouncementInfo b_conv;
63056         b_conv.inner = untag_ptr(b);
63057         b_conv.is_owned = ptr_is_owned(b);
63058         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63059         b_conv.is_owned = false;
63060         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
63061         return ret_conv;
63062 }
63063
63064 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
63065         LDKNodeAnnouncementInfo this_arg_conv;
63066         this_arg_conv.inner = untag_ptr(this_arg);
63067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63069         this_arg_conv.is_owned = false;
63070         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
63071         int64_tArray ret_arr = NULL;
63072         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63073         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63074         for (size_t p = 0; p < ret_var.datalen; p++) {
63075                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
63076                 *ret_conv_15_copy = ret_var.data[p];
63077                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
63078                 ret_arr_ptr[p] = ret_conv_15_ref;
63079         }
63080         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63081         FREE(ret_var.data);
63082         return ret_arr;
63083 }
63084
63085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
63086         LDKNodeAnnouncementInfo obj_conv;
63087         obj_conv.inner = untag_ptr(obj);
63088         obj_conv.is_owned = ptr_is_owned(obj);
63089         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63090         obj_conv.is_owned = false;
63091         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
63092         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63093         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63094         CVec_u8Z_free(ret_var);
63095         return ret_arr;
63096 }
63097
63098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63099         LDKu8slice ser_ref;
63100         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63101         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63102         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
63103         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
63104         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63105         return tag_ptr(ret_conv, true);
63106 }
63107
63108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63109         LDKNodeAlias this_obj_conv;
63110         this_obj_conv.inner = untag_ptr(this_obj);
63111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63113         NodeAlias_free(this_obj_conv);
63114 }
63115
63116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
63117         LDKNodeAlias this_ptr_conv;
63118         this_ptr_conv.inner = untag_ptr(this_ptr);
63119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63121         this_ptr_conv.is_owned = false;
63122         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63123         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
63124         return ret_arr;
63125 }
63126
63127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63128         LDKNodeAlias this_ptr_conv;
63129         this_ptr_conv.inner = untag_ptr(this_ptr);
63130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63132         this_ptr_conv.is_owned = false;
63133         LDKThirtyTwoBytes val_ref;
63134         CHECK((*env)->GetArrayLength(env, val) == 32);
63135         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
63136         NodeAlias_set_a(&this_ptr_conv, val_ref);
63137 }
63138
63139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
63140         LDKThirtyTwoBytes a_arg_ref;
63141         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
63142         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
63143         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
63144         int64_t ret_ref = 0;
63145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63147         return ret_ref;
63148 }
63149
63150 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
63151         LDKNodeAlias ret_var = NodeAlias_clone(arg);
63152         int64_t ret_ref = 0;
63153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63155         return ret_ref;
63156 }
63157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63158         LDKNodeAlias arg_conv;
63159         arg_conv.inner = untag_ptr(arg);
63160         arg_conv.is_owned = ptr_is_owned(arg);
63161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63162         arg_conv.is_owned = false;
63163         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
63164         return ret_conv;
63165 }
63166
63167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63168         LDKNodeAlias orig_conv;
63169         orig_conv.inner = untag_ptr(orig);
63170         orig_conv.is_owned = ptr_is_owned(orig);
63171         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63172         orig_conv.is_owned = false;
63173         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
63174         int64_t ret_ref = 0;
63175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63177         return ret_ref;
63178 }
63179
63180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63181         LDKNodeAlias a_conv;
63182         a_conv.inner = untag_ptr(a);
63183         a_conv.is_owned = ptr_is_owned(a);
63184         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63185         a_conv.is_owned = false;
63186         LDKNodeAlias b_conv;
63187         b_conv.inner = untag_ptr(b);
63188         b_conv.is_owned = ptr_is_owned(b);
63189         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63190         b_conv.is_owned = false;
63191         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
63192         return ret_conv;
63193 }
63194
63195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
63196         LDKNodeAlias obj_conv;
63197         obj_conv.inner = untag_ptr(obj);
63198         obj_conv.is_owned = ptr_is_owned(obj);
63199         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63200         obj_conv.is_owned = false;
63201         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
63202         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63203         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63204         CVec_u8Z_free(ret_var);
63205         return ret_arr;
63206 }
63207
63208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63209         LDKu8slice ser_ref;
63210         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63211         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63212         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
63213         *ret_conv = NodeAlias_read(ser_ref);
63214         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63215         return tag_ptr(ret_conv, true);
63216 }
63217
63218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63219         LDKNodeInfo this_obj_conv;
63220         this_obj_conv.inner = untag_ptr(this_obj);
63221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63223         NodeInfo_free(this_obj_conv);
63224 }
63225
63226 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
63227         LDKNodeInfo this_ptr_conv;
63228         this_ptr_conv.inner = untag_ptr(this_ptr);
63229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63231         this_ptr_conv.is_owned = false;
63232         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
63233         int64_tArray ret_arr = NULL;
63234         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63235         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63236         for (size_t g = 0; g < ret_var.datalen; g++) {
63237                 int64_t ret_conv_6_conv = ret_var.data[g];
63238                 ret_arr_ptr[g] = ret_conv_6_conv;
63239         }
63240         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63241         FREE(ret_var.data);
63242         return ret_arr;
63243 }
63244
63245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
63246         LDKNodeInfo this_ptr_conv;
63247         this_ptr_conv.inner = untag_ptr(this_ptr);
63248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63250         this_ptr_conv.is_owned = false;
63251         LDKCVec_u64Z val_constr;
63252         val_constr.datalen = (*env)->GetArrayLength(env, val);
63253         if (val_constr.datalen > 0)
63254                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63255         else
63256                 val_constr.data = NULL;
63257         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
63258         for (size_t g = 0; g < val_constr.datalen; g++) {
63259                 int64_t val_conv_6 = val_vals[g];
63260                 val_constr.data[g] = val_conv_6;
63261         }
63262         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
63263         NodeInfo_set_channels(&this_ptr_conv, val_constr);
63264 }
63265
63266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
63267         LDKNodeInfo this_ptr_conv;
63268         this_ptr_conv.inner = untag_ptr(this_ptr);
63269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63271         this_ptr_conv.is_owned = false;
63272         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
63273         int64_t ret_ref = 0;
63274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63276         return ret_ref;
63277 }
63278
63279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63280         LDKNodeInfo this_ptr_conv;
63281         this_ptr_conv.inner = untag_ptr(this_ptr);
63282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63284         this_ptr_conv.is_owned = false;
63285         LDKNodeAnnouncementInfo val_conv;
63286         val_conv.inner = untag_ptr(val);
63287         val_conv.is_owned = ptr_is_owned(val);
63288         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63289         val_conv = NodeAnnouncementInfo_clone(&val_conv);
63290         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
63291 }
63292
63293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
63294         LDKCVec_u64Z channels_arg_constr;
63295         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
63296         if (channels_arg_constr.datalen > 0)
63297                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63298         else
63299                 channels_arg_constr.data = NULL;
63300         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
63301         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
63302                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
63303                 channels_arg_constr.data[g] = channels_arg_conv_6;
63304         }
63305         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
63306         LDKNodeAnnouncementInfo announcement_info_arg_conv;
63307         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
63308         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
63309         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
63310         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
63311         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
63312         int64_t ret_ref = 0;
63313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63315         return ret_ref;
63316 }
63317
63318 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
63319         LDKNodeInfo ret_var = NodeInfo_clone(arg);
63320         int64_t ret_ref = 0;
63321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63323         return ret_ref;
63324 }
63325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63326         LDKNodeInfo arg_conv;
63327         arg_conv.inner = untag_ptr(arg);
63328         arg_conv.is_owned = ptr_is_owned(arg);
63329         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63330         arg_conv.is_owned = false;
63331         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
63332         return ret_conv;
63333 }
63334
63335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63336         LDKNodeInfo orig_conv;
63337         orig_conv.inner = untag_ptr(orig);
63338         orig_conv.is_owned = ptr_is_owned(orig);
63339         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63340         orig_conv.is_owned = false;
63341         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
63342         int64_t ret_ref = 0;
63343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63345         return ret_ref;
63346 }
63347
63348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63349         LDKNodeInfo a_conv;
63350         a_conv.inner = untag_ptr(a);
63351         a_conv.is_owned = ptr_is_owned(a);
63352         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63353         a_conv.is_owned = false;
63354         LDKNodeInfo b_conv;
63355         b_conv.inner = untag_ptr(b);
63356         b_conv.is_owned = ptr_is_owned(b);
63357         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63358         b_conv.is_owned = false;
63359         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
63360         return ret_conv;
63361 }
63362
63363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
63364         LDKNodeInfo obj_conv;
63365         obj_conv.inner = untag_ptr(obj);
63366         obj_conv.is_owned = ptr_is_owned(obj);
63367         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63368         obj_conv.is_owned = false;
63369         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
63370         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63371         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63372         CVec_u8Z_free(ret_var);
63373         return ret_arr;
63374 }
63375
63376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63377         LDKu8slice ser_ref;
63378         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63379         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63380         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
63381         *ret_conv = NodeInfo_read(ser_ref);
63382         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63383         return tag_ptr(ret_conv, true);
63384 }
63385
63386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
63387         LDKNetworkGraph obj_conv;
63388         obj_conv.inner = untag_ptr(obj);
63389         obj_conv.is_owned = ptr_is_owned(obj);
63390         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63391         obj_conv.is_owned = false;
63392         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
63393         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63394         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63395         CVec_u8Z_free(ret_var);
63396         return ret_arr;
63397 }
63398
63399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
63400         LDKu8slice ser_ref;
63401         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63402         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63403         void* arg_ptr = untag_ptr(arg);
63404         CHECK_ACCESS(arg_ptr);
63405         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
63406         if (arg_conv.free == LDKLogger_JCalls_free) {
63407                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63408                 LDKLogger_JCalls_cloned(&arg_conv);
63409         }
63410         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
63411         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
63412         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63413         return tag_ptr(ret_conv, true);
63414 }
63415
63416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
63417         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
63418         void* logger_ptr = untag_ptr(logger);
63419         CHECK_ACCESS(logger_ptr);
63420         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63421         if (logger_conv.free == LDKLogger_JCalls_free) {
63422                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63423                 LDKLogger_JCalls_cloned(&logger_conv);
63424         }
63425         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
63426         int64_t ret_ref = 0;
63427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63429         return ret_ref;
63430 }
63431
63432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
63433         LDKNetworkGraph this_arg_conv;
63434         this_arg_conv.inner = untag_ptr(this_arg);
63435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63437         this_arg_conv.is_owned = false;
63438         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
63439         int64_t ret_ref = 0;
63440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63442         return ret_ref;
63443 }
63444
63445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
63446         LDKNetworkGraph this_arg_conv;
63447         this_arg_conv.inner = untag_ptr(this_arg);
63448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63450         this_arg_conv.is_owned = false;
63451         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63452         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
63453         int64_t ret_ref = tag_ptr(ret_copy, true);
63454         return ret_ref;
63455 }
63456
63457 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) {
63458         LDKNetworkGraph this_arg_conv;
63459         this_arg_conv.inner = untag_ptr(this_arg);
63460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63462         this_arg_conv.is_owned = false;
63463         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
63464 }
63465
63466 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) {
63467         LDKNetworkGraph this_arg_conv;
63468         this_arg_conv.inner = untag_ptr(this_arg);
63469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63471         this_arg_conv.is_owned = false;
63472         LDKNodeAnnouncement msg_conv;
63473         msg_conv.inner = untag_ptr(msg);
63474         msg_conv.is_owned = ptr_is_owned(msg);
63475         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63476         msg_conv.is_owned = false;
63477         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63478         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
63479         return tag_ptr(ret_conv, true);
63480 }
63481
63482 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) {
63483         LDKNetworkGraph this_arg_conv;
63484         this_arg_conv.inner = untag_ptr(this_arg);
63485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63487         this_arg_conv.is_owned = false;
63488         LDKUnsignedNodeAnnouncement msg_conv;
63489         msg_conv.inner = untag_ptr(msg);
63490         msg_conv.is_owned = ptr_is_owned(msg);
63491         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63492         msg_conv.is_owned = false;
63493         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63494         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
63495         return tag_ptr(ret_conv, true);
63496 }
63497
63498 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) {
63499         LDKNetworkGraph this_arg_conv;
63500         this_arg_conv.inner = untag_ptr(this_arg);
63501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63503         this_arg_conv.is_owned = false;
63504         LDKChannelAnnouncement msg_conv;
63505         msg_conv.inner = untag_ptr(msg);
63506         msg_conv.is_owned = ptr_is_owned(msg);
63507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63508         msg_conv.is_owned = false;
63509         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63510         CHECK_ACCESS(utxo_lookup_ptr);
63511         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63512         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63513         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63514                 // Manually implement clone for Java trait instances
63515                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63516                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63517                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63518                 }
63519         }
63520         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63521         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
63522         return tag_ptr(ret_conv, true);
63523 }
63524
63525 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) {
63526         LDKNetworkGraph this_arg_conv;
63527         this_arg_conv.inner = untag_ptr(this_arg);
63528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63530         this_arg_conv.is_owned = false;
63531         LDKChannelAnnouncement msg_conv;
63532         msg_conv.inner = untag_ptr(msg);
63533         msg_conv.is_owned = ptr_is_owned(msg);
63534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63535         msg_conv.is_owned = false;
63536         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63537         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
63538         return tag_ptr(ret_conv, true);
63539 }
63540
63541 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) {
63542         LDKNetworkGraph this_arg_conv;
63543         this_arg_conv.inner = untag_ptr(this_arg);
63544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63546         this_arg_conv.is_owned = false;
63547         LDKUnsignedChannelAnnouncement msg_conv;
63548         msg_conv.inner = untag_ptr(msg);
63549         msg_conv.is_owned = ptr_is_owned(msg);
63550         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63551         msg_conv.is_owned = false;
63552         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63553         CHECK_ACCESS(utxo_lookup_ptr);
63554         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63555         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63556         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63557                 // Manually implement clone for Java trait instances
63558                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63559                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63560                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63561                 }
63562         }
63563         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63564         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
63565         return tag_ptr(ret_conv, true);
63566 }
63567
63568 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) {
63569         LDKNetworkGraph this_arg_conv;
63570         this_arg_conv.inner = untag_ptr(this_arg);
63571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63573         this_arg_conv.is_owned = false;
63574         LDKChannelFeatures features_conv;
63575         features_conv.inner = untag_ptr(features);
63576         features_conv.is_owned = ptr_is_owned(features);
63577         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
63578         features_conv = ChannelFeatures_clone(&features_conv);
63579         LDKPublicKey node_id_1_ref;
63580         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
63581         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
63582         LDKPublicKey node_id_2_ref;
63583         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
63584         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
63585         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63586         *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);
63587         return tag_ptr(ret_conv, true);
63588 }
63589
63590 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) {
63591         LDKNetworkGraph this_arg_conv;
63592         this_arg_conv.inner = untag_ptr(this_arg);
63593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63595         this_arg_conv.is_owned = false;
63596         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
63597 }
63598
63599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
63600         LDKNetworkGraph this_arg_conv;
63601         this_arg_conv.inner = untag_ptr(this_arg);
63602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63604         this_arg_conv.is_owned = false;
63605         LDKPublicKey node_id_ref;
63606         CHECK((*env)->GetArrayLength(env, node_id) == 33);
63607         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
63608         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
63609 }
63610
63611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
63612         LDKNetworkGraph this_arg_conv;
63613         this_arg_conv.inner = untag_ptr(this_arg);
63614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63616         this_arg_conv.is_owned = false;
63617         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
63618 }
63619
63620 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) {
63621         LDKNetworkGraph this_arg_conv;
63622         this_arg_conv.inner = untag_ptr(this_arg);
63623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63625         this_arg_conv.is_owned = false;
63626         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
63627 }
63628
63629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
63630         LDKNetworkGraph this_arg_conv;
63631         this_arg_conv.inner = untag_ptr(this_arg);
63632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63634         this_arg_conv.is_owned = false;
63635         LDKChannelUpdate msg_conv;
63636         msg_conv.inner = untag_ptr(msg);
63637         msg_conv.is_owned = ptr_is_owned(msg);
63638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63639         msg_conv.is_owned = false;
63640         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63641         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
63642         return tag_ptr(ret_conv, true);
63643 }
63644
63645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
63646         LDKNetworkGraph this_arg_conv;
63647         this_arg_conv.inner = untag_ptr(this_arg);
63648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63650         this_arg_conv.is_owned = false;
63651         LDKUnsignedChannelUpdate msg_conv;
63652         msg_conv.inner = untag_ptr(msg);
63653         msg_conv.is_owned = ptr_is_owned(msg);
63654         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63655         msg_conv.is_owned = false;
63656         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63657         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
63658         return tag_ptr(ret_conv, true);
63659 }
63660
63661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
63662         LDKNetworkGraph this_arg_conv;
63663         this_arg_conv.inner = untag_ptr(this_arg);
63664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63666         this_arg_conv.is_owned = false;
63667         LDKChannelUpdate msg_conv;
63668         msg_conv.inner = untag_ptr(msg);
63669         msg_conv.is_owned = ptr_is_owned(msg);
63670         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63671         msg_conv.is_owned = false;
63672         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63673         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
63674         return tag_ptr(ret_conv, true);
63675 }
63676
63677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
63678         LDKReadOnlyNetworkGraph this_arg_conv;
63679         this_arg_conv.inner = untag_ptr(this_arg);
63680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63682         this_arg_conv.is_owned = false;
63683         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
63684         int64_t ret_ref = 0;
63685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63687         return ret_ref;
63688 }
63689
63690 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
63691         LDKReadOnlyNetworkGraph this_arg_conv;
63692         this_arg_conv.inner = untag_ptr(this_arg);
63693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63695         this_arg_conv.is_owned = false;
63696         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
63697         int64_tArray ret_arr = NULL;
63698         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63699         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63700         for (size_t g = 0; g < ret_var.datalen; g++) {
63701                 int64_t ret_conv_6_conv = ret_var.data[g];
63702                 ret_arr_ptr[g] = ret_conv_6_conv;
63703         }
63704         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63705         FREE(ret_var.data);
63706         return ret_arr;
63707 }
63708
63709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
63710         LDKReadOnlyNetworkGraph this_arg_conv;
63711         this_arg_conv.inner = untag_ptr(this_arg);
63712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63714         this_arg_conv.is_owned = false;
63715         LDKNodeId node_id_conv;
63716         node_id_conv.inner = untag_ptr(node_id);
63717         node_id_conv.is_owned = ptr_is_owned(node_id);
63718         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
63719         node_id_conv.is_owned = false;
63720         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
63721         int64_t ret_ref = 0;
63722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63724         return ret_ref;
63725 }
63726
63727 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
63728         LDKReadOnlyNetworkGraph this_arg_conv;
63729         this_arg_conv.inner = untag_ptr(this_arg);
63730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63732         this_arg_conv.is_owned = false;
63733         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
63734         int64_tArray ret_arr = NULL;
63735         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
63736         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
63737         for (size_t i = 0; i < ret_var.datalen; i++) {
63738                 LDKNodeId ret_conv_8_var = ret_var.data[i];
63739                 int64_t ret_conv_8_ref = 0;
63740                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
63741                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
63742                 ret_arr_ptr[i] = ret_conv_8_ref;
63743         }
63744         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
63745         FREE(ret_var.data);
63746         return ret_arr;
63747 }
63748
63749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
63750         LDKReadOnlyNetworkGraph this_arg_conv;
63751         this_arg_conv.inner = untag_ptr(this_arg);
63752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63754         this_arg_conv.is_owned = false;
63755         LDKPublicKey pubkey_ref;
63756         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
63757         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
63758         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
63759         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
63760         int64_t ret_ref = tag_ptr(ret_copy, true);
63761         return ret_ref;
63762 }
63763
63764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63765         LDKDefaultRouter this_obj_conv;
63766         this_obj_conv.inner = untag_ptr(this_obj);
63767         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63769         DefaultRouter_free(this_obj_conv);
63770 }
63771
63772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes, int64_t scorer, int64_t score_params) {
63773         LDKNetworkGraph network_graph_conv;
63774         network_graph_conv.inner = untag_ptr(network_graph);
63775         network_graph_conv.is_owned = ptr_is_owned(network_graph);
63776         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
63777         network_graph_conv.is_owned = false;
63778         void* logger_ptr = untag_ptr(logger);
63779         CHECK_ACCESS(logger_ptr);
63780         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63781         if (logger_conv.free == LDKLogger_JCalls_free) {
63782                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63783                 LDKLogger_JCalls_cloned(&logger_conv);
63784         }
63785         LDKThirtyTwoBytes random_seed_bytes_ref;
63786         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
63787         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
63788         void* scorer_ptr = untag_ptr(scorer);
63789         CHECK_ACCESS(scorer_ptr);
63790         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
63791         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
63792                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63793                 LDKLockableScore_JCalls_cloned(&scorer_conv);
63794         }
63795         LDKProbabilisticScoringFeeParameters score_params_conv;
63796         score_params_conv.inner = untag_ptr(score_params);
63797         score_params_conv.is_owned = ptr_is_owned(score_params);
63798         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
63799         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
63800         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
63801         int64_t ret_ref = 0;
63802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63804         return ret_ref;
63805 }
63806
63807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
63808         LDKDefaultRouter this_arg_conv;
63809         this_arg_conv.inner = untag_ptr(this_arg);
63810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63812         this_arg_conv.is_owned = false;
63813         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
63814         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
63815         return tag_ptr(ret_ret, true);
63816 }
63817
63818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63819         if (!ptr_is_owned(this_ptr)) return;
63820         void* this_ptr_ptr = untag_ptr(this_ptr);
63821         CHECK_ACCESS(this_ptr_ptr);
63822         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
63823         FREE(untag_ptr(this_ptr));
63824         Router_free(this_ptr_conv);
63825 }
63826
63827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63828         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
63829         this_obj_conv.inner = untag_ptr(this_obj);
63830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63832         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
63833 }
63834
63835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
63836         void* scorer_ptr = untag_ptr(scorer);
63837         CHECK_ACCESS(scorer_ptr);
63838         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
63839         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
63840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63841                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
63842         }
63843         LDKInFlightHtlcs inflight_htlcs_conv;
63844         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
63845         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
63846         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
63847         inflight_htlcs_conv.is_owned = false;
63848         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
63849         int64_t ret_ref = 0;
63850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63852         return ret_ref;
63853 }
63854
63855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
63856         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
63857         this_arg_conv.inner = untag_ptr(this_arg);
63858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63860         this_arg_conv.is_owned = false;
63861         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
63862         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
63863         return tag_ptr(ret_ret, true);
63864 }
63865
63866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63867         LDKInFlightHtlcs this_obj_conv;
63868         this_obj_conv.inner = untag_ptr(this_obj);
63869         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63871         InFlightHtlcs_free(this_obj_conv);
63872 }
63873
63874 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
63875         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
63876         int64_t ret_ref = 0;
63877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63879         return ret_ref;
63880 }
63881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63882         LDKInFlightHtlcs arg_conv;
63883         arg_conv.inner = untag_ptr(arg);
63884         arg_conv.is_owned = ptr_is_owned(arg);
63885         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63886         arg_conv.is_owned = false;
63887         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
63888         return ret_conv;
63889 }
63890
63891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63892         LDKInFlightHtlcs orig_conv;
63893         orig_conv.inner = untag_ptr(orig);
63894         orig_conv.is_owned = ptr_is_owned(orig);
63895         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63896         orig_conv.is_owned = false;
63897         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
63898         int64_t ret_ref = 0;
63899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63901         return ret_ref;
63902 }
63903
63904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
63905         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
63906         int64_t ret_ref = 0;
63907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63909         return ret_ref;
63910 }
63911
63912 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) {
63913         LDKInFlightHtlcs this_arg_conv;
63914         this_arg_conv.inner = untag_ptr(this_arg);
63915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63917         this_arg_conv.is_owned = false;
63918         LDKPath path_conv;
63919         path_conv.inner = untag_ptr(path);
63920         path_conv.is_owned = ptr_is_owned(path);
63921         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63922         path_conv.is_owned = false;
63923         LDKPublicKey payer_node_id_ref;
63924         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
63925         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
63926         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
63927 }
63928
63929 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) {
63930         LDKInFlightHtlcs this_arg_conv;
63931         this_arg_conv.inner = untag_ptr(this_arg);
63932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63934         this_arg_conv.is_owned = false;
63935         LDKNodeId source_conv;
63936         source_conv.inner = untag_ptr(source);
63937         source_conv.is_owned = ptr_is_owned(source);
63938         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63939         source_conv.is_owned = false;
63940         LDKNodeId target_conv;
63941         target_conv.inner = untag_ptr(target);
63942         target_conv.is_owned = ptr_is_owned(target);
63943         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63944         target_conv.is_owned = false;
63945         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
63946 }
63947
63948 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) {
63949         LDKInFlightHtlcs this_arg_conv;
63950         this_arg_conv.inner = untag_ptr(this_arg);
63951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63953         this_arg_conv.is_owned = false;
63954         LDKNodeId source_conv;
63955         source_conv.inner = untag_ptr(source);
63956         source_conv.is_owned = ptr_is_owned(source);
63957         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
63958         source_conv.is_owned = false;
63959         LDKNodeId target_conv;
63960         target_conv.inner = untag_ptr(target);
63961         target_conv.is_owned = ptr_is_owned(target);
63962         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
63963         target_conv.is_owned = false;
63964         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63965         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
63966         int64_t ret_ref = tag_ptr(ret_copy, true);
63967         return ret_ref;
63968 }
63969
63970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
63971         LDKInFlightHtlcs obj_conv;
63972         obj_conv.inner = untag_ptr(obj);
63973         obj_conv.is_owned = ptr_is_owned(obj);
63974         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63975         obj_conv.is_owned = false;
63976         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
63977         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63978         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63979         CVec_u8Z_free(ret_var);
63980         return ret_arr;
63981 }
63982
63983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63984         LDKu8slice ser_ref;
63985         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63986         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63987         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
63988         *ret_conv = InFlightHtlcs_read(ser_ref);
63989         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63990         return tag_ptr(ret_conv, true);
63991 }
63992
63993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63994         LDKRouteHop this_obj_conv;
63995         this_obj_conv.inner = untag_ptr(this_obj);
63996         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63998         RouteHop_free(this_obj_conv);
63999 }
64000
64001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
64002         LDKRouteHop this_ptr_conv;
64003         this_ptr_conv.inner = untag_ptr(this_ptr);
64004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64006         this_ptr_conv.is_owned = false;
64007         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64008         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
64009         return ret_arr;
64010 }
64011
64012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64013         LDKRouteHop this_ptr_conv;
64014         this_ptr_conv.inner = untag_ptr(this_ptr);
64015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64017         this_ptr_conv.is_owned = false;
64018         LDKPublicKey val_ref;
64019         CHECK((*env)->GetArrayLength(env, val) == 33);
64020         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
64021         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
64022 }
64023
64024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
64025         LDKRouteHop this_ptr_conv;
64026         this_ptr_conv.inner = untag_ptr(this_ptr);
64027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64029         this_ptr_conv.is_owned = false;
64030         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
64031         int64_t ret_ref = 0;
64032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64034         return ret_ref;
64035 }
64036
64037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64038         LDKRouteHop this_ptr_conv;
64039         this_ptr_conv.inner = untag_ptr(this_ptr);
64040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64042         this_ptr_conv.is_owned = false;
64043         LDKNodeFeatures val_conv;
64044         val_conv.inner = untag_ptr(val);
64045         val_conv.is_owned = ptr_is_owned(val);
64046         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64047         val_conv = NodeFeatures_clone(&val_conv);
64048         RouteHop_set_node_features(&this_ptr_conv, val_conv);
64049 }
64050
64051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
64052         LDKRouteHop this_ptr_conv;
64053         this_ptr_conv.inner = untag_ptr(this_ptr);
64054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64056         this_ptr_conv.is_owned = false;
64057         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
64058         return ret_conv;
64059 }
64060
64061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64062         LDKRouteHop this_ptr_conv;
64063         this_ptr_conv.inner = untag_ptr(this_ptr);
64064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64066         this_ptr_conv.is_owned = false;
64067         RouteHop_set_short_channel_id(&this_ptr_conv, val);
64068 }
64069
64070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
64071         LDKRouteHop this_ptr_conv;
64072         this_ptr_conv.inner = untag_ptr(this_ptr);
64073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64075         this_ptr_conv.is_owned = false;
64076         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
64077         int64_t ret_ref = 0;
64078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64080         return ret_ref;
64081 }
64082
64083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64084         LDKRouteHop this_ptr_conv;
64085         this_ptr_conv.inner = untag_ptr(this_ptr);
64086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64088         this_ptr_conv.is_owned = false;
64089         LDKChannelFeatures val_conv;
64090         val_conv.inner = untag_ptr(val);
64091         val_conv.is_owned = ptr_is_owned(val);
64092         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64093         val_conv = ChannelFeatures_clone(&val_conv);
64094         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
64095 }
64096
64097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64098         LDKRouteHop this_ptr_conv;
64099         this_ptr_conv.inner = untag_ptr(this_ptr);
64100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64102         this_ptr_conv.is_owned = false;
64103         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
64104         return ret_conv;
64105 }
64106
64107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64108         LDKRouteHop this_ptr_conv;
64109         this_ptr_conv.inner = untag_ptr(this_ptr);
64110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64112         this_ptr_conv.is_owned = false;
64113         RouteHop_set_fee_msat(&this_ptr_conv, val);
64114 }
64115
64116 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
64117         LDKRouteHop this_ptr_conv;
64118         this_ptr_conv.inner = untag_ptr(this_ptr);
64119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64121         this_ptr_conv.is_owned = false;
64122         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
64123         return ret_conv;
64124 }
64125
64126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
64127         LDKRouteHop this_ptr_conv;
64128         this_ptr_conv.inner = untag_ptr(this_ptr);
64129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64131         this_ptr_conv.is_owned = false;
64132         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
64133 }
64134
64135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
64136         LDKRouteHop this_ptr_conv;
64137         this_ptr_conv.inner = untag_ptr(this_ptr);
64138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64140         this_ptr_conv.is_owned = false;
64141         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
64142         return ret_conv;
64143 }
64144
64145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
64146         LDKRouteHop this_ptr_conv;
64147         this_ptr_conv.inner = untag_ptr(this_ptr);
64148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64150         this_ptr_conv.is_owned = false;
64151         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
64152 }
64153
64154 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) {
64155         LDKPublicKey pubkey_arg_ref;
64156         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
64157         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
64158         LDKNodeFeatures node_features_arg_conv;
64159         node_features_arg_conv.inner = untag_ptr(node_features_arg);
64160         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
64161         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
64162         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
64163         LDKChannelFeatures channel_features_arg_conv;
64164         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
64165         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
64166         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
64167         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
64168         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);
64169         int64_t ret_ref = 0;
64170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64172         return ret_ref;
64173 }
64174
64175 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
64176         LDKRouteHop ret_var = RouteHop_clone(arg);
64177         int64_t ret_ref = 0;
64178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64180         return ret_ref;
64181 }
64182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64183         LDKRouteHop arg_conv;
64184         arg_conv.inner = untag_ptr(arg);
64185         arg_conv.is_owned = ptr_is_owned(arg);
64186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64187         arg_conv.is_owned = false;
64188         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
64189         return ret_conv;
64190 }
64191
64192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64193         LDKRouteHop orig_conv;
64194         orig_conv.inner = untag_ptr(orig);
64195         orig_conv.is_owned = ptr_is_owned(orig);
64196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64197         orig_conv.is_owned = false;
64198         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
64199         int64_t ret_ref = 0;
64200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64202         return ret_ref;
64203 }
64204
64205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
64206         LDKRouteHop o_conv;
64207         o_conv.inner = untag_ptr(o);
64208         o_conv.is_owned = ptr_is_owned(o);
64209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64210         o_conv.is_owned = false;
64211         int64_t ret_conv = RouteHop_hash(&o_conv);
64212         return ret_conv;
64213 }
64214
64215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64216         LDKRouteHop a_conv;
64217         a_conv.inner = untag_ptr(a);
64218         a_conv.is_owned = ptr_is_owned(a);
64219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64220         a_conv.is_owned = false;
64221         LDKRouteHop b_conv;
64222         b_conv.inner = untag_ptr(b);
64223         b_conv.is_owned = ptr_is_owned(b);
64224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64225         b_conv.is_owned = false;
64226         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
64227         return ret_conv;
64228 }
64229
64230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
64231         LDKRouteHop obj_conv;
64232         obj_conv.inner = untag_ptr(obj);
64233         obj_conv.is_owned = ptr_is_owned(obj);
64234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64235         obj_conv.is_owned = false;
64236         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
64237         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64238         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64239         CVec_u8Z_free(ret_var);
64240         return ret_arr;
64241 }
64242
64243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64244         LDKu8slice ser_ref;
64245         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64246         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64247         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
64248         *ret_conv = RouteHop_read(ser_ref);
64249         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64250         return tag_ptr(ret_conv, true);
64251 }
64252
64253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64254         LDKBlindedTail this_obj_conv;
64255         this_obj_conv.inner = untag_ptr(this_obj);
64256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64258         BlindedTail_free(this_obj_conv);
64259 }
64260
64261 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
64262         LDKBlindedTail this_ptr_conv;
64263         this_ptr_conv.inner = untag_ptr(this_ptr);
64264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64266         this_ptr_conv.is_owned = false;
64267         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
64268         int64_tArray ret_arr = NULL;
64269         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64270         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64271         for (size_t m = 0; m < ret_var.datalen; m++) {
64272                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
64273                 int64_t ret_conv_12_ref = 0;
64274                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
64275                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
64276                 ret_arr_ptr[m] = ret_conv_12_ref;
64277         }
64278         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64279         FREE(ret_var.data);
64280         return ret_arr;
64281 }
64282
64283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64284         LDKBlindedTail this_ptr_conv;
64285         this_ptr_conv.inner = untag_ptr(this_ptr);
64286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64288         this_ptr_conv.is_owned = false;
64289         LDKCVec_BlindedHopZ val_constr;
64290         val_constr.datalen = (*env)->GetArrayLength(env, val);
64291         if (val_constr.datalen > 0)
64292                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64293         else
64294                 val_constr.data = NULL;
64295         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64296         for (size_t m = 0; m < val_constr.datalen; m++) {
64297                 int64_t val_conv_12 = val_vals[m];
64298                 LDKBlindedHop val_conv_12_conv;
64299                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
64300                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
64301                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
64302                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
64303                 val_constr.data[m] = val_conv_12_conv;
64304         }
64305         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64306         BlindedTail_set_hops(&this_ptr_conv, val_constr);
64307 }
64308
64309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
64310         LDKBlindedTail 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64316         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
64317         return ret_arr;
64318 }
64319
64320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64321         LDKBlindedTail this_ptr_conv;
64322         this_ptr_conv.inner = untag_ptr(this_ptr);
64323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64325         this_ptr_conv.is_owned = false;
64326         LDKPublicKey val_ref;
64327         CHECK((*env)->GetArrayLength(env, val) == 33);
64328         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
64329         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
64330 }
64331
64332 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
64333         LDKBlindedTail this_ptr_conv;
64334         this_ptr_conv.inner = untag_ptr(this_ptr);
64335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64337         this_ptr_conv.is_owned = false;
64338         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
64339         return ret_conv;
64340 }
64341
64342 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) {
64343         LDKBlindedTail this_ptr_conv;
64344         this_ptr_conv.inner = untag_ptr(this_ptr);
64345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64347         this_ptr_conv.is_owned = false;
64348         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
64349 }
64350
64351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64352         LDKBlindedTail this_ptr_conv;
64353         this_ptr_conv.inner = untag_ptr(this_ptr);
64354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64356         this_ptr_conv.is_owned = false;
64357         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
64358         return ret_conv;
64359 }
64360
64361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64362         LDKBlindedTail this_ptr_conv;
64363         this_ptr_conv.inner = untag_ptr(this_ptr);
64364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64366         this_ptr_conv.is_owned = false;
64367         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
64368 }
64369
64370 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) {
64371         LDKCVec_BlindedHopZ hops_arg_constr;
64372         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
64373         if (hops_arg_constr.datalen > 0)
64374                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64375         else
64376                 hops_arg_constr.data = NULL;
64377         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
64378         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
64379                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
64380                 LDKBlindedHop hops_arg_conv_12_conv;
64381                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
64382                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
64383                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
64384                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
64385                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
64386         }
64387         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
64388         LDKPublicKey blinding_point_arg_ref;
64389         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
64390         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
64391         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
64392         int64_t ret_ref = 0;
64393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64395         return ret_ref;
64396 }
64397
64398 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
64399         LDKBlindedTail ret_var = BlindedTail_clone(arg);
64400         int64_t ret_ref = 0;
64401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64403         return ret_ref;
64404 }
64405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64406         LDKBlindedTail arg_conv;
64407         arg_conv.inner = untag_ptr(arg);
64408         arg_conv.is_owned = ptr_is_owned(arg);
64409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64410         arg_conv.is_owned = false;
64411         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
64412         return ret_conv;
64413 }
64414
64415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64416         LDKBlindedTail orig_conv;
64417         orig_conv.inner = untag_ptr(orig);
64418         orig_conv.is_owned = ptr_is_owned(orig);
64419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64420         orig_conv.is_owned = false;
64421         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
64422         int64_t ret_ref = 0;
64423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64425         return ret_ref;
64426 }
64427
64428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
64429         LDKBlindedTail o_conv;
64430         o_conv.inner = untag_ptr(o);
64431         o_conv.is_owned = ptr_is_owned(o);
64432         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64433         o_conv.is_owned = false;
64434         int64_t ret_conv = BlindedTail_hash(&o_conv);
64435         return ret_conv;
64436 }
64437
64438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64439         LDKBlindedTail a_conv;
64440         a_conv.inner = untag_ptr(a);
64441         a_conv.is_owned = ptr_is_owned(a);
64442         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64443         a_conv.is_owned = false;
64444         LDKBlindedTail b_conv;
64445         b_conv.inner = untag_ptr(b);
64446         b_conv.is_owned = ptr_is_owned(b);
64447         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64448         b_conv.is_owned = false;
64449         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
64450         return ret_conv;
64451 }
64452
64453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
64454         LDKBlindedTail obj_conv;
64455         obj_conv.inner = untag_ptr(obj);
64456         obj_conv.is_owned = ptr_is_owned(obj);
64457         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64458         obj_conv.is_owned = false;
64459         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
64460         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64461         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64462         CVec_u8Z_free(ret_var);
64463         return ret_arr;
64464 }
64465
64466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64467         LDKu8slice ser_ref;
64468         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64469         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64470         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
64471         *ret_conv = BlindedTail_read(ser_ref);
64472         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64473         return tag_ptr(ret_conv, true);
64474 }
64475
64476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64477         LDKPath this_obj_conv;
64478         this_obj_conv.inner = untag_ptr(this_obj);
64479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64481         Path_free(this_obj_conv);
64482 }
64483
64484 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
64485         LDKPath this_ptr_conv;
64486         this_ptr_conv.inner = untag_ptr(this_ptr);
64487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64489         this_ptr_conv.is_owned = false;
64490         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
64491         int64_tArray ret_arr = NULL;
64492         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64493         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64494         for (size_t k = 0; k < ret_var.datalen; k++) {
64495                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
64496                 int64_t ret_conv_10_ref = 0;
64497                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
64498                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
64499                 ret_arr_ptr[k] = ret_conv_10_ref;
64500         }
64501         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64502         FREE(ret_var.data);
64503         return ret_arr;
64504 }
64505
64506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64507         LDKPath this_ptr_conv;
64508         this_ptr_conv.inner = untag_ptr(this_ptr);
64509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64511         this_ptr_conv.is_owned = false;
64512         LDKCVec_RouteHopZ val_constr;
64513         val_constr.datalen = (*env)->GetArrayLength(env, val);
64514         if (val_constr.datalen > 0)
64515                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
64516         else
64517                 val_constr.data = NULL;
64518         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64519         for (size_t k = 0; k < val_constr.datalen; k++) {
64520                 int64_t val_conv_10 = val_vals[k];
64521                 LDKRouteHop val_conv_10_conv;
64522                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
64523                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
64524                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
64525                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
64526                 val_constr.data[k] = val_conv_10_conv;
64527         }
64528         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64529         Path_set_hops(&this_ptr_conv, val_constr);
64530 }
64531
64532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
64533         LDKPath this_ptr_conv;
64534         this_ptr_conv.inner = untag_ptr(this_ptr);
64535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64537         this_ptr_conv.is_owned = false;
64538         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
64539         int64_t ret_ref = 0;
64540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64542         return ret_ref;
64543 }
64544
64545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64546         LDKPath this_ptr_conv;
64547         this_ptr_conv.inner = untag_ptr(this_ptr);
64548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64550         this_ptr_conv.is_owned = false;
64551         LDKBlindedTail val_conv;
64552         val_conv.inner = untag_ptr(val);
64553         val_conv.is_owned = ptr_is_owned(val);
64554         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64555         val_conv = BlindedTail_clone(&val_conv);
64556         Path_set_blinded_tail(&this_ptr_conv, val_conv);
64557 }
64558
64559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
64560         LDKCVec_RouteHopZ hops_arg_constr;
64561         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
64562         if (hops_arg_constr.datalen > 0)
64563                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
64564         else
64565                 hops_arg_constr.data = NULL;
64566         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
64567         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
64568                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
64569                 LDKRouteHop hops_arg_conv_10_conv;
64570                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
64571                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
64572                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
64573                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
64574                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
64575         }
64576         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
64577         LDKBlindedTail blinded_tail_arg_conv;
64578         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
64579         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
64580         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
64581         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
64582         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
64583         int64_t ret_ref = 0;
64584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64586         return ret_ref;
64587 }
64588
64589 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
64590         LDKPath ret_var = Path_clone(arg);
64591         int64_t ret_ref = 0;
64592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64594         return ret_ref;
64595 }
64596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64597         LDKPath arg_conv;
64598         arg_conv.inner = untag_ptr(arg);
64599         arg_conv.is_owned = ptr_is_owned(arg);
64600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64601         arg_conv.is_owned = false;
64602         int64_t ret_conv = Path_clone_ptr(&arg_conv);
64603         return ret_conv;
64604 }
64605
64606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64607         LDKPath orig_conv;
64608         orig_conv.inner = untag_ptr(orig);
64609         orig_conv.is_owned = ptr_is_owned(orig);
64610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64611         orig_conv.is_owned = false;
64612         LDKPath ret_var = Path_clone(&orig_conv);
64613         int64_t ret_ref = 0;
64614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64616         return ret_ref;
64617 }
64618
64619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
64620         LDKPath o_conv;
64621         o_conv.inner = untag_ptr(o);
64622         o_conv.is_owned = ptr_is_owned(o);
64623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64624         o_conv.is_owned = false;
64625         int64_t ret_conv = Path_hash(&o_conv);
64626         return ret_conv;
64627 }
64628
64629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64630         LDKPath a_conv;
64631         a_conv.inner = untag_ptr(a);
64632         a_conv.is_owned = ptr_is_owned(a);
64633         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64634         a_conv.is_owned = false;
64635         LDKPath b_conv;
64636         b_conv.inner = untag_ptr(b);
64637         b_conv.is_owned = ptr_is_owned(b);
64638         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64639         b_conv.is_owned = false;
64640         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
64641         return ret_conv;
64642 }
64643
64644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
64645         LDKPath this_arg_conv;
64646         this_arg_conv.inner = untag_ptr(this_arg);
64647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64649         this_arg_conv.is_owned = false;
64650         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
64651         return ret_conv;
64652 }
64653
64654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
64655         LDKPath this_arg_conv;
64656         this_arg_conv.inner = untag_ptr(this_arg);
64657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64659         this_arg_conv.is_owned = false;
64660         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
64661         return ret_conv;
64662 }
64663
64664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
64665         LDKPath this_arg_conv;
64666         this_arg_conv.inner = untag_ptr(this_arg);
64667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64669         this_arg_conv.is_owned = false;
64670         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
64671         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
64672         int64_t ret_ref = tag_ptr(ret_copy, true);
64673         return ret_ref;
64674 }
64675
64676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64677         LDKRoute this_obj_conv;
64678         this_obj_conv.inner = untag_ptr(this_obj);
64679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64681         Route_free(this_obj_conv);
64682 }
64683
64684 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
64685         LDKRoute this_ptr_conv;
64686         this_ptr_conv.inner = untag_ptr(this_ptr);
64687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64689         this_ptr_conv.is_owned = false;
64690         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
64691         int64_tArray ret_arr = NULL;
64692         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64693         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64694         for (size_t g = 0; g < ret_var.datalen; g++) {
64695                 LDKPath ret_conv_6_var = ret_var.data[g];
64696                 int64_t ret_conv_6_ref = 0;
64697                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
64698                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
64699                 ret_arr_ptr[g] = ret_conv_6_ref;
64700         }
64701         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64702         FREE(ret_var.data);
64703         return ret_arr;
64704 }
64705
64706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
64707         LDKRoute this_ptr_conv;
64708         this_ptr_conv.inner = untag_ptr(this_ptr);
64709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64711         this_ptr_conv.is_owned = false;
64712         LDKCVec_PathZ val_constr;
64713         val_constr.datalen = (*env)->GetArrayLength(env, val);
64714         if (val_constr.datalen > 0)
64715                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64716         else
64717                 val_constr.data = NULL;
64718         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
64719         for (size_t g = 0; g < val_constr.datalen; g++) {
64720                 int64_t val_conv_6 = val_vals[g];
64721                 LDKPath val_conv_6_conv;
64722                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
64723                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
64724                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
64725                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
64726                 val_constr.data[g] = val_conv_6_conv;
64727         }
64728         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
64729         Route_set_paths(&this_ptr_conv, val_constr);
64730 }
64731
64732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
64733         LDKRoute this_ptr_conv;
64734         this_ptr_conv.inner = untag_ptr(this_ptr);
64735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64737         this_ptr_conv.is_owned = false;
64738         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
64739         int64_t ret_ref = 0;
64740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64742         return ret_ref;
64743 }
64744
64745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64746         LDKRoute this_ptr_conv;
64747         this_ptr_conv.inner = untag_ptr(this_ptr);
64748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64750         this_ptr_conv.is_owned = false;
64751         LDKRouteParameters val_conv;
64752         val_conv.inner = untag_ptr(val);
64753         val_conv.is_owned = ptr_is_owned(val);
64754         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64755         val_conv = RouteParameters_clone(&val_conv);
64756         Route_set_route_params(&this_ptr_conv, val_conv);
64757 }
64758
64759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
64760         LDKCVec_PathZ paths_arg_constr;
64761         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
64762         if (paths_arg_constr.datalen > 0)
64763                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
64764         else
64765                 paths_arg_constr.data = NULL;
64766         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
64767         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
64768                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
64769                 LDKPath paths_arg_conv_6_conv;
64770                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
64771                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
64772                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
64773                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
64774                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
64775         }
64776         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
64777         LDKRouteParameters route_params_arg_conv;
64778         route_params_arg_conv.inner = untag_ptr(route_params_arg);
64779         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
64780         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
64781         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
64782         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
64783         int64_t ret_ref = 0;
64784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64786         return ret_ref;
64787 }
64788
64789 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
64790         LDKRoute ret_var = Route_clone(arg);
64791         int64_t ret_ref = 0;
64792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64794         return ret_ref;
64795 }
64796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64797         LDKRoute arg_conv;
64798         arg_conv.inner = untag_ptr(arg);
64799         arg_conv.is_owned = ptr_is_owned(arg);
64800         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64801         arg_conv.is_owned = false;
64802         int64_t ret_conv = Route_clone_ptr(&arg_conv);
64803         return ret_conv;
64804 }
64805
64806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64807         LDKRoute orig_conv;
64808         orig_conv.inner = untag_ptr(orig);
64809         orig_conv.is_owned = ptr_is_owned(orig);
64810         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64811         orig_conv.is_owned = false;
64812         LDKRoute ret_var = Route_clone(&orig_conv);
64813         int64_t ret_ref = 0;
64814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64816         return ret_ref;
64817 }
64818
64819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
64820         LDKRoute o_conv;
64821         o_conv.inner = untag_ptr(o);
64822         o_conv.is_owned = ptr_is_owned(o);
64823         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64824         o_conv.is_owned = false;
64825         int64_t ret_conv = Route_hash(&o_conv);
64826         return ret_conv;
64827 }
64828
64829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64830         LDKRoute a_conv;
64831         a_conv.inner = untag_ptr(a);
64832         a_conv.is_owned = ptr_is_owned(a);
64833         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64834         a_conv.is_owned = false;
64835         LDKRoute b_conv;
64836         b_conv.inner = untag_ptr(b);
64837         b_conv.is_owned = ptr_is_owned(b);
64838         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64839         b_conv.is_owned = false;
64840         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
64841         return ret_conv;
64842 }
64843
64844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
64845         LDKRoute this_arg_conv;
64846         this_arg_conv.inner = untag_ptr(this_arg);
64847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64849         this_arg_conv.is_owned = false;
64850         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
64851         return ret_conv;
64852 }
64853
64854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
64855         LDKRoute this_arg_conv;
64856         this_arg_conv.inner = untag_ptr(this_arg);
64857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64859         this_arg_conv.is_owned = false;
64860         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
64861         return ret_conv;
64862 }
64863
64864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
64865         LDKRoute obj_conv;
64866         obj_conv.inner = untag_ptr(obj);
64867         obj_conv.is_owned = ptr_is_owned(obj);
64868         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64869         obj_conv.is_owned = false;
64870         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
64871         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64872         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64873         CVec_u8Z_free(ret_var);
64874         return ret_arr;
64875 }
64876
64877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64878         LDKu8slice ser_ref;
64879         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64880         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64881         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
64882         *ret_conv = Route_read(ser_ref);
64883         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64884         return tag_ptr(ret_conv, true);
64885 }
64886
64887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64888         LDKRouteParameters this_obj_conv;
64889         this_obj_conv.inner = untag_ptr(this_obj);
64890         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64892         RouteParameters_free(this_obj_conv);
64893 }
64894
64895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
64896         LDKRouteParameters this_ptr_conv;
64897         this_ptr_conv.inner = untag_ptr(this_ptr);
64898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64900         this_ptr_conv.is_owned = false;
64901         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
64902         int64_t ret_ref = 0;
64903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64905         return ret_ref;
64906 }
64907
64908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64909         LDKRouteParameters this_ptr_conv;
64910         this_ptr_conv.inner = untag_ptr(this_ptr);
64911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64913         this_ptr_conv.is_owned = false;
64914         LDKPaymentParameters val_conv;
64915         val_conv.inner = untag_ptr(val);
64916         val_conv.is_owned = ptr_is_owned(val);
64917         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64918         val_conv = PaymentParameters_clone(&val_conv);
64919         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
64920 }
64921
64922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64923         LDKRouteParameters this_ptr_conv;
64924         this_ptr_conv.inner = untag_ptr(this_ptr);
64925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64927         this_ptr_conv.is_owned = false;
64928         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
64929         return ret_conv;
64930 }
64931
64932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64933         LDKRouteParameters this_ptr_conv;
64934         this_ptr_conv.inner = untag_ptr(this_ptr);
64935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64937         this_ptr_conv.is_owned = false;
64938         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
64939 }
64940
64941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
64942         LDKRouteParameters this_ptr_conv;
64943         this_ptr_conv.inner = untag_ptr(this_ptr);
64944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64946         this_ptr_conv.is_owned = false;
64947         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64948         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
64949         int64_t ret_ref = tag_ptr(ret_copy, true);
64950         return ret_ref;
64951 }
64952
64953 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) {
64954         LDKRouteParameters this_ptr_conv;
64955         this_ptr_conv.inner = untag_ptr(this_ptr);
64956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64958         this_ptr_conv.is_owned = false;
64959         void* val_ptr = untag_ptr(val);
64960         CHECK_ACCESS(val_ptr);
64961         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
64962         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
64963         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
64964 }
64965
64966 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) {
64967         LDKPaymentParameters payment_params_arg_conv;
64968         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
64969         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
64970         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
64971         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
64972         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
64973         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
64974         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
64975         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
64976         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
64977         int64_t ret_ref = 0;
64978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64980         return ret_ref;
64981 }
64982
64983 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
64984         LDKRouteParameters ret_var = RouteParameters_clone(arg);
64985         int64_t ret_ref = 0;
64986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64988         return ret_ref;
64989 }
64990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64991         LDKRouteParameters arg_conv;
64992         arg_conv.inner = untag_ptr(arg);
64993         arg_conv.is_owned = ptr_is_owned(arg);
64994         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64995         arg_conv.is_owned = false;
64996         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
64997         return ret_conv;
64998 }
64999
65000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65001         LDKRouteParameters orig_conv;
65002         orig_conv.inner = untag_ptr(orig);
65003         orig_conv.is_owned = ptr_is_owned(orig);
65004         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65005         orig_conv.is_owned = false;
65006         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
65007         int64_t ret_ref = 0;
65008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65010         return ret_ref;
65011 }
65012
65013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
65014         LDKRouteParameters o_conv;
65015         o_conv.inner = untag_ptr(o);
65016         o_conv.is_owned = ptr_is_owned(o);
65017         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65018         o_conv.is_owned = false;
65019         int64_t ret_conv = RouteParameters_hash(&o_conv);
65020         return ret_conv;
65021 }
65022
65023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65024         LDKRouteParameters a_conv;
65025         a_conv.inner = untag_ptr(a);
65026         a_conv.is_owned = ptr_is_owned(a);
65027         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65028         a_conv.is_owned = false;
65029         LDKRouteParameters b_conv;
65030         b_conv.inner = untag_ptr(b);
65031         b_conv.is_owned = ptr_is_owned(b);
65032         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65033         b_conv.is_owned = false;
65034         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
65035         return ret_conv;
65036 }
65037
65038 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) {
65039         LDKPaymentParameters payment_params_conv;
65040         payment_params_conv.inner = untag_ptr(payment_params);
65041         payment_params_conv.is_owned = ptr_is_owned(payment_params);
65042         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
65043         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
65044         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
65045         int64_t ret_ref = 0;
65046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65048         return ret_ref;
65049 }
65050
65051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
65052         LDKRouteParameters obj_conv;
65053         obj_conv.inner = untag_ptr(obj);
65054         obj_conv.is_owned = ptr_is_owned(obj);
65055         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65056         obj_conv.is_owned = false;
65057         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
65058         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65059         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65060         CVec_u8Z_free(ret_var);
65061         return ret_arr;
65062 }
65063
65064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65065         LDKu8slice ser_ref;
65066         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65067         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65068         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
65069         *ret_conv = RouteParameters_read(ser_ref);
65070         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65071         return tag_ptr(ret_conv, true);
65072 }
65073
65074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65075         LDKPaymentParameters this_obj_conv;
65076         this_obj_conv.inner = untag_ptr(this_obj);
65077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65079         PaymentParameters_free(this_obj_conv);
65080 }
65081
65082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
65083         LDKPaymentParameters this_ptr_conv;
65084         this_ptr_conv.inner = untag_ptr(this_ptr);
65085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65087         this_ptr_conv.is_owned = false;
65088         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65089         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
65090         int64_t ret_ref = tag_ptr(ret_copy, true);
65091         return ret_ref;
65092 }
65093
65094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65095         LDKPaymentParameters this_ptr_conv;
65096         this_ptr_conv.inner = untag_ptr(this_ptr);
65097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65099         this_ptr_conv.is_owned = false;
65100         void* val_ptr = untag_ptr(val);
65101         CHECK_ACCESS(val_ptr);
65102         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
65103         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
65104         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
65105 }
65106
65107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
65108         LDKPaymentParameters this_ptr_conv;
65109         this_ptr_conv.inner = untag_ptr(this_ptr);
65110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65112         this_ptr_conv.is_owned = false;
65113         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65114         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
65115         int64_t ret_ref = tag_ptr(ret_copy, true);
65116         return ret_ref;
65117 }
65118
65119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65120         LDKPaymentParameters this_ptr_conv;
65121         this_ptr_conv.inner = untag_ptr(this_ptr);
65122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65124         this_ptr_conv.is_owned = false;
65125         void* val_ptr = untag_ptr(val);
65126         CHECK_ACCESS(val_ptr);
65127         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65128         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65129         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
65130 }
65131
65132 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
65133         LDKPaymentParameters this_ptr_conv;
65134         this_ptr_conv.inner = untag_ptr(this_ptr);
65135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65137         this_ptr_conv.is_owned = false;
65138         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
65139         return ret_conv;
65140 }
65141
65142 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) {
65143         LDKPaymentParameters this_ptr_conv;
65144         this_ptr_conv.inner = untag_ptr(this_ptr);
65145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65147         this_ptr_conv.is_owned = false;
65148         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
65149 }
65150
65151 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
65152         LDKPaymentParameters this_ptr_conv;
65153         this_ptr_conv.inner = untag_ptr(this_ptr);
65154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65156         this_ptr_conv.is_owned = false;
65157         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
65158         return ret_conv;
65159 }
65160
65161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
65162         LDKPaymentParameters this_ptr_conv;
65163         this_ptr_conv.inner = untag_ptr(this_ptr);
65164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65166         this_ptr_conv.is_owned = false;
65167         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
65168 }
65169
65170 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) {
65171         LDKPaymentParameters this_ptr_conv;
65172         this_ptr_conv.inner = untag_ptr(this_ptr);
65173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65175         this_ptr_conv.is_owned = false;
65176         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
65177         return ret_conv;
65178 }
65179
65180 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) {
65181         LDKPaymentParameters this_ptr_conv;
65182         this_ptr_conv.inner = untag_ptr(this_ptr);
65183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65185         this_ptr_conv.is_owned = false;
65186         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
65187 }
65188
65189 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
65190         LDKPaymentParameters this_ptr_conv;
65191         this_ptr_conv.inner = untag_ptr(this_ptr);
65192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65194         this_ptr_conv.is_owned = false;
65195         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
65196         int64_tArray ret_arr = NULL;
65197         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
65198         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
65199         for (size_t g = 0; g < ret_var.datalen; g++) {
65200                 int64_t ret_conv_6_conv = ret_var.data[g];
65201                 ret_arr_ptr[g] = ret_conv_6_conv;
65202         }
65203         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
65204         FREE(ret_var.data);
65205         return ret_arr;
65206 }
65207
65208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
65209         LDKPaymentParameters this_ptr_conv;
65210         this_ptr_conv.inner = untag_ptr(this_ptr);
65211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65213         this_ptr_conv.is_owned = false;
65214         LDKCVec_u64Z val_constr;
65215         val_constr.datalen = (*env)->GetArrayLength(env, val);
65216         if (val_constr.datalen > 0)
65217                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65218         else
65219                 val_constr.data = NULL;
65220         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
65221         for (size_t g = 0; g < val_constr.datalen; g++) {
65222                 int64_t val_conv_6 = val_vals[g];
65223                 val_constr.data[g] = val_conv_6;
65224         }
65225         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
65226         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
65227 }
65228
65229 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) {
65230         void* payee_arg_ptr = untag_ptr(payee_arg);
65231         CHECK_ACCESS(payee_arg_ptr);
65232         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
65233         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
65234         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
65235         CHECK_ACCESS(expiry_time_arg_ptr);
65236         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
65237         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
65238         LDKCVec_u64Z previously_failed_channels_arg_constr;
65239         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
65240         if (previously_failed_channels_arg_constr.datalen > 0)
65241                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65242         else
65243                 previously_failed_channels_arg_constr.data = NULL;
65244         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
65245         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
65246                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
65247                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
65248         }
65249         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
65250         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);
65251         int64_t ret_ref = 0;
65252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65254         return ret_ref;
65255 }
65256
65257 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
65258         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
65259         int64_t ret_ref = 0;
65260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65262         return ret_ref;
65263 }
65264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65265         LDKPaymentParameters arg_conv;
65266         arg_conv.inner = untag_ptr(arg);
65267         arg_conv.is_owned = ptr_is_owned(arg);
65268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65269         arg_conv.is_owned = false;
65270         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
65271         return ret_conv;
65272 }
65273
65274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65275         LDKPaymentParameters orig_conv;
65276         orig_conv.inner = untag_ptr(orig);
65277         orig_conv.is_owned = ptr_is_owned(orig);
65278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65279         orig_conv.is_owned = false;
65280         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
65281         int64_t ret_ref = 0;
65282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65284         return ret_ref;
65285 }
65286
65287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
65288         LDKPaymentParameters o_conv;
65289         o_conv.inner = untag_ptr(o);
65290         o_conv.is_owned = ptr_is_owned(o);
65291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65292         o_conv.is_owned = false;
65293         int64_t ret_conv = PaymentParameters_hash(&o_conv);
65294         return ret_conv;
65295 }
65296
65297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65298         LDKPaymentParameters a_conv;
65299         a_conv.inner = untag_ptr(a);
65300         a_conv.is_owned = ptr_is_owned(a);
65301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65302         a_conv.is_owned = false;
65303         LDKPaymentParameters b_conv;
65304         b_conv.inner = untag_ptr(b);
65305         b_conv.is_owned = ptr_is_owned(b);
65306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65307         b_conv.is_owned = false;
65308         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
65309         return ret_conv;
65310 }
65311
65312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
65313         LDKPaymentParameters obj_conv;
65314         obj_conv.inner = untag_ptr(obj);
65315         obj_conv.is_owned = ptr_is_owned(obj);
65316         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65317         obj_conv.is_owned = false;
65318         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
65319         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65320         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65321         CVec_u8Z_free(ret_var);
65322         return ret_arr;
65323 }
65324
65325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
65326         LDKu8slice ser_ref;
65327         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65328         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65329         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
65330         *ret_conv = PaymentParameters_read(ser_ref, arg);
65331         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65332         return tag_ptr(ret_conv, true);
65333 }
65334
65335 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) {
65336         LDKPublicKey payee_pubkey_ref;
65337         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
65338         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
65339         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
65340         int64_t ret_ref = 0;
65341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65343         return ret_ref;
65344 }
65345
65346 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) {
65347         LDKPublicKey payee_pubkey_ref;
65348         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
65349         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
65350         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
65351         int64_t ret_ref = 0;
65352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65354         return ret_ref;
65355 }
65356
65357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
65358         LDKBolt12Invoice invoice_conv;
65359         invoice_conv.inner = untag_ptr(invoice);
65360         invoice_conv.is_owned = ptr_is_owned(invoice);
65361         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
65362         invoice_conv.is_owned = false;
65363         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
65364         int64_t ret_ref = 0;
65365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65367         return ret_ref;
65368 }
65369
65370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
65371         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
65372         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
65373         if (blinded_route_hints_constr.datalen > 0)
65374                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65375         else
65376                 blinded_route_hints_constr.data = NULL;
65377         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
65378         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
65379                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
65380                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
65381                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
65382                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
65383                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
65384                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
65385         }
65386         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
65387         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
65388         int64_t ret_ref = 0;
65389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65391         return ret_ref;
65392 }
65393
65394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65395         if (!ptr_is_owned(this_ptr)) return;
65396         void* this_ptr_ptr = untag_ptr(this_ptr);
65397         CHECK_ACCESS(this_ptr_ptr);
65398         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
65399         FREE(untag_ptr(this_ptr));
65400         Payee_free(this_ptr_conv);
65401 }
65402
65403 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
65404         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65405         *ret_copy = Payee_clone(arg);
65406         int64_t ret_ref = tag_ptr(ret_copy, true);
65407         return ret_ref;
65408 }
65409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65410         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
65411         int64_t ret_conv = Payee_clone_ptr(arg_conv);
65412         return ret_conv;
65413 }
65414
65415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65416         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
65417         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65418         *ret_copy = Payee_clone(orig_conv);
65419         int64_t ret_ref = tag_ptr(ret_copy, true);
65420         return ret_ref;
65421 }
65422
65423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
65424         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
65425         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
65426         if (route_hints_constr.datalen > 0)
65427                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65428         else
65429                 route_hints_constr.data = NULL;
65430         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
65431         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65432                 int64_t route_hints_conv_37 = route_hints_vals[l];
65433                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
65434                 CHECK_ACCESS(route_hints_conv_37_ptr);
65435                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
65436                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
65437                 route_hints_constr.data[l] = route_hints_conv_37_conv;
65438         }
65439         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
65440         LDKBolt12InvoiceFeatures features_conv;
65441         features_conv.inner = untag_ptr(features);
65442         features_conv.is_owned = ptr_is_owned(features);
65443         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65444         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
65445         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65446         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
65447         int64_t ret_ref = tag_ptr(ret_copy, true);
65448         return ret_ref;
65449 }
65450
65451 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) {
65452         LDKPublicKey node_id_ref;
65453         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65454         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65455         LDKCVec_RouteHintZ route_hints_constr;
65456         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
65457         if (route_hints_constr.datalen > 0)
65458                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
65459         else
65460                 route_hints_constr.data = NULL;
65461         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
65462         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65463                 int64_t route_hints_conv_11 = route_hints_vals[l];
65464                 LDKRouteHint route_hints_conv_11_conv;
65465                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
65466                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
65467                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
65468                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
65469                 route_hints_constr.data[l] = route_hints_conv_11_conv;
65470         }
65471         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
65472         LDKBolt11InvoiceFeatures features_conv;
65473         features_conv.inner = untag_ptr(features);
65474         features_conv.is_owned = ptr_is_owned(features);
65475         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65476         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
65477         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65478         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
65479         int64_t ret_ref = tag_ptr(ret_copy, true);
65480         return ret_ref;
65481 }
65482
65483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
65484         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
65485         int64_t ret_conv = Payee_hash(o_conv);
65486         return ret_conv;
65487 }
65488
65489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65490         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
65491         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
65492         jboolean ret_conv = Payee_eq(a_conv, b_conv);
65493         return ret_conv;
65494 }
65495
65496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65497         LDKRouteHint this_obj_conv;
65498         this_obj_conv.inner = untag_ptr(this_obj);
65499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65501         RouteHint_free(this_obj_conv);
65502 }
65503
65504 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
65505         LDKRouteHint this_ptr_conv;
65506         this_ptr_conv.inner = untag_ptr(this_ptr);
65507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65509         this_ptr_conv.is_owned = false;
65510         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
65511         int64_tArray ret_arr = NULL;
65512         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
65513         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
65514         for (size_t o = 0; o < ret_var.datalen; o++) {
65515                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
65516                 int64_t ret_conv_14_ref = 0;
65517                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
65518                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
65519                 ret_arr_ptr[o] = ret_conv_14_ref;
65520         }
65521         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
65522         FREE(ret_var.data);
65523         return ret_arr;
65524 }
65525
65526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
65527         LDKRouteHint this_ptr_conv;
65528         this_ptr_conv.inner = untag_ptr(this_ptr);
65529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65531         this_ptr_conv.is_owned = false;
65532         LDKCVec_RouteHintHopZ val_constr;
65533         val_constr.datalen = (*env)->GetArrayLength(env, val);
65534         if (val_constr.datalen > 0)
65535                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
65536         else
65537                 val_constr.data = NULL;
65538         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
65539         for (size_t o = 0; o < val_constr.datalen; o++) {
65540                 int64_t val_conv_14 = val_vals[o];
65541                 LDKRouteHintHop val_conv_14_conv;
65542                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
65543                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
65544                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
65545                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
65546                 val_constr.data[o] = val_conv_14_conv;
65547         }
65548         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
65549         RouteHint_set_a(&this_ptr_conv, val_constr);
65550 }
65551
65552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
65553         LDKCVec_RouteHintHopZ a_arg_constr;
65554         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
65555         if (a_arg_constr.datalen > 0)
65556                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
65557         else
65558                 a_arg_constr.data = NULL;
65559         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
65560         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
65561                 int64_t a_arg_conv_14 = a_arg_vals[o];
65562                 LDKRouteHintHop a_arg_conv_14_conv;
65563                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
65564                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
65565                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
65566                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
65567                 a_arg_constr.data[o] = a_arg_conv_14_conv;
65568         }
65569         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
65570         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
65571         int64_t ret_ref = 0;
65572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65574         return ret_ref;
65575 }
65576
65577 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
65578         LDKRouteHint ret_var = RouteHint_clone(arg);
65579         int64_t ret_ref = 0;
65580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65582         return ret_ref;
65583 }
65584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65585         LDKRouteHint arg_conv;
65586         arg_conv.inner = untag_ptr(arg);
65587         arg_conv.is_owned = ptr_is_owned(arg);
65588         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65589         arg_conv.is_owned = false;
65590         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
65591         return ret_conv;
65592 }
65593
65594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65595         LDKRouteHint orig_conv;
65596         orig_conv.inner = untag_ptr(orig);
65597         orig_conv.is_owned = ptr_is_owned(orig);
65598         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65599         orig_conv.is_owned = false;
65600         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
65601         int64_t ret_ref = 0;
65602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65604         return ret_ref;
65605 }
65606
65607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
65608         LDKRouteHint o_conv;
65609         o_conv.inner = untag_ptr(o);
65610         o_conv.is_owned = ptr_is_owned(o);
65611         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65612         o_conv.is_owned = false;
65613         int64_t ret_conv = RouteHint_hash(&o_conv);
65614         return ret_conv;
65615 }
65616
65617 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65618         LDKRouteHint a_conv;
65619         a_conv.inner = untag_ptr(a);
65620         a_conv.is_owned = ptr_is_owned(a);
65621         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65622         a_conv.is_owned = false;
65623         LDKRouteHint b_conv;
65624         b_conv.inner = untag_ptr(b);
65625         b_conv.is_owned = ptr_is_owned(b);
65626         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65627         b_conv.is_owned = false;
65628         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
65629         return ret_conv;
65630 }
65631
65632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
65633         LDKRouteHint obj_conv;
65634         obj_conv.inner = untag_ptr(obj);
65635         obj_conv.is_owned = ptr_is_owned(obj);
65636         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65637         obj_conv.is_owned = false;
65638         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
65639         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65640         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65641         CVec_u8Z_free(ret_var);
65642         return ret_arr;
65643 }
65644
65645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65646         LDKu8slice ser_ref;
65647         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65648         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65649         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
65650         *ret_conv = RouteHint_read(ser_ref);
65651         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65652         return tag_ptr(ret_conv, true);
65653 }
65654
65655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65656         LDKRouteHintHop this_obj_conv;
65657         this_obj_conv.inner = untag_ptr(this_obj);
65658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65660         RouteHintHop_free(this_obj_conv);
65661 }
65662
65663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
65664         LDKRouteHintHop this_ptr_conv;
65665         this_ptr_conv.inner = untag_ptr(this_ptr);
65666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65668         this_ptr_conv.is_owned = false;
65669         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65670         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
65671         return ret_arr;
65672 }
65673
65674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
65675         LDKRouteHintHop this_ptr_conv;
65676         this_ptr_conv.inner = untag_ptr(this_ptr);
65677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65679         this_ptr_conv.is_owned = false;
65680         LDKPublicKey val_ref;
65681         CHECK((*env)->GetArrayLength(env, val) == 33);
65682         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
65683         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
65684 }
65685
65686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
65687         LDKRouteHintHop this_ptr_conv;
65688         this_ptr_conv.inner = untag_ptr(this_ptr);
65689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65691         this_ptr_conv.is_owned = false;
65692         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
65693         return ret_conv;
65694 }
65695
65696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65697         LDKRouteHintHop this_ptr_conv;
65698         this_ptr_conv.inner = untag_ptr(this_ptr);
65699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65701         this_ptr_conv.is_owned = false;
65702         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
65703 }
65704
65705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
65706         LDKRouteHintHop this_ptr_conv;
65707         this_ptr_conv.inner = untag_ptr(this_ptr);
65708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65710         this_ptr_conv.is_owned = false;
65711         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
65712         int64_t ret_ref = 0;
65713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65715         return ret_ref;
65716 }
65717
65718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65719         LDKRouteHintHop this_ptr_conv;
65720         this_ptr_conv.inner = untag_ptr(this_ptr);
65721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65723         this_ptr_conv.is_owned = false;
65724         LDKRoutingFees val_conv;
65725         val_conv.inner = untag_ptr(val);
65726         val_conv.is_owned = ptr_is_owned(val);
65727         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65728         val_conv = RoutingFees_clone(&val_conv);
65729         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
65730 }
65731
65732 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
65733         LDKRouteHintHop this_ptr_conv;
65734         this_ptr_conv.inner = untag_ptr(this_ptr);
65735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65737         this_ptr_conv.is_owned = false;
65738         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
65739         return ret_conv;
65740 }
65741
65742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
65743         LDKRouteHintHop this_ptr_conv;
65744         this_ptr_conv.inner = untag_ptr(this_ptr);
65745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65747         this_ptr_conv.is_owned = false;
65748         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
65749 }
65750
65751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65752         LDKRouteHintHop this_ptr_conv;
65753         this_ptr_conv.inner = untag_ptr(this_ptr);
65754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65756         this_ptr_conv.is_owned = false;
65757         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65758         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
65759         int64_t ret_ref = tag_ptr(ret_copy, true);
65760         return ret_ref;
65761 }
65762
65763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65764         LDKRouteHintHop this_ptr_conv;
65765         this_ptr_conv.inner = untag_ptr(this_ptr);
65766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65768         this_ptr_conv.is_owned = false;
65769         void* val_ptr = untag_ptr(val);
65770         CHECK_ACCESS(val_ptr);
65771         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65772         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65773         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
65774 }
65775
65776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65777         LDKRouteHintHop this_ptr_conv;
65778         this_ptr_conv.inner = untag_ptr(this_ptr);
65779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65781         this_ptr_conv.is_owned = false;
65782         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65783         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
65784         int64_t ret_ref = tag_ptr(ret_copy, true);
65785         return ret_ref;
65786 }
65787
65788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65789         LDKRouteHintHop this_ptr_conv;
65790         this_ptr_conv.inner = untag_ptr(this_ptr);
65791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65793         this_ptr_conv.is_owned = false;
65794         void* val_ptr = untag_ptr(val);
65795         CHECK_ACCESS(val_ptr);
65796         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65797         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65798         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
65799 }
65800
65801 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) {
65802         LDKPublicKey src_node_id_arg_ref;
65803         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
65804         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
65805         LDKRoutingFees fees_arg_conv;
65806         fees_arg_conv.inner = untag_ptr(fees_arg);
65807         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
65808         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
65809         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
65810         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
65811         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
65812         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
65813         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
65814         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
65815         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
65816         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
65817         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
65818         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);
65819         int64_t ret_ref = 0;
65820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65822         return ret_ref;
65823 }
65824
65825 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
65826         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
65827         int64_t ret_ref = 0;
65828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65830         return ret_ref;
65831 }
65832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65833         LDKRouteHintHop arg_conv;
65834         arg_conv.inner = untag_ptr(arg);
65835         arg_conv.is_owned = ptr_is_owned(arg);
65836         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65837         arg_conv.is_owned = false;
65838         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
65839         return ret_conv;
65840 }
65841
65842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65843         LDKRouteHintHop orig_conv;
65844         orig_conv.inner = untag_ptr(orig);
65845         orig_conv.is_owned = ptr_is_owned(orig);
65846         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65847         orig_conv.is_owned = false;
65848         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
65849         int64_t ret_ref = 0;
65850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65852         return ret_ref;
65853 }
65854
65855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
65856         LDKRouteHintHop o_conv;
65857         o_conv.inner = untag_ptr(o);
65858         o_conv.is_owned = ptr_is_owned(o);
65859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65860         o_conv.is_owned = false;
65861         int64_t ret_conv = RouteHintHop_hash(&o_conv);
65862         return ret_conv;
65863 }
65864
65865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65866         LDKRouteHintHop a_conv;
65867         a_conv.inner = untag_ptr(a);
65868         a_conv.is_owned = ptr_is_owned(a);
65869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65870         a_conv.is_owned = false;
65871         LDKRouteHintHop b_conv;
65872         b_conv.inner = untag_ptr(b);
65873         b_conv.is_owned = ptr_is_owned(b);
65874         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65875         b_conv.is_owned = false;
65876         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
65877         return ret_conv;
65878 }
65879
65880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
65881         LDKRouteHintHop obj_conv;
65882         obj_conv.inner = untag_ptr(obj);
65883         obj_conv.is_owned = ptr_is_owned(obj);
65884         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65885         obj_conv.is_owned = false;
65886         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
65887         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65888         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65889         CVec_u8Z_free(ret_var);
65890         return ret_arr;
65891 }
65892
65893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65894         LDKu8slice ser_ref;
65895         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65896         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65897         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
65898         *ret_conv = RouteHintHop_read(ser_ref);
65899         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65900         return tag_ptr(ret_conv, true);
65901 }
65902
65903 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) {
65904         LDKPublicKey our_node_pubkey_ref;
65905         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
65906         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
65907         LDKRouteParameters route_params_conv;
65908         route_params_conv.inner = untag_ptr(route_params);
65909         route_params_conv.is_owned = ptr_is_owned(route_params);
65910         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
65911         route_params_conv.is_owned = false;
65912         LDKNetworkGraph network_graph_conv;
65913         network_graph_conv.inner = untag_ptr(network_graph);
65914         network_graph_conv.is_owned = ptr_is_owned(network_graph);
65915         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
65916         network_graph_conv.is_owned = false;
65917         LDKCVec_ChannelDetailsZ first_hops_constr;
65918         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
65919         if (first_hops != NULL) {
65920                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
65921                 if (first_hops_constr.datalen > 0)
65922                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
65923                 else
65924                         first_hops_constr.data = NULL;
65925                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
65926                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
65927                         int64_t first_hops_conv_16 = first_hops_vals[q];
65928                         LDKChannelDetails first_hops_conv_16_conv;
65929                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
65930                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
65931                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
65932                         first_hops_conv_16_conv.is_owned = false;
65933                         first_hops_constr.data[q] = first_hops_conv_16_conv;
65934                 }
65935                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
65936                 first_hops_ptr = &first_hops_constr;
65937         }
65938         void* logger_ptr = untag_ptr(logger);
65939         CHECK_ACCESS(logger_ptr);
65940         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
65941         if (logger_conv.free == LDKLogger_JCalls_free) {
65942                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65943                 LDKLogger_JCalls_cloned(&logger_conv);
65944         }
65945         void* scorer_ptr = untag_ptr(scorer);
65946         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
65947         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
65948         LDKProbabilisticScoringFeeParameters score_params_conv;
65949         score_params_conv.inner = untag_ptr(score_params);
65950         score_params_conv.is_owned = ptr_is_owned(score_params);
65951         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
65952         score_params_conv.is_owned = false;
65953         uint8_t random_seed_bytes_arr[32];
65954         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
65955         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
65956         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
65957         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
65958         *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);
65959         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
65960         return tag_ptr(ret_conv, true);
65961 }
65962
65963 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) {
65964         LDKPublicKey our_node_pubkey_ref;
65965         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
65966         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
65967         LDKCVec_PublicKeyZ hops_constr;
65968         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
65969         if (hops_constr.datalen > 0)
65970                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
65971         else
65972                 hops_constr.data = NULL;
65973         for (size_t i = 0; i < hops_constr.datalen; i++) {
65974                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
65975                 LDKPublicKey hops_conv_8_ref;
65976                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
65977                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
65978                 hops_constr.data[i] = hops_conv_8_ref;
65979         }
65980         LDKRouteParameters route_params_conv;
65981         route_params_conv.inner = untag_ptr(route_params);
65982         route_params_conv.is_owned = ptr_is_owned(route_params);
65983         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
65984         route_params_conv.is_owned = false;
65985         LDKNetworkGraph network_graph_conv;
65986         network_graph_conv.inner = untag_ptr(network_graph);
65987         network_graph_conv.is_owned = ptr_is_owned(network_graph);
65988         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
65989         network_graph_conv.is_owned = false;
65990         void* logger_ptr = untag_ptr(logger);
65991         CHECK_ACCESS(logger_ptr);
65992         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
65993         if (logger_conv.free == LDKLogger_JCalls_free) {
65994                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65995                 LDKLogger_JCalls_cloned(&logger_conv);
65996         }
65997         uint8_t random_seed_bytes_arr[32];
65998         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
65999         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
66000         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66001         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66002         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
66003         return tag_ptr(ret_conv, true);
66004 }
66005
66006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66007         if (!ptr_is_owned(this_ptr)) return;
66008         void* this_ptr_ptr = untag_ptr(this_ptr);
66009         CHECK_ACCESS(this_ptr_ptr);
66010         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
66011         FREE(untag_ptr(this_ptr));
66012         ScoreLookUp_free(this_ptr_conv);
66013 }
66014
66015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66016         if (!ptr_is_owned(this_ptr)) return;
66017         void* this_ptr_ptr = untag_ptr(this_ptr);
66018         CHECK_ACCESS(this_ptr_ptr);
66019         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
66020         FREE(untag_ptr(this_ptr));
66021         ScoreUpdate_free(this_ptr_conv);
66022 }
66023
66024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66025         if (!ptr_is_owned(this_ptr)) return;
66026         void* this_ptr_ptr = untag_ptr(this_ptr);
66027         CHECK_ACCESS(this_ptr_ptr);
66028         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
66029         FREE(untag_ptr(this_ptr));
66030         Score_free(this_ptr_conv);
66031 }
66032
66033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66034         if (!ptr_is_owned(this_ptr)) return;
66035         void* this_ptr_ptr = untag_ptr(this_ptr);
66036         CHECK_ACCESS(this_ptr_ptr);
66037         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
66038         FREE(untag_ptr(this_ptr));
66039         LockableScore_free(this_ptr_conv);
66040 }
66041
66042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66043         if (!ptr_is_owned(this_ptr)) return;
66044         void* this_ptr_ptr = untag_ptr(this_ptr);
66045         CHECK_ACCESS(this_ptr_ptr);
66046         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
66047         FREE(untag_ptr(this_ptr));
66048         WriteableScore_free(this_ptr_conv);
66049 }
66050
66051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66052         LDKMultiThreadedLockableScore this_obj_conv;
66053         this_obj_conv.inner = untag_ptr(this_obj);
66054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66056         MultiThreadedLockableScore_free(this_obj_conv);
66057 }
66058
66059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
66060         LDKMultiThreadedLockableScore this_arg_conv;
66061         this_arg_conv.inner = untag_ptr(this_arg);
66062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66064         this_arg_conv.is_owned = false;
66065         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
66066         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
66067         return tag_ptr(ret_ret, true);
66068 }
66069
66070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
66071         LDKMultiThreadedLockableScore obj_conv;
66072         obj_conv.inner = untag_ptr(obj);
66073         obj_conv.is_owned = ptr_is_owned(obj);
66074         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66075         obj_conv.is_owned = false;
66076         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
66077         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66078         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66079         CVec_u8Z_free(ret_var);
66080         return ret_arr;
66081 }
66082
66083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
66084         LDKMultiThreadedLockableScore this_arg_conv;
66085         this_arg_conv.inner = untag_ptr(this_arg);
66086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66088         this_arg_conv.is_owned = false;
66089         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
66090         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
66091         return tag_ptr(ret_ret, true);
66092 }
66093
66094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
66095         void* score_ptr = untag_ptr(score);
66096         CHECK_ACCESS(score_ptr);
66097         LDKScore score_conv = *(LDKScore*)(score_ptr);
66098         if (score_conv.free == LDKScore_JCalls_free) {
66099                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66100                 LDKScore_JCalls_cloned(&score_conv);
66101         }
66102         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
66103         int64_t ret_ref = 0;
66104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66106         return ret_ref;
66107 }
66108
66109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66110         LDKMultiThreadedScoreLockRead this_obj_conv;
66111         this_obj_conv.inner = untag_ptr(this_obj);
66112         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66114         MultiThreadedScoreLockRead_free(this_obj_conv);
66115 }
66116
66117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66118         LDKMultiThreadedScoreLockWrite this_obj_conv;
66119         this_obj_conv.inner = untag_ptr(this_obj);
66120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66122         MultiThreadedScoreLockWrite_free(this_obj_conv);
66123 }
66124
66125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
66126         LDKMultiThreadedScoreLockRead this_arg_conv;
66127         this_arg_conv.inner = untag_ptr(this_arg);
66128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66130         this_arg_conv.is_owned = false;
66131         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66132         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
66133         return tag_ptr(ret_ret, true);
66134 }
66135
66136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
66137         LDKMultiThreadedScoreLockWrite obj_conv;
66138         obj_conv.inner = untag_ptr(obj);
66139         obj_conv.is_owned = ptr_is_owned(obj);
66140         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66141         obj_conv.is_owned = false;
66142         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
66143         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66144         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66145         CVec_u8Z_free(ret_var);
66146         return ret_arr;
66147 }
66148
66149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
66150         LDKMultiThreadedScoreLockWrite this_arg_conv;
66151         this_arg_conv.inner = untag_ptr(this_arg);
66152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66154         this_arg_conv.is_owned = false;
66155         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66156         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
66157         return tag_ptr(ret_ret, true);
66158 }
66159
66160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66161         LDKChannelUsage this_obj_conv;
66162         this_obj_conv.inner = untag_ptr(this_obj);
66163         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66165         ChannelUsage_free(this_obj_conv);
66166 }
66167
66168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66169         LDKChannelUsage this_ptr_conv;
66170         this_ptr_conv.inner = untag_ptr(this_ptr);
66171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66173         this_ptr_conv.is_owned = false;
66174         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
66175         return ret_conv;
66176 }
66177
66178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66179         LDKChannelUsage this_ptr_conv;
66180         this_ptr_conv.inner = untag_ptr(this_ptr);
66181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66183         this_ptr_conv.is_owned = false;
66184         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
66185 }
66186
66187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66188         LDKChannelUsage this_ptr_conv;
66189         this_ptr_conv.inner = untag_ptr(this_ptr);
66190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66192         this_ptr_conv.is_owned = false;
66193         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
66194         return ret_conv;
66195 }
66196
66197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66198         LDKChannelUsage this_ptr_conv;
66199         this_ptr_conv.inner = untag_ptr(this_ptr);
66200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66202         this_ptr_conv.is_owned = false;
66203         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
66204 }
66205
66206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
66207         LDKChannelUsage this_ptr_conv;
66208         this_ptr_conv.inner = untag_ptr(this_ptr);
66209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66211         this_ptr_conv.is_owned = false;
66212         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
66213         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
66214         int64_t ret_ref = tag_ptr(ret_copy, true);
66215         return ret_ref;
66216 }
66217
66218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66219         LDKChannelUsage this_ptr_conv;
66220         this_ptr_conv.inner = untag_ptr(this_ptr);
66221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66223         this_ptr_conv.is_owned = false;
66224         void* val_ptr = untag_ptr(val);
66225         CHECK_ACCESS(val_ptr);
66226         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
66227         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
66228         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
66229 }
66230
66231 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) {
66232         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
66233         CHECK_ACCESS(effective_capacity_arg_ptr);
66234         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
66235         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
66236         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
66237         int64_t ret_ref = 0;
66238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66240         return ret_ref;
66241 }
66242
66243 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
66244         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
66245         int64_t ret_ref = 0;
66246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66248         return ret_ref;
66249 }
66250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66251         LDKChannelUsage arg_conv;
66252         arg_conv.inner = untag_ptr(arg);
66253         arg_conv.is_owned = ptr_is_owned(arg);
66254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66255         arg_conv.is_owned = false;
66256         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
66257         return ret_conv;
66258 }
66259
66260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66261         LDKChannelUsage orig_conv;
66262         orig_conv.inner = untag_ptr(orig);
66263         orig_conv.is_owned = ptr_is_owned(orig);
66264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66265         orig_conv.is_owned = false;
66266         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
66267         int64_t ret_ref = 0;
66268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66270         return ret_ref;
66271 }
66272
66273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66274         LDKFixedPenaltyScorer this_obj_conv;
66275         this_obj_conv.inner = untag_ptr(this_obj);
66276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66278         FixedPenaltyScorer_free(this_obj_conv);
66279 }
66280
66281 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
66282         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
66283         int64_t ret_ref = 0;
66284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66286         return ret_ref;
66287 }
66288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66289         LDKFixedPenaltyScorer arg_conv;
66290         arg_conv.inner = untag_ptr(arg);
66291         arg_conv.is_owned = ptr_is_owned(arg);
66292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66293         arg_conv.is_owned = false;
66294         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
66295         return ret_conv;
66296 }
66297
66298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66299         LDKFixedPenaltyScorer orig_conv;
66300         orig_conv.inner = untag_ptr(orig);
66301         orig_conv.is_owned = ptr_is_owned(orig);
66302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66303         orig_conv.is_owned = false;
66304         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
66305         int64_t ret_ref = 0;
66306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66308         return ret_ref;
66309 }
66310
66311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
66312         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
66313         int64_t ret_ref = 0;
66314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66316         return ret_ref;
66317 }
66318
66319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
66320         LDKFixedPenaltyScorer this_arg_conv;
66321         this_arg_conv.inner = untag_ptr(this_arg);
66322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66324         this_arg_conv.is_owned = false;
66325         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66326         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
66327         return tag_ptr(ret_ret, true);
66328 }
66329
66330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
66331         LDKFixedPenaltyScorer this_arg_conv;
66332         this_arg_conv.inner = untag_ptr(this_arg);
66333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66335         this_arg_conv.is_owned = false;
66336         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66337         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
66338         return tag_ptr(ret_ret, true);
66339 }
66340
66341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
66342         LDKFixedPenaltyScorer 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 = FixedPenaltyScorer_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_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
66355         LDKu8slice ser_ref;
66356         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66357         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66358         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
66359         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
66360         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66361         return tag_ptr(ret_conv, true);
66362 }
66363
66364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66365         LDKProbabilisticScorer this_obj_conv;
66366         this_obj_conv.inner = untag_ptr(this_obj);
66367         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66369         ProbabilisticScorer_free(this_obj_conv);
66370 }
66371
66372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66373         LDKProbabilisticScoringFeeParameters this_obj_conv;
66374         this_obj_conv.inner = untag_ptr(this_obj);
66375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66377         ProbabilisticScoringFeeParameters_free(this_obj_conv);
66378 }
66379
66380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66381         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66382         this_ptr_conv.inner = untag_ptr(this_ptr);
66383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66385         this_ptr_conv.is_owned = false;
66386         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
66387         return ret_conv;
66388 }
66389
66390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66391         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66392         this_ptr_conv.inner = untag_ptr(this_ptr);
66393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66395         this_ptr_conv.is_owned = false;
66396         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
66397 }
66398
66399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66400         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66401         this_ptr_conv.inner = untag_ptr(this_ptr);
66402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66404         this_ptr_conv.is_owned = false;
66405         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
66406         return ret_conv;
66407 }
66408
66409 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) {
66410         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66411         this_ptr_conv.inner = untag_ptr(this_ptr);
66412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66414         this_ptr_conv.is_owned = false;
66415         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66416 }
66417
66418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66419         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66420         this_ptr_conv.inner = untag_ptr(this_ptr);
66421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66423         this_ptr_conv.is_owned = false;
66424         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
66425         return ret_conv;
66426 }
66427
66428 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) {
66429         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66430         this_ptr_conv.inner = untag_ptr(this_ptr);
66431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66433         this_ptr_conv.is_owned = false;
66434         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
66435 }
66436
66437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66438         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66439         this_ptr_conv.inner = untag_ptr(this_ptr);
66440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66442         this_ptr_conv.is_owned = false;
66443         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
66444         return ret_conv;
66445 }
66446
66447 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) {
66448         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66449         this_ptr_conv.inner = untag_ptr(this_ptr);
66450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66452         this_ptr_conv.is_owned = false;
66453         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66454 }
66455
66456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66457         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66458         this_ptr_conv.inner = untag_ptr(this_ptr);
66459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66461         this_ptr_conv.is_owned = false;
66462         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
66463         return ret_conv;
66464 }
66465
66466 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) {
66467         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66468         this_ptr_conv.inner = untag_ptr(this_ptr);
66469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66471         this_ptr_conv.is_owned = false;
66472         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
66473 }
66474
66475 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) {
66476         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66477         this_ptr_conv.inner = untag_ptr(this_ptr);
66478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66480         this_ptr_conv.is_owned = false;
66481         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
66482         return ret_conv;
66483 }
66484
66485 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) {
66486         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66487         this_ptr_conv.inner = untag_ptr(this_ptr);
66488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66490         this_ptr_conv.is_owned = false;
66491         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
66492 }
66493
66494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66495         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66496         this_ptr_conv.inner = untag_ptr(this_ptr);
66497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66499         this_ptr_conv.is_owned = false;
66500         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
66501         return ret_conv;
66502 }
66503
66504 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) {
66505         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66506         this_ptr_conv.inner = untag_ptr(this_ptr);
66507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66509         this_ptr_conv.is_owned = false;
66510         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
66511 }
66512
66513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
66514         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66515         this_ptr_conv.inner = untag_ptr(this_ptr);
66516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66518         this_ptr_conv.is_owned = false;
66519         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
66520         return ret_conv;
66521 }
66522
66523 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) {
66524         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66525         this_ptr_conv.inner = untag_ptr(this_ptr);
66526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66528         this_ptr_conv.is_owned = false;
66529         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
66530 }
66531
66532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
66533         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66534         this_ptr_conv.inner = untag_ptr(this_ptr);
66535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66537         this_ptr_conv.is_owned = false;
66538         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
66539         return ret_conv;
66540 }
66541
66542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
66543         LDKProbabilisticScoringFeeParameters this_ptr_conv;
66544         this_ptr_conv.inner = untag_ptr(this_ptr);
66545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66547         this_ptr_conv.is_owned = false;
66548         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
66549 }
66550
66551 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
66552         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
66553         int64_t ret_ref = 0;
66554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66556         return ret_ref;
66557 }
66558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66559         LDKProbabilisticScoringFeeParameters arg_conv;
66560         arg_conv.inner = untag_ptr(arg);
66561         arg_conv.is_owned = ptr_is_owned(arg);
66562         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66563         arg_conv.is_owned = false;
66564         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
66565         return ret_conv;
66566 }
66567
66568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66569         LDKProbabilisticScoringFeeParameters orig_conv;
66570         orig_conv.inner = untag_ptr(orig);
66571         orig_conv.is_owned = ptr_is_owned(orig);
66572         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66573         orig_conv.is_owned = false;
66574         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
66575         int64_t ret_ref = 0;
66576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66578         return ret_ref;
66579 }
66580
66581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
66582         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
66583         int64_t ret_ref = 0;
66584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66586         return ret_ref;
66587 }
66588
66589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
66590         LDKProbabilisticScoringFeeParameters this_arg_conv;
66591         this_arg_conv.inner = untag_ptr(this_arg);
66592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66594         this_arg_conv.is_owned = false;
66595         LDKNodeId node_id_conv;
66596         node_id_conv.inner = untag_ptr(node_id);
66597         node_id_conv.is_owned = ptr_is_owned(node_id);
66598         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
66599         node_id_conv.is_owned = false;
66600         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
66601 }
66602
66603 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) {
66604         LDKProbabilisticScoringFeeParameters this_arg_conv;
66605         this_arg_conv.inner = untag_ptr(this_arg);
66606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66608         this_arg_conv.is_owned = false;
66609         LDKCVec_NodeIdZ node_ids_constr;
66610         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
66611         if (node_ids_constr.datalen > 0)
66612                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
66613         else
66614                 node_ids_constr.data = NULL;
66615         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
66616         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
66617                 int64_t node_ids_conv_8 = node_ids_vals[i];
66618                 LDKNodeId node_ids_conv_8_conv;
66619                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
66620                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
66621                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
66622                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
66623                 node_ids_constr.data[i] = node_ids_conv_8_conv;
66624         }
66625         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
66626         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
66627 }
66628
66629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
66630         LDKProbabilisticScoringFeeParameters this_arg_conv;
66631         this_arg_conv.inner = untag_ptr(this_arg);
66632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66634         this_arg_conv.is_owned = false;
66635         LDKNodeId node_id_conv;
66636         node_id_conv.inner = untag_ptr(node_id);
66637         node_id_conv.is_owned = ptr_is_owned(node_id);
66638         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
66639         node_id_conv.is_owned = false;
66640         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
66641 }
66642
66643 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) {
66644         LDKProbabilisticScoringFeeParameters 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         LDKNodeId node_id_conv;
66650         node_id_conv.inner = untag_ptr(node_id);
66651         node_id_conv.is_owned = ptr_is_owned(node_id);
66652         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
66653         node_id_conv.is_owned = false;
66654         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
66655 }
66656
66657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
66658         LDKProbabilisticScoringFeeParameters this_arg_conv;
66659         this_arg_conv.inner = untag_ptr(this_arg);
66660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66662         this_arg_conv.is_owned = false;
66663         LDKNodeId node_id_conv;
66664         node_id_conv.inner = untag_ptr(node_id);
66665         node_id_conv.is_owned = ptr_is_owned(node_id);
66666         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
66667         node_id_conv.is_owned = false;
66668         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
66669 }
66670
66671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
66672         LDKProbabilisticScoringFeeParameters 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         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
66678 }
66679
66680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66681         LDKProbabilisticScoringDecayParameters this_obj_conv;
66682         this_obj_conv.inner = untag_ptr(this_obj);
66683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66685         ProbabilisticScoringDecayParameters_free(this_obj_conv);
66686 }
66687
66688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
66689         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66690         this_ptr_conv.inner = untag_ptr(this_ptr);
66691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66693         this_ptr_conv.is_owned = false;
66694         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
66695         return ret_conv;
66696 }
66697
66698 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) {
66699         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66700         this_ptr_conv.inner = untag_ptr(this_ptr);
66701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66703         this_ptr_conv.is_owned = false;
66704         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
66705 }
66706
66707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
66708         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66709         this_ptr_conv.inner = untag_ptr(this_ptr);
66710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66712         this_ptr_conv.is_owned = false;
66713         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
66714         return ret_conv;
66715 }
66716
66717 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) {
66718         LDKProbabilisticScoringDecayParameters this_ptr_conv;
66719         this_ptr_conv.inner = untag_ptr(this_ptr);
66720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66722         this_ptr_conv.is_owned = false;
66723         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
66724 }
66725
66726 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) {
66727         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
66728         int64_t ret_ref = 0;
66729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66731         return ret_ref;
66732 }
66733
66734 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
66735         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
66736         int64_t ret_ref = 0;
66737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66739         return ret_ref;
66740 }
66741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66742         LDKProbabilisticScoringDecayParameters arg_conv;
66743         arg_conv.inner = untag_ptr(arg);
66744         arg_conv.is_owned = ptr_is_owned(arg);
66745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66746         arg_conv.is_owned = false;
66747         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
66748         return ret_conv;
66749 }
66750
66751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66752         LDKProbabilisticScoringDecayParameters orig_conv;
66753         orig_conv.inner = untag_ptr(orig);
66754         orig_conv.is_owned = ptr_is_owned(orig);
66755         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66756         orig_conv.is_owned = false;
66757         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
66758         int64_t ret_ref = 0;
66759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66761         return ret_ref;
66762 }
66763
66764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
66765         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
66766         int64_t ret_ref = 0;
66767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66769         return ret_ref;
66770 }
66771
66772 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) {
66773         LDKProbabilisticScoringDecayParameters decay_params_conv;
66774         decay_params_conv.inner = untag_ptr(decay_params);
66775         decay_params_conv.is_owned = ptr_is_owned(decay_params);
66776         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
66777         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
66778         LDKNetworkGraph network_graph_conv;
66779         network_graph_conv.inner = untag_ptr(network_graph);
66780         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66781         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66782         network_graph_conv.is_owned = false;
66783         void* logger_ptr = untag_ptr(logger);
66784         CHECK_ACCESS(logger_ptr);
66785         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66786         if (logger_conv.free == LDKLogger_JCalls_free) {
66787                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66788                 LDKLogger_JCalls_cloned(&logger_conv);
66789         }
66790         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
66791         int64_t ret_ref = 0;
66792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66794         return ret_ref;
66795 }
66796
66797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
66798         LDKProbabilisticScorer this_arg_conv;
66799         this_arg_conv.inner = untag_ptr(this_arg);
66800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66802         this_arg_conv.is_owned = false;
66803         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
66804 }
66805
66806 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) {
66807         LDKProbabilisticScorer this_arg_conv;
66808         this_arg_conv.inner = untag_ptr(this_arg);
66809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66811         this_arg_conv.is_owned = false;
66812         LDKNodeId target_conv;
66813         target_conv.inner = untag_ptr(target);
66814         target_conv.is_owned = ptr_is_owned(target);
66815         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66816         target_conv.is_owned = false;
66817         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
66818         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
66819         int64_t ret_ref = tag_ptr(ret_copy, true);
66820         return ret_ref;
66821 }
66822
66823 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) {
66824         LDKProbabilisticScorer this_arg_conv;
66825         this_arg_conv.inner = untag_ptr(this_arg);
66826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66828         this_arg_conv.is_owned = false;
66829         LDKNodeId target_conv;
66830         target_conv.inner = untag_ptr(target);
66831         target_conv.is_owned = ptr_is_owned(target);
66832         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66833         target_conv.is_owned = false;
66834         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
66835         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
66836         int64_t ret_ref = tag_ptr(ret_copy, true);
66837         return ret_ref;
66838 }
66839
66840 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) {
66841         LDKProbabilisticScorer this_arg_conv;
66842         this_arg_conv.inner = untag_ptr(this_arg);
66843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66845         this_arg_conv.is_owned = false;
66846         LDKNodeId target_conv;
66847         target_conv.inner = untag_ptr(target);
66848         target_conv.is_owned = ptr_is_owned(target);
66849         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
66850         target_conv.is_owned = false;
66851         LDKProbabilisticScoringFeeParameters params_conv;
66852         params_conv.inner = untag_ptr(params);
66853         params_conv.is_owned = ptr_is_owned(params);
66854         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
66855         params_conv.is_owned = false;
66856         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
66857         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
66858         int64_t ret_ref = tag_ptr(ret_copy, true);
66859         return ret_ref;
66860 }
66861
66862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
66863         LDKProbabilisticScorer this_arg_conv;
66864         this_arg_conv.inner = untag_ptr(this_arg);
66865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66867         this_arg_conv.is_owned = false;
66868         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
66869         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
66870         return tag_ptr(ret_ret, true);
66871 }
66872
66873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
66874         LDKProbabilisticScorer this_arg_conv;
66875         this_arg_conv.inner = untag_ptr(this_arg);
66876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66878         this_arg_conv.is_owned = false;
66879         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
66880         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
66881         return tag_ptr(ret_ret, true);
66882 }
66883
66884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
66885         LDKProbabilisticScorer this_arg_conv;
66886         this_arg_conv.inner = untag_ptr(this_arg);
66887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66889         this_arg_conv.is_owned = false;
66890         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
66891         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
66892         return tag_ptr(ret_ret, true);
66893 }
66894
66895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
66896         LDKProbabilisticScorer obj_conv;
66897         obj_conv.inner = untag_ptr(obj);
66898         obj_conv.is_owned = ptr_is_owned(obj);
66899         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66900         obj_conv.is_owned = false;
66901         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
66902         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66903         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66904         CVec_u8Z_free(ret_var);
66905         return ret_arr;
66906 }
66907
66908 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) {
66909         LDKu8slice ser_ref;
66910         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66911         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66912         LDKProbabilisticScoringDecayParameters arg_a_conv;
66913         arg_a_conv.inner = untag_ptr(arg_a);
66914         arg_a_conv.is_owned = ptr_is_owned(arg_a);
66915         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
66916         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
66917         LDKNetworkGraph arg_b_conv;
66918         arg_b_conv.inner = untag_ptr(arg_b);
66919         arg_b_conv.is_owned = ptr_is_owned(arg_b);
66920         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
66921         arg_b_conv.is_owned = false;
66922         void* arg_c_ptr = untag_ptr(arg_c);
66923         CHECK_ACCESS(arg_c_ptr);
66924         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
66925         if (arg_c_conv.free == LDKLogger_JCalls_free) {
66926                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66927                 LDKLogger_JCalls_cloned(&arg_c_conv);
66928         }
66929         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
66930         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
66931         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66932         return tag_ptr(ret_conv, true);
66933 }
66934
66935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66936         LDKDelayedPaymentOutputDescriptor this_obj_conv;
66937         this_obj_conv.inner = untag_ptr(this_obj);
66938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66940         DelayedPaymentOutputDescriptor_free(this_obj_conv);
66941 }
66942
66943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66944         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66945         this_ptr_conv.inner = untag_ptr(this_ptr);
66946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66948         this_ptr_conv.is_owned = false;
66949         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
66950         int64_t ret_ref = 0;
66951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66953         return ret_ref;
66954 }
66955
66956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66957         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66958         this_ptr_conv.inner = untag_ptr(this_ptr);
66959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66961         this_ptr_conv.is_owned = false;
66962         LDKOutPoint val_conv;
66963         val_conv.inner = untag_ptr(val);
66964         val_conv.is_owned = ptr_is_owned(val);
66965         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66966         val_conv = OutPoint_clone(&val_conv);
66967         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
66968 }
66969
66970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
66971         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66972         this_ptr_conv.inner = untag_ptr(this_ptr);
66973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66975         this_ptr_conv.is_owned = false;
66976         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66977         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
66978         return ret_arr;
66979 }
66980
66981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66982         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66983         this_ptr_conv.inner = untag_ptr(this_ptr);
66984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66986         this_ptr_conv.is_owned = false;
66987         LDKPublicKey val_ref;
66988         CHECK((*env)->GetArrayLength(env, val) == 33);
66989         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
66990         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
66991 }
66992
66993 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
66994         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
66995         this_ptr_conv.inner = untag_ptr(this_ptr);
66996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66998         this_ptr_conv.is_owned = false;
66999         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
67000         return ret_conv;
67001 }
67002
67003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
67004         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67005         this_ptr_conv.inner = untag_ptr(this_ptr);
67006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67008         this_ptr_conv.is_owned = false;
67009         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
67010 }
67011
67012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
67013         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67014         this_ptr_conv.inner = untag_ptr(this_ptr);
67015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67017         this_ptr_conv.is_owned = false;
67018         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67019         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
67020         return tag_ptr(ret_ref, true);
67021 }
67022
67023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67024         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67025         this_ptr_conv.inner = untag_ptr(this_ptr);
67026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67028         this_ptr_conv.is_owned = false;
67029         void* val_ptr = untag_ptr(val);
67030         CHECK_ACCESS(val_ptr);
67031         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67032         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67033         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67034 }
67035
67036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
67037         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67038         this_ptr_conv.inner = untag_ptr(this_ptr);
67039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67041         this_ptr_conv.is_owned = false;
67042         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67043         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
67044         return ret_arr;
67045 }
67046
67047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67048         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67049         this_ptr_conv.inner = untag_ptr(this_ptr);
67050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67052         this_ptr_conv.is_owned = false;
67053         LDKPublicKey val_ref;
67054         CHECK((*env)->GetArrayLength(env, val) == 33);
67055         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
67056         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
67057 }
67058
67059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
67060         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67061         this_ptr_conv.inner = untag_ptr(this_ptr);
67062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67064         this_ptr_conv.is_owned = false;
67065         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67066         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
67067         return ret_arr;
67068 }
67069
67070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67071         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67072         this_ptr_conv.inner = untag_ptr(this_ptr);
67073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67075         this_ptr_conv.is_owned = false;
67076         LDKThirtyTwoBytes val_ref;
67077         CHECK((*env)->GetArrayLength(env, val) == 32);
67078         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
67079         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67080 }
67081
67082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
67083         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67084         this_ptr_conv.inner = untag_ptr(this_ptr);
67085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67087         this_ptr_conv.is_owned = false;
67088         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67089         return ret_conv;
67090 }
67091
67092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67093         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67094         this_ptr_conv.inner = untag_ptr(this_ptr);
67095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67097         this_ptr_conv.is_owned = false;
67098         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67099 }
67100
67101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
67102         LDKOutPoint outpoint_arg_conv;
67103         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67104         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67105         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67106         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67107         LDKPublicKey per_commitment_point_arg_ref;
67108         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
67109         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
67110         void* output_arg_ptr = untag_ptr(output_arg);
67111         CHECK_ACCESS(output_arg_ptr);
67112         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67113         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67114         LDKPublicKey revocation_pubkey_arg_ref;
67115         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
67116         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
67117         LDKThirtyTwoBytes channel_keys_id_arg_ref;
67118         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
67119         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
67120         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
67121         int64_t ret_ref = 0;
67122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67124         return ret_ref;
67125 }
67126
67127 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
67128         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
67129         int64_t ret_ref = 0;
67130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67132         return ret_ref;
67133 }
67134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67135         LDKDelayedPaymentOutputDescriptor arg_conv;
67136         arg_conv.inner = untag_ptr(arg);
67137         arg_conv.is_owned = ptr_is_owned(arg);
67138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67139         arg_conv.is_owned = false;
67140         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
67141         return ret_conv;
67142 }
67143
67144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67145         LDKDelayedPaymentOutputDescriptor orig_conv;
67146         orig_conv.inner = untag_ptr(orig);
67147         orig_conv.is_owned = ptr_is_owned(orig);
67148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67149         orig_conv.is_owned = false;
67150         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
67151         int64_t ret_ref = 0;
67152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67154         return ret_ref;
67155 }
67156
67157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
67158         LDKDelayedPaymentOutputDescriptor o_conv;
67159         o_conv.inner = untag_ptr(o);
67160         o_conv.is_owned = ptr_is_owned(o);
67161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67162         o_conv.is_owned = false;
67163         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
67164         return ret_conv;
67165 }
67166
67167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67168         LDKDelayedPaymentOutputDescriptor a_conv;
67169         a_conv.inner = untag_ptr(a);
67170         a_conv.is_owned = ptr_is_owned(a);
67171         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67172         a_conv.is_owned = false;
67173         LDKDelayedPaymentOutputDescriptor b_conv;
67174         b_conv.inner = untag_ptr(b);
67175         b_conv.is_owned = ptr_is_owned(b);
67176         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67177         b_conv.is_owned = false;
67178         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
67179         return ret_conv;
67180 }
67181
67182 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
67183         LDKDelayedPaymentOutputDescriptor obj_conv;
67184         obj_conv.inner = untag_ptr(obj);
67185         obj_conv.is_owned = ptr_is_owned(obj);
67186         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67187         obj_conv.is_owned = false;
67188         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
67189         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67190         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67191         CVec_u8Z_free(ret_var);
67192         return ret_arr;
67193 }
67194
67195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67196         LDKu8slice ser_ref;
67197         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67198         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67199         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
67200         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
67201         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67202         return tag_ptr(ret_conv, true);
67203 }
67204
67205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67206         LDKStaticPaymentOutputDescriptor this_obj_conv;
67207         this_obj_conv.inner = untag_ptr(this_obj);
67208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67210         StaticPaymentOutputDescriptor_free(this_obj_conv);
67211 }
67212
67213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
67214         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67215         this_ptr_conv.inner = untag_ptr(this_ptr);
67216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67218         this_ptr_conv.is_owned = false;
67219         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
67220         int64_t ret_ref = 0;
67221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67223         return ret_ref;
67224 }
67225
67226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67227         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67228         this_ptr_conv.inner = untag_ptr(this_ptr);
67229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67231         this_ptr_conv.is_owned = false;
67232         LDKOutPoint val_conv;
67233         val_conv.inner = untag_ptr(val);
67234         val_conv.is_owned = ptr_is_owned(val);
67235         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67236         val_conv = OutPoint_clone(&val_conv);
67237         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67238 }
67239
67240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
67241         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67242         this_ptr_conv.inner = untag_ptr(this_ptr);
67243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67245         this_ptr_conv.is_owned = false;
67246         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67247         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
67248         return tag_ptr(ret_ref, true);
67249 }
67250
67251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67252         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67253         this_ptr_conv.inner = untag_ptr(this_ptr);
67254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67256         this_ptr_conv.is_owned = false;
67257         void* val_ptr = untag_ptr(val);
67258         CHECK_ACCESS(val_ptr);
67259         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67260         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67261         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67262 }
67263
67264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
67265         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67266         this_ptr_conv.inner = untag_ptr(this_ptr);
67267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67269         this_ptr_conv.is_owned = false;
67270         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67271         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
67272         return ret_arr;
67273 }
67274
67275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67276         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67277         this_ptr_conv.inner = untag_ptr(this_ptr);
67278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67280         this_ptr_conv.is_owned = false;
67281         LDKThirtyTwoBytes val_ref;
67282         CHECK((*env)->GetArrayLength(env, val) == 32);
67283         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
67284         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67285 }
67286
67287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
67288         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67289         this_ptr_conv.inner = untag_ptr(this_ptr);
67290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67292         this_ptr_conv.is_owned = false;
67293         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67294         return ret_conv;
67295 }
67296
67297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67298         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67299         this_ptr_conv.inner = untag_ptr(this_ptr);
67300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67302         this_ptr_conv.is_owned = false;
67303         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67304 }
67305
67306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
67307         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67308         this_ptr_conv.inner = untag_ptr(this_ptr);
67309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67311         this_ptr_conv.is_owned = false;
67312         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
67313         int64_t ret_ref = 0;
67314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67316         return ret_ref;
67317 }
67318
67319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67320         LDKStaticPaymentOutputDescriptor this_ptr_conv;
67321         this_ptr_conv.inner = untag_ptr(this_ptr);
67322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67324         this_ptr_conv.is_owned = false;
67325         LDKChannelTransactionParameters val_conv;
67326         val_conv.inner = untag_ptr(val);
67327         val_conv.is_owned = ptr_is_owned(val);
67328         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67329         val_conv = ChannelTransactionParameters_clone(&val_conv);
67330         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
67331 }
67332
67333 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) {
67334         LDKOutPoint outpoint_arg_conv;
67335         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
67336         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
67337         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
67338         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
67339         void* output_arg_ptr = untag_ptr(output_arg);
67340         CHECK_ACCESS(output_arg_ptr);
67341         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
67342         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
67343         LDKThirtyTwoBytes channel_keys_id_arg_ref;
67344         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
67345         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
67346         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
67347         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
67348         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
67349         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
67350         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
67351         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);
67352         int64_t ret_ref = 0;
67353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67355         return ret_ref;
67356 }
67357
67358 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
67359         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
67360         int64_t ret_ref = 0;
67361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67363         return ret_ref;
67364 }
67365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67366         LDKStaticPaymentOutputDescriptor arg_conv;
67367         arg_conv.inner = untag_ptr(arg);
67368         arg_conv.is_owned = ptr_is_owned(arg);
67369         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67370         arg_conv.is_owned = false;
67371         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
67372         return ret_conv;
67373 }
67374
67375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67376         LDKStaticPaymentOutputDescriptor orig_conv;
67377         orig_conv.inner = untag_ptr(orig);
67378         orig_conv.is_owned = ptr_is_owned(orig);
67379         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67380         orig_conv.is_owned = false;
67381         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
67382         int64_t ret_ref = 0;
67383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67385         return ret_ref;
67386 }
67387
67388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
67389         LDKStaticPaymentOutputDescriptor o_conv;
67390         o_conv.inner = untag_ptr(o);
67391         o_conv.is_owned = ptr_is_owned(o);
67392         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67393         o_conv.is_owned = false;
67394         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
67395         return ret_conv;
67396 }
67397
67398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67399         LDKStaticPaymentOutputDescriptor a_conv;
67400         a_conv.inner = untag_ptr(a);
67401         a_conv.is_owned = ptr_is_owned(a);
67402         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67403         a_conv.is_owned = false;
67404         LDKStaticPaymentOutputDescriptor b_conv;
67405         b_conv.inner = untag_ptr(b);
67406         b_conv.is_owned = ptr_is_owned(b);
67407         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67408         b_conv.is_owned = false;
67409         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
67410         return ret_conv;
67411 }
67412
67413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
67414         LDKStaticPaymentOutputDescriptor this_arg_conv;
67415         this_arg_conv.inner = untag_ptr(this_arg);
67416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67418         this_arg_conv.is_owned = false;
67419         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67420         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
67421         int64_t ret_ref = tag_ptr(ret_copy, true);
67422         return ret_ref;
67423 }
67424
67425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
67426         LDKStaticPaymentOutputDescriptor this_arg_conv;
67427         this_arg_conv.inner = untag_ptr(this_arg);
67428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67430         this_arg_conv.is_owned = false;
67431         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
67432         return ret_conv;
67433 }
67434
67435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
67436         LDKStaticPaymentOutputDescriptor obj_conv;
67437         obj_conv.inner = untag_ptr(obj);
67438         obj_conv.is_owned = ptr_is_owned(obj);
67439         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67440         obj_conv.is_owned = false;
67441         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
67442         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67443         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67444         CVec_u8Z_free(ret_var);
67445         return ret_arr;
67446 }
67447
67448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67449         LDKu8slice ser_ref;
67450         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67451         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67452         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
67453         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
67454         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67455         return tag_ptr(ret_conv, true);
67456 }
67457
67458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67459         if (!ptr_is_owned(this_ptr)) return;
67460         void* this_ptr_ptr = untag_ptr(this_ptr);
67461         CHECK_ACCESS(this_ptr_ptr);
67462         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
67463         FREE(untag_ptr(this_ptr));
67464         SpendableOutputDescriptor_free(this_ptr_conv);
67465 }
67466
67467 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
67468         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67469         *ret_copy = SpendableOutputDescriptor_clone(arg);
67470         int64_t ret_ref = tag_ptr(ret_copy, true);
67471         return ret_ref;
67472 }
67473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67474         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
67475         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
67476         return ret_conv;
67477 }
67478
67479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67480         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
67481         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67482         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
67483         int64_t ret_ref = tag_ptr(ret_copy, true);
67484         return ret_ref;
67485 }
67486
67487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
67488         LDKOutPoint outpoint_conv;
67489         outpoint_conv.inner = untag_ptr(outpoint);
67490         outpoint_conv.is_owned = ptr_is_owned(outpoint);
67491         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
67492         outpoint_conv = OutPoint_clone(&outpoint_conv);
67493         void* output_ptr = untag_ptr(output);
67494         CHECK_ACCESS(output_ptr);
67495         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
67496         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
67497         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67498         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
67499         int64_t ret_ref = tag_ptr(ret_copy, true);
67500         return ret_ref;
67501 }
67502
67503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
67504         LDKDelayedPaymentOutputDescriptor a_conv;
67505         a_conv.inner = untag_ptr(a);
67506         a_conv.is_owned = ptr_is_owned(a);
67507         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67508         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
67509         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67510         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
67511         int64_t ret_ref = tag_ptr(ret_copy, true);
67512         return ret_ref;
67513 }
67514
67515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
67516         LDKStaticPaymentOutputDescriptor a_conv;
67517         a_conv.inner = untag_ptr(a);
67518         a_conv.is_owned = ptr_is_owned(a);
67519         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67520         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
67521         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
67522         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
67523         int64_t ret_ref = tag_ptr(ret_copy, true);
67524         return ret_ref;
67525 }
67526
67527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
67528         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
67529         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
67530         return ret_conv;
67531 }
67532
67533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67534         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
67535         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
67536         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
67537         return ret_conv;
67538 }
67539
67540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
67541         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
67542         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
67543         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67544         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67545         CVec_u8Z_free(ret_var);
67546         return ret_arr;
67547 }
67548
67549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67550         LDKu8slice ser_ref;
67551         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67552         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67553         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
67554         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
67555         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67556         return tag_ptr(ret_conv, true);
67557 }
67558
67559 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) {
67560         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
67561         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
67562         if (descriptors_constr.datalen > 0)
67563                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
67564         else
67565                 descriptors_constr.data = NULL;
67566         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
67567         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
67568                 int64_t descriptors_conv_27 = descriptors_vals[b];
67569                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
67570                 CHECK_ACCESS(descriptors_conv_27_ptr);
67571                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
67572                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
67573                 descriptors_constr.data[b] = descriptors_conv_27_conv;
67574         }
67575         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
67576         LDKCVec_TxOutZ outputs_constr;
67577         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
67578         if (outputs_constr.datalen > 0)
67579                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
67580         else
67581                 outputs_constr.data = NULL;
67582         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
67583         for (size_t h = 0; h < outputs_constr.datalen; h++) {
67584                 int64_t outputs_conv_7 = outputs_vals[h];
67585                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
67586                 CHECK_ACCESS(outputs_conv_7_ptr);
67587                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
67588                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
67589                 outputs_constr.data[h] = outputs_conv_7_conv;
67590         }
67591         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
67592         LDKCVec_u8Z change_destination_script_ref;
67593         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
67594         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
67595         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
67596         void* locktime_ptr = untag_ptr(locktime);
67597         CHECK_ACCESS(locktime_ptr);
67598         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
67599         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
67600         LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ), "LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ");
67601         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
67602         return tag_ptr(ret_conv, true);
67603 }
67604
67605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67606         LDKChannelDerivationParameters this_obj_conv;
67607         this_obj_conv.inner = untag_ptr(this_obj);
67608         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67610         ChannelDerivationParameters_free(this_obj_conv);
67611 }
67612
67613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
67614         LDKChannelDerivationParameters this_ptr_conv;
67615         this_ptr_conv.inner = untag_ptr(this_ptr);
67616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67618         this_ptr_conv.is_owned = false;
67619         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
67620         return ret_conv;
67621 }
67622
67623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67624         LDKChannelDerivationParameters this_ptr_conv;
67625         this_ptr_conv.inner = untag_ptr(this_ptr);
67626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67628         this_ptr_conv.is_owned = false;
67629         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
67630 }
67631
67632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
67633         LDKChannelDerivationParameters this_ptr_conv;
67634         this_ptr_conv.inner = untag_ptr(this_ptr);
67635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67637         this_ptr_conv.is_owned = false;
67638         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67639         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
67640         return ret_arr;
67641 }
67642
67643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67644         LDKChannelDerivationParameters this_ptr_conv;
67645         this_ptr_conv.inner = untag_ptr(this_ptr);
67646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67648         this_ptr_conv.is_owned = false;
67649         LDKThirtyTwoBytes val_ref;
67650         CHECK((*env)->GetArrayLength(env, val) == 32);
67651         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
67652         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
67653 }
67654
67655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
67656         LDKChannelDerivationParameters this_ptr_conv;
67657         this_ptr_conv.inner = untag_ptr(this_ptr);
67658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67660         this_ptr_conv.is_owned = false;
67661         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
67662         int64_t ret_ref = 0;
67663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67665         return ret_ref;
67666 }
67667
67668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67669         LDKChannelDerivationParameters this_ptr_conv;
67670         this_ptr_conv.inner = untag_ptr(this_ptr);
67671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67673         this_ptr_conv.is_owned = false;
67674         LDKChannelTransactionParameters val_conv;
67675         val_conv.inner = untag_ptr(val);
67676         val_conv.is_owned = ptr_is_owned(val);
67677         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67678         val_conv = ChannelTransactionParameters_clone(&val_conv);
67679         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
67680 }
67681
67682 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) {
67683         LDKThirtyTwoBytes keys_id_arg_ref;
67684         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
67685         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
67686         LDKChannelTransactionParameters transaction_parameters_arg_conv;
67687         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
67688         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
67689         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
67690         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
67691         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
67692         int64_t ret_ref = 0;
67693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67695         return ret_ref;
67696 }
67697
67698 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
67699         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
67700         int64_t ret_ref = 0;
67701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67703         return ret_ref;
67704 }
67705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67706         LDKChannelDerivationParameters arg_conv;
67707         arg_conv.inner = untag_ptr(arg);
67708         arg_conv.is_owned = ptr_is_owned(arg);
67709         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67710         arg_conv.is_owned = false;
67711         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
67712         return ret_conv;
67713 }
67714
67715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67716         LDKChannelDerivationParameters orig_conv;
67717         orig_conv.inner = untag_ptr(orig);
67718         orig_conv.is_owned = ptr_is_owned(orig);
67719         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67720         orig_conv.is_owned = false;
67721         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
67722         int64_t ret_ref = 0;
67723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67725         return ret_ref;
67726 }
67727
67728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67729         LDKChannelDerivationParameters a_conv;
67730         a_conv.inner = untag_ptr(a);
67731         a_conv.is_owned = ptr_is_owned(a);
67732         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67733         a_conv.is_owned = false;
67734         LDKChannelDerivationParameters b_conv;
67735         b_conv.inner = untag_ptr(b);
67736         b_conv.is_owned = ptr_is_owned(b);
67737         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67738         b_conv.is_owned = false;
67739         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
67740         return ret_conv;
67741 }
67742
67743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
67744         LDKChannelDerivationParameters obj_conv;
67745         obj_conv.inner = untag_ptr(obj);
67746         obj_conv.is_owned = ptr_is_owned(obj);
67747         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67748         obj_conv.is_owned = false;
67749         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
67750         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67751         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67752         CVec_u8Z_free(ret_var);
67753         return ret_arr;
67754 }
67755
67756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67757         LDKu8slice ser_ref;
67758         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67759         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67760         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
67761         *ret_conv = ChannelDerivationParameters_read(ser_ref);
67762         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67763         return tag_ptr(ret_conv, true);
67764 }
67765
67766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67767         LDKHTLCDescriptor this_obj_conv;
67768         this_obj_conv.inner = untag_ptr(this_obj);
67769         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67771         HTLCDescriptor_free(this_obj_conv);
67772 }
67773
67774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
67775         LDKHTLCDescriptor this_ptr_conv;
67776         this_ptr_conv.inner = untag_ptr(this_ptr);
67777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67779         this_ptr_conv.is_owned = false;
67780         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
67781         int64_t ret_ref = 0;
67782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67784         return ret_ref;
67785 }
67786
67787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67788         LDKHTLCDescriptor this_ptr_conv;
67789         this_ptr_conv.inner = untag_ptr(this_ptr);
67790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67792         this_ptr_conv.is_owned = false;
67793         LDKChannelDerivationParameters val_conv;
67794         val_conv.inner = untag_ptr(val);
67795         val_conv.is_owned = ptr_is_owned(val);
67796         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67797         val_conv = ChannelDerivationParameters_clone(&val_conv);
67798         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
67799 }
67800
67801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
67802         LDKHTLCDescriptor this_ptr_conv;
67803         this_ptr_conv.inner = untag_ptr(this_ptr);
67804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67806         this_ptr_conv.is_owned = false;
67807         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
67808         return ret_conv;
67809 }
67810
67811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67812         LDKHTLCDescriptor this_ptr_conv;
67813         this_ptr_conv.inner = untag_ptr(this_ptr);
67814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67816         this_ptr_conv.is_owned = false;
67817         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
67818 }
67819
67820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
67821         LDKHTLCDescriptor this_ptr_conv;
67822         this_ptr_conv.inner = untag_ptr(this_ptr);
67823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67825         this_ptr_conv.is_owned = false;
67826         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67827         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
67828         return ret_arr;
67829 }
67830
67831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67832         LDKHTLCDescriptor this_ptr_conv;
67833         this_ptr_conv.inner = untag_ptr(this_ptr);
67834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67836         this_ptr_conv.is_owned = false;
67837         LDKPublicKey val_ref;
67838         CHECK((*env)->GetArrayLength(env, val) == 33);
67839         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
67840         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
67841 }
67842
67843 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
67844         LDKHTLCDescriptor this_ptr_conv;
67845         this_ptr_conv.inner = untag_ptr(this_ptr);
67846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67848         this_ptr_conv.is_owned = false;
67849         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
67850         return ret_conv;
67851 }
67852
67853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
67854         LDKHTLCDescriptor this_ptr_conv;
67855         this_ptr_conv.inner = untag_ptr(this_ptr);
67856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67858         this_ptr_conv.is_owned = false;
67859         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
67860 }
67861
67862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
67863         LDKHTLCDescriptor this_ptr_conv;
67864         this_ptr_conv.inner = untag_ptr(this_ptr);
67865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67867         this_ptr_conv.is_owned = false;
67868         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
67869         int64_t ret_ref = 0;
67870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67872         return ret_ref;
67873 }
67874
67875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67876         LDKHTLCDescriptor this_ptr_conv;
67877         this_ptr_conv.inner = untag_ptr(this_ptr);
67878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67880         this_ptr_conv.is_owned = false;
67881         LDKHTLCOutputInCommitment val_conv;
67882         val_conv.inner = untag_ptr(val);
67883         val_conv.is_owned = ptr_is_owned(val);
67884         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67885         val_conv = HTLCOutputInCommitment_clone(&val_conv);
67886         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
67887 }
67888
67889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
67890         LDKHTLCDescriptor this_ptr_conv;
67891         this_ptr_conv.inner = untag_ptr(this_ptr);
67892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67894         this_ptr_conv.is_owned = false;
67895         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
67896         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
67897         int64_t ret_ref = tag_ptr(ret_copy, true);
67898         return ret_ref;
67899 }
67900
67901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67902         LDKHTLCDescriptor this_ptr_conv;
67903         this_ptr_conv.inner = untag_ptr(this_ptr);
67904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67906         this_ptr_conv.is_owned = false;
67907         void* val_ptr = untag_ptr(val);
67908         CHECK_ACCESS(val_ptr);
67909         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
67910         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
67911         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
67912 }
67913
67914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
67915         LDKHTLCDescriptor this_ptr_conv;
67916         this_ptr_conv.inner = untag_ptr(this_ptr);
67917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67919         this_ptr_conv.is_owned = false;
67920         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
67921         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
67922         return ret_arr;
67923 }
67924
67925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67926         LDKHTLCDescriptor this_ptr_conv;
67927         this_ptr_conv.inner = untag_ptr(this_ptr);
67928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67930         this_ptr_conv.is_owned = false;
67931         LDKECDSASignature val_ref;
67932         CHECK((*env)->GetArrayLength(env, val) == 64);
67933         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
67934         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
67935 }
67936
67937 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
67938         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
67939         int64_t ret_ref = 0;
67940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67942         return ret_ref;
67943 }
67944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67945         LDKHTLCDescriptor arg_conv;
67946         arg_conv.inner = untag_ptr(arg);
67947         arg_conv.is_owned = ptr_is_owned(arg);
67948         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67949         arg_conv.is_owned = false;
67950         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
67951         return ret_conv;
67952 }
67953
67954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67955         LDKHTLCDescriptor orig_conv;
67956         orig_conv.inner = untag_ptr(orig);
67957         orig_conv.is_owned = ptr_is_owned(orig);
67958         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67959         orig_conv.is_owned = false;
67960         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
67961         int64_t ret_ref = 0;
67962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67964         return ret_ref;
67965 }
67966
67967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67968         LDKHTLCDescriptor a_conv;
67969         a_conv.inner = untag_ptr(a);
67970         a_conv.is_owned = ptr_is_owned(a);
67971         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67972         a_conv.is_owned = false;
67973         LDKHTLCDescriptor b_conv;
67974         b_conv.inner = untag_ptr(b);
67975         b_conv.is_owned = ptr_is_owned(b);
67976         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67977         b_conv.is_owned = false;
67978         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
67979         return ret_conv;
67980 }
67981
67982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
67983         LDKHTLCDescriptor obj_conv;
67984         obj_conv.inner = untag_ptr(obj);
67985         obj_conv.is_owned = ptr_is_owned(obj);
67986         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67987         obj_conv.is_owned = false;
67988         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
67989         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67990         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67991         CVec_u8Z_free(ret_var);
67992         return ret_arr;
67993 }
67994
67995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67996         LDKu8slice ser_ref;
67997         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67998         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67999         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
68000         *ret_conv = HTLCDescriptor_read(ser_ref);
68001         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68002         return tag_ptr(ret_conv, true);
68003 }
68004
68005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
68006         LDKHTLCDescriptor this_arg_conv;
68007         this_arg_conv.inner = untag_ptr(this_arg);
68008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68010         this_arg_conv.is_owned = false;
68011         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
68012         int64_t ret_ref = 0;
68013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68015         return ret_ref;
68016 }
68017
68018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
68019         LDKHTLCDescriptor this_arg_conv;
68020         this_arg_conv.inner = untag_ptr(this_arg);
68021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68023         this_arg_conv.is_owned = false;
68024         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68025         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
68026         return tag_ptr(ret_ref, true);
68027 }
68028
68029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
68030         LDKHTLCDescriptor 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         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
68036         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
68037         return tag_ptr(ret_ref, true);
68038 }
68039
68040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
68041         LDKHTLCDescriptor this_arg_conv;
68042         this_arg_conv.inner = untag_ptr(this_arg);
68043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68045         this_arg_conv.is_owned = false;
68046         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68047         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
68048         return tag_ptr(ret_ref, true);
68049 }
68050
68051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
68052         LDKHTLCDescriptor this_arg_conv;
68053         this_arg_conv.inner = untag_ptr(this_arg);
68054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68056         this_arg_conv.is_owned = false;
68057         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
68058         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68059         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68060         CVec_u8Z_free(ret_var);
68061         return ret_arr;
68062 }
68063
68064 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) {
68065         LDKHTLCDescriptor this_arg_conv;
68066         this_arg_conv.inner = untag_ptr(this_arg);
68067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68069         this_arg_conv.is_owned = false;
68070         LDKECDSASignature signature_ref;
68071         CHECK((*env)->GetArrayLength(env, signature) == 64);
68072         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
68073         LDKu8slice witness_script_ref;
68074         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
68075         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
68076         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
68077         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68078         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68079         Witness_free(ret_var);
68080         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
68081         return ret_arr;
68082 }
68083
68084 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) {
68085         LDKHTLCDescriptor this_arg_conv;
68086         this_arg_conv.inner = untag_ptr(this_arg);
68087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68089         this_arg_conv.is_owned = false;
68090         void* signer_provider_ptr = untag_ptr(signer_provider);
68091         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
68092         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
68093         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68094         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
68095         return tag_ptr(ret_ret, true);
68096 }
68097
68098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68099         if (!ptr_is_owned(this_ptr)) return;
68100         void* this_ptr_ptr = untag_ptr(this_ptr);
68101         CHECK_ACCESS(this_ptr_ptr);
68102         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
68103         FREE(untag_ptr(this_ptr));
68104         ChannelSigner_free(this_ptr_conv);
68105 }
68106
68107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68108         if (!ptr_is_owned(this_ptr)) return;
68109         void* this_ptr_ptr = untag_ptr(this_ptr);
68110         CHECK_ACCESS(this_ptr_ptr);
68111         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
68112         FREE(untag_ptr(this_ptr));
68113         EcdsaChannelSigner_free(this_ptr_conv);
68114 }
68115
68116 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
68117         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68118         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
68119         return tag_ptr(ret_ret, true);
68120 }
68121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68122         void* arg_ptr = untag_ptr(arg);
68123         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
68124         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
68125         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
68126         return ret_conv;
68127 }
68128
68129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68130         void* orig_ptr = untag_ptr(orig);
68131         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
68132         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
68133         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68134         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
68135         return tag_ptr(ret_ret, true);
68136 }
68137
68138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68139         if (!ptr_is_owned(this_ptr)) return;
68140         void* this_ptr_ptr = untag_ptr(this_ptr);
68141         CHECK_ACCESS(this_ptr_ptr);
68142         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
68143         FREE(untag_ptr(this_ptr));
68144         WriteableEcdsaChannelSigner_free(this_ptr_conv);
68145 }
68146
68147 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68148         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
68149         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
68150         return ret_conv;
68151 }
68152
68153 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
68154         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
68155         return ret_conv;
68156 }
68157
68158 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
68159         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
68160         return ret_conv;
68161 }
68162
68163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68164         if (!ptr_is_owned(this_ptr)) return;
68165         void* this_ptr_ptr = untag_ptr(this_ptr);
68166         CHECK_ACCESS(this_ptr_ptr);
68167         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
68168         FREE(untag_ptr(this_ptr));
68169         EntropySource_free(this_ptr_conv);
68170 }
68171
68172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68173         if (!ptr_is_owned(this_ptr)) return;
68174         void* this_ptr_ptr = untag_ptr(this_ptr);
68175         CHECK_ACCESS(this_ptr_ptr);
68176         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
68177         FREE(untag_ptr(this_ptr));
68178         NodeSigner_free(this_ptr_conv);
68179 }
68180
68181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68182         if (!ptr_is_owned(this_ptr)) return;
68183         void* this_ptr_ptr = untag_ptr(this_ptr);
68184         CHECK_ACCESS(this_ptr_ptr);
68185         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
68186         FREE(untag_ptr(this_ptr));
68187         SignerProvider_free(this_ptr_conv);
68188 }
68189
68190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68191         LDKInMemorySigner this_obj_conv;
68192         this_obj_conv.inner = untag_ptr(this_obj);
68193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68195         InMemorySigner_free(this_obj_conv);
68196 }
68197
68198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68199         LDKInMemorySigner this_ptr_conv;
68200         this_ptr_conv.inner = untag_ptr(this_ptr);
68201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68203         this_ptr_conv.is_owned = false;
68204         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68205         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
68206         return ret_arr;
68207 }
68208
68209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68210         LDKInMemorySigner this_ptr_conv;
68211         this_ptr_conv.inner = untag_ptr(this_ptr);
68212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68214         this_ptr_conv.is_owned = false;
68215         LDKSecretKey val_ref;
68216         CHECK((*env)->GetArrayLength(env, val) == 32);
68217         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68218         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
68219 }
68220
68221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68222         LDKInMemorySigner this_ptr_conv;
68223         this_ptr_conv.inner = untag_ptr(this_ptr);
68224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68226         this_ptr_conv.is_owned = false;
68227         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68228         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
68229         return ret_arr;
68230 }
68231
68232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68233         LDKInMemorySigner this_ptr_conv;
68234         this_ptr_conv.inner = untag_ptr(this_ptr);
68235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68237         this_ptr_conv.is_owned = false;
68238         LDKSecretKey val_ref;
68239         CHECK((*env)->GetArrayLength(env, val) == 32);
68240         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68241         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
68242 }
68243
68244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68245         LDKInMemorySigner this_ptr_conv;
68246         this_ptr_conv.inner = untag_ptr(this_ptr);
68247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68249         this_ptr_conv.is_owned = false;
68250         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68251         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
68252         return ret_arr;
68253 }
68254
68255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68256         LDKInMemorySigner this_ptr_conv;
68257         this_ptr_conv.inner = untag_ptr(this_ptr);
68258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68260         this_ptr_conv.is_owned = false;
68261         LDKSecretKey val_ref;
68262         CHECK((*env)->GetArrayLength(env, val) == 32);
68263         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68264         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
68265 }
68266
68267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68268         LDKInMemorySigner this_ptr_conv;
68269         this_ptr_conv.inner = untag_ptr(this_ptr);
68270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68272         this_ptr_conv.is_owned = false;
68273         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68274         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
68275         return ret_arr;
68276 }
68277
68278 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) {
68279         LDKInMemorySigner this_ptr_conv;
68280         this_ptr_conv.inner = untag_ptr(this_ptr);
68281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68283         this_ptr_conv.is_owned = false;
68284         LDKSecretKey val_ref;
68285         CHECK((*env)->GetArrayLength(env, val) == 32);
68286         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68287         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
68288 }
68289
68290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
68291         LDKInMemorySigner this_ptr_conv;
68292         this_ptr_conv.inner = untag_ptr(this_ptr);
68293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68295         this_ptr_conv.is_owned = false;
68296         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68297         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
68298         return ret_arr;
68299 }
68300
68301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68302         LDKInMemorySigner this_ptr_conv;
68303         this_ptr_conv.inner = untag_ptr(this_ptr);
68304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68306         this_ptr_conv.is_owned = false;
68307         LDKSecretKey val_ref;
68308         CHECK((*env)->GetArrayLength(env, val) == 32);
68309         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
68310         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
68311 }
68312
68313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
68314         LDKInMemorySigner this_ptr_conv;
68315         this_ptr_conv.inner = untag_ptr(this_ptr);
68316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68318         this_ptr_conv.is_owned = false;
68319         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68320         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
68321         return ret_arr;
68322 }
68323
68324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68325         LDKInMemorySigner this_ptr_conv;
68326         this_ptr_conv.inner = untag_ptr(this_ptr);
68327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68329         this_ptr_conv.is_owned = false;
68330         LDKThirtyTwoBytes val_ref;
68331         CHECK((*env)->GetArrayLength(env, val) == 32);
68332         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
68333         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
68334 }
68335
68336 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
68337         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
68338         int64_t ret_ref = 0;
68339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68341         return ret_ref;
68342 }
68343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68344         LDKInMemorySigner arg_conv;
68345         arg_conv.inner = untag_ptr(arg);
68346         arg_conv.is_owned = ptr_is_owned(arg);
68347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68348         arg_conv.is_owned = false;
68349         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
68350         return ret_conv;
68351 }
68352
68353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68354         LDKInMemorySigner orig_conv;
68355         orig_conv.inner = untag_ptr(orig);
68356         orig_conv.is_owned = ptr_is_owned(orig);
68357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68358         orig_conv.is_owned = false;
68359         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
68360         int64_t ret_ref = 0;
68361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68363         return ret_ref;
68364 }
68365
68366 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) {
68367         LDKSecretKey funding_key_ref;
68368         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
68369         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
68370         LDKSecretKey revocation_base_key_ref;
68371         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
68372         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
68373         LDKSecretKey payment_key_ref;
68374         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
68375         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
68376         LDKSecretKey delayed_payment_base_key_ref;
68377         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
68378         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
68379         LDKSecretKey htlc_base_key_ref;
68380         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
68381         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
68382         LDKThirtyTwoBytes commitment_seed_ref;
68383         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
68384         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
68385         LDKThirtyTwoBytes channel_keys_id_ref;
68386         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
68387         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
68388         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
68389         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
68390         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
68391         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);
68392         int64_t ret_ref = 0;
68393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68395         return ret_ref;
68396 }
68397
68398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
68399         LDKInMemorySigner this_arg_conv;
68400         this_arg_conv.inner = untag_ptr(this_arg);
68401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68403         this_arg_conv.is_owned = false;
68404         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
68405         int64_t ret_ref = 0;
68406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68408         return ret_ref;
68409 }
68410
68411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
68412         LDKInMemorySigner this_arg_conv;
68413         this_arg_conv.inner = untag_ptr(this_arg);
68414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68416         this_arg_conv.is_owned = false;
68417         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
68418         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
68419         int64_t ret_ref = tag_ptr(ret_copy, true);
68420         return ret_ref;
68421 }
68422
68423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
68424         LDKInMemorySigner this_arg_conv;
68425         this_arg_conv.inner = untag_ptr(this_arg);
68426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68428         this_arg_conv.is_owned = false;
68429         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
68430         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
68431         int64_t ret_ref = tag_ptr(ret_copy, true);
68432         return ret_ref;
68433 }
68434
68435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
68436         LDKInMemorySigner this_arg_conv;
68437         this_arg_conv.inner = untag_ptr(this_arg);
68438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68440         this_arg_conv.is_owned = false;
68441         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
68442         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
68443         int64_t ret_ref = tag_ptr(ret_copy, true);
68444         return ret_ref;
68445 }
68446
68447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
68448         LDKInMemorySigner this_arg_conv;
68449         this_arg_conv.inner = untag_ptr(this_arg);
68450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68452         this_arg_conv.is_owned = false;
68453         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
68454         int64_t ret_ref = 0;
68455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68457         return ret_ref;
68458 }
68459
68460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
68461         LDKInMemorySigner this_arg_conv;
68462         this_arg_conv.inner = untag_ptr(this_arg);
68463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68465         this_arg_conv.is_owned = false;
68466         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
68467         int64_t ret_ref = 0;
68468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68470         return ret_ref;
68471 }
68472
68473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
68474         LDKInMemorySigner this_arg_conv;
68475         this_arg_conv.inner = untag_ptr(this_arg);
68476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68478         this_arg_conv.is_owned = false;
68479         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
68480         int64_t ret_ref = 0;
68481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68483         return ret_ref;
68484 }
68485
68486 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) {
68487         LDKInMemorySigner this_arg_conv;
68488         this_arg_conv.inner = untag_ptr(this_arg);
68489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68491         this_arg_conv.is_owned = false;
68492         LDKTransaction spend_tx_ref;
68493         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
68494         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
68495         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
68496         spend_tx_ref.data_is_owned = true;
68497         LDKStaticPaymentOutputDescriptor descriptor_conv;
68498         descriptor_conv.inner = untag_ptr(descriptor);
68499         descriptor_conv.is_owned = ptr_is_owned(descriptor);
68500         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
68501         descriptor_conv.is_owned = false;
68502         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
68503         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
68504         return tag_ptr(ret_conv, true);
68505 }
68506
68507 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) {
68508         LDKInMemorySigner this_arg_conv;
68509         this_arg_conv.inner = untag_ptr(this_arg);
68510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68512         this_arg_conv.is_owned = false;
68513         LDKTransaction spend_tx_ref;
68514         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
68515         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
68516         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
68517         spend_tx_ref.data_is_owned = true;
68518         LDKDelayedPaymentOutputDescriptor descriptor_conv;
68519         descriptor_conv.inner = untag_ptr(descriptor);
68520         descriptor_conv.is_owned = ptr_is_owned(descriptor);
68521         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
68522         descriptor_conv.is_owned = false;
68523         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
68524         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
68525         return tag_ptr(ret_conv, true);
68526 }
68527
68528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
68529         LDKInMemorySigner this_arg_conv;
68530         this_arg_conv.inner = untag_ptr(this_arg);
68531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68533         this_arg_conv.is_owned = false;
68534         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
68535         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
68536         return tag_ptr(ret_ret, true);
68537 }
68538
68539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68540         LDKInMemorySigner this_arg_conv;
68541         this_arg_conv.inner = untag_ptr(this_arg);
68542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68544         this_arg_conv.is_owned = false;
68545         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
68546         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
68547         return tag_ptr(ret_ret, true);
68548 }
68549
68550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68551         LDKInMemorySigner this_arg_conv;
68552         this_arg_conv.inner = untag_ptr(this_arg);
68553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68555         this_arg_conv.is_owned = false;
68556         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
68557         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
68558         return tag_ptr(ret_ret, true);
68559 }
68560
68561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68562         LDKInMemorySigner this_arg_conv;
68563         this_arg_conv.inner = untag_ptr(this_arg);
68564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68566         this_arg_conv.is_owned = false;
68567         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68568         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
68569         return tag_ptr(ret_ret, true);
68570 }
68571
68572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
68573         LDKInMemorySigner obj_conv;
68574         obj_conv.inner = untag_ptr(obj);
68575         obj_conv.is_owned = ptr_is_owned(obj);
68576         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68577         obj_conv.is_owned = false;
68578         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
68579         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68580         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68581         CVec_u8Z_free(ret_var);
68582         return ret_arr;
68583 }
68584
68585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
68586         LDKu8slice ser_ref;
68587         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68588         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68589         void* arg_ptr = untag_ptr(arg);
68590         CHECK_ACCESS(arg_ptr);
68591         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
68592         if (arg_conv.free == LDKEntropySource_JCalls_free) {
68593                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68594                 LDKEntropySource_JCalls_cloned(&arg_conv);
68595         }
68596         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
68597         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
68598         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68599         return tag_ptr(ret_conv, true);
68600 }
68601
68602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68603         LDKKeysManager this_obj_conv;
68604         this_obj_conv.inner = untag_ptr(this_obj);
68605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68607         KeysManager_free(this_obj_conv);
68608 }
68609
68610 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) {
68611         uint8_t seed_arr[32];
68612         CHECK((*env)->GetArrayLength(env, seed) == 32);
68613         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
68614         uint8_t (*seed_ref)[32] = &seed_arr;
68615         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
68616         int64_t ret_ref = 0;
68617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68619         return ret_ref;
68620 }
68621
68622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68623         LDKKeysManager this_arg_conv;
68624         this_arg_conv.inner = untag_ptr(this_arg);
68625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68627         this_arg_conv.is_owned = false;
68628         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68629         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
68630         return ret_arr;
68631 }
68632
68633 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) {
68634         LDKKeysManager this_arg_conv;
68635         this_arg_conv.inner = untag_ptr(this_arg);
68636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68638         this_arg_conv.is_owned = false;
68639         uint8_t params_arr[32];
68640         CHECK((*env)->GetArrayLength(env, params) == 32);
68641         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
68642         uint8_t (*params_ref)[32] = &params_arr;
68643         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
68644         int64_t ret_ref = 0;
68645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68647         return ret_ref;
68648 }
68649
68650 JNIEXPORT 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) {
68651         LDKKeysManager this_arg_conv;
68652         this_arg_conv.inner = untag_ptr(this_arg);
68653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68655         this_arg_conv.is_owned = false;
68656         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68657         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
68658         if (descriptors_constr.datalen > 0)
68659                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68660         else
68661                 descriptors_constr.data = NULL;
68662         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
68663         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68664                 int64_t descriptors_conv_27 = descriptors_vals[b];
68665                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68666                 CHECK_ACCESS(descriptors_conv_27_ptr);
68667                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68668                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68669                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68670         }
68671         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
68672         LDKCVec_u8Z psbt_ref;
68673         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
68674         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
68675         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
68676         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
68677         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
68678         return tag_ptr(ret_conv, true);
68679 }
68680
68681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
68682         LDKKeysManager this_arg_conv;
68683         this_arg_conv.inner = untag_ptr(this_arg);
68684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68686         this_arg_conv.is_owned = false;
68687         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68688         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
68689         if (descriptors_constr.datalen > 0)
68690                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68691         else
68692                 descriptors_constr.data = NULL;
68693         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
68694         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68695                 int64_t descriptors_conv_27 = descriptors_vals[b];
68696                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68697                 CHECK_ACCESS(descriptors_conv_27_ptr);
68698                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68699                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68700                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68701         }
68702         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
68703         LDKCVec_TxOutZ outputs_constr;
68704         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
68705         if (outputs_constr.datalen > 0)
68706                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
68707         else
68708                 outputs_constr.data = NULL;
68709         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
68710         for (size_t h = 0; h < outputs_constr.datalen; h++) {
68711                 int64_t outputs_conv_7 = outputs_vals[h];
68712                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
68713                 CHECK_ACCESS(outputs_conv_7_ptr);
68714                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
68715                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
68716                 outputs_constr.data[h] = outputs_conv_7_conv;
68717         }
68718         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
68719         LDKCVec_u8Z change_destination_script_ref;
68720         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
68721         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
68722         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
68723         void* locktime_ptr = untag_ptr(locktime);
68724         CHECK_ACCESS(locktime_ptr);
68725         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
68726         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
68727         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
68728         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
68729         return tag_ptr(ret_conv, true);
68730 }
68731
68732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
68733         LDKKeysManager this_arg_conv;
68734         this_arg_conv.inner = untag_ptr(this_arg);
68735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68737         this_arg_conv.is_owned = false;
68738         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
68739         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
68740         return tag_ptr(ret_ret, true);
68741 }
68742
68743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68744         LDKKeysManager this_arg_conv;
68745         this_arg_conv.inner = untag_ptr(this_arg);
68746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68748         this_arg_conv.is_owned = false;
68749         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
68750         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
68751         return tag_ptr(ret_ret, true);
68752 }
68753
68754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
68755         LDKKeysManager this_arg_conv;
68756         this_arg_conv.inner = untag_ptr(this_arg);
68757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68759         this_arg_conv.is_owned = false;
68760         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
68761         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
68762         return tag_ptr(ret_ret, true);
68763 }
68764
68765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68766         LDKPhantomKeysManager this_obj_conv;
68767         this_obj_conv.inner = untag_ptr(this_obj);
68768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68770         PhantomKeysManager_free(this_obj_conv);
68771 }
68772
68773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
68774         LDKPhantomKeysManager this_arg_conv;
68775         this_arg_conv.inner = untag_ptr(this_arg);
68776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68778         this_arg_conv.is_owned = false;
68779         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
68780         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
68781         return tag_ptr(ret_ret, true);
68782 }
68783
68784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
68785         LDKPhantomKeysManager this_arg_conv;
68786         this_arg_conv.inner = untag_ptr(this_arg);
68787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68789         this_arg_conv.is_owned = false;
68790         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
68791         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
68792         return tag_ptr(ret_ret, true);
68793 }
68794
68795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
68796         LDKPhantomKeysManager this_arg_conv;
68797         this_arg_conv.inner = untag_ptr(this_arg);
68798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68800         this_arg_conv.is_owned = false;
68801         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
68802         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
68803         return tag_ptr(ret_ret, true);
68804 }
68805
68806 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) {
68807         uint8_t seed_arr[32];
68808         CHECK((*env)->GetArrayLength(env, seed) == 32);
68809         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
68810         uint8_t (*seed_ref)[32] = &seed_arr;
68811         uint8_t cross_node_seed_arr[32];
68812         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
68813         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
68814         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
68815         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
68816         int64_t ret_ref = 0;
68817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68819         return ret_ref;
68820 }
68821
68822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
68823         LDKPhantomKeysManager this_arg_conv;
68824         this_arg_conv.inner = untag_ptr(this_arg);
68825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68827         this_arg_conv.is_owned = false;
68828         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68829         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
68830         if (descriptors_constr.datalen > 0)
68831                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68832         else
68833                 descriptors_constr.data = NULL;
68834         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
68835         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68836                 int64_t descriptors_conv_27 = descriptors_vals[b];
68837                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68838                 CHECK_ACCESS(descriptors_conv_27_ptr);
68839                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68840                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68841                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68842         }
68843         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
68844         LDKCVec_TxOutZ outputs_constr;
68845         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
68846         if (outputs_constr.datalen > 0)
68847                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
68848         else
68849                 outputs_constr.data = NULL;
68850         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
68851         for (size_t h = 0; h < outputs_constr.datalen; h++) {
68852                 int64_t outputs_conv_7 = outputs_vals[h];
68853                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
68854                 CHECK_ACCESS(outputs_conv_7_ptr);
68855                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
68856                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
68857                 outputs_constr.data[h] = outputs_conv_7_conv;
68858         }
68859         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
68860         LDKCVec_u8Z change_destination_script_ref;
68861         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
68862         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
68863         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
68864         void* locktime_ptr = untag_ptr(locktime);
68865         CHECK_ACCESS(locktime_ptr);
68866         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
68867         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
68868         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
68869         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
68870         return tag_ptr(ret_conv, true);
68871 }
68872
68873 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) {
68874         LDKPhantomKeysManager this_arg_conv;
68875         this_arg_conv.inner = untag_ptr(this_arg);
68876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68878         this_arg_conv.is_owned = false;
68879         uint8_t params_arr[32];
68880         CHECK((*env)->GetArrayLength(env, params) == 32);
68881         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
68882         uint8_t (*params_ref)[32] = &params_arr;
68883         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
68884         int64_t ret_ref = 0;
68885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68887         return ret_ref;
68888 }
68889
68890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68891         LDKPhantomKeysManager this_arg_conv;
68892         this_arg_conv.inner = untag_ptr(this_arg);
68893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68895         this_arg_conv.is_owned = false;
68896         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68897         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
68898         return ret_arr;
68899 }
68900
68901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68902         LDKPhantomKeysManager this_arg_conv;
68903         this_arg_conv.inner = untag_ptr(this_arg);
68904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68906         this_arg_conv.is_owned = false;
68907         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68908         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
68909         return ret_arr;
68910 }
68911
68912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68913         LDKOnionMessenger this_obj_conv;
68914         this_obj_conv.inner = untag_ptr(this_obj);
68915         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68917         OnionMessenger_free(this_obj_conv);
68918 }
68919
68920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68921         if (!ptr_is_owned(this_ptr)) return;
68922         void* this_ptr_ptr = untag_ptr(this_ptr);
68923         CHECK_ACCESS(this_ptr_ptr);
68924         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
68925         FREE(untag_ptr(this_ptr));
68926         MessageRouter_free(this_ptr_conv);
68927 }
68928
68929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68930         LDKDefaultMessageRouter this_obj_conv;
68931         this_obj_conv.inner = untag_ptr(this_obj);
68932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68934         DefaultMessageRouter_free(this_obj_conv);
68935 }
68936
68937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz) {
68938         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
68939         int64_t ret_ref = 0;
68940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68942         return ret_ref;
68943 }
68944
68945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
68946         LDKDefaultMessageRouter this_arg_conv;
68947         this_arg_conv.inner = untag_ptr(this_arg);
68948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68950         this_arg_conv.is_owned = false;
68951         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
68952         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
68953         return tag_ptr(ret_ret, true);
68954 }
68955
68956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68957         LDKOnionMessagePath this_obj_conv;
68958         this_obj_conv.inner = untag_ptr(this_obj);
68959         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68961         OnionMessagePath_free(this_obj_conv);
68962 }
68963
68964 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
68965         LDKOnionMessagePath this_ptr_conv;
68966         this_ptr_conv.inner = untag_ptr(this_ptr);
68967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68969         this_ptr_conv.is_owned = false;
68970         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
68971         jobjectArray ret_arr = NULL;
68972         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
68973         ;
68974         for (size_t i = 0; i < ret_var.datalen; i++) {
68975                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
68976                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
68977                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
68978         }
68979         
68980         FREE(ret_var.data);
68981         return ret_arr;
68982 }
68983
68984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
68985         LDKOnionMessagePath this_ptr_conv;
68986         this_ptr_conv.inner = untag_ptr(this_ptr);
68987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68989         this_ptr_conv.is_owned = false;
68990         LDKCVec_PublicKeyZ val_constr;
68991         val_constr.datalen = (*env)->GetArrayLength(env, val);
68992         if (val_constr.datalen > 0)
68993                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
68994         else
68995                 val_constr.data = NULL;
68996         for (size_t i = 0; i < val_constr.datalen; i++) {
68997                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
68998                 LDKPublicKey val_conv_8_ref;
68999                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
69000                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
69001                 val_constr.data[i] = val_conv_8_ref;
69002         }
69003         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
69004 }
69005
69006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
69007         LDKOnionMessagePath this_ptr_conv;
69008         this_ptr_conv.inner = untag_ptr(this_ptr);
69009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69011         this_ptr_conv.is_owned = false;
69012         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69013         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
69014         int64_t ret_ref = tag_ptr(ret_copy, true);
69015         return ret_ref;
69016 }
69017
69018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69019         LDKOnionMessagePath this_ptr_conv;
69020         this_ptr_conv.inner = untag_ptr(this_ptr);
69021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69023         this_ptr_conv.is_owned = false;
69024         void* val_ptr = untag_ptr(val);
69025         CHECK_ACCESS(val_ptr);
69026         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
69027         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
69028         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
69029 }
69030
69031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg) {
69032         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
69033         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
69034         if (intermediate_nodes_arg_constr.datalen > 0)
69035                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69036         else
69037                 intermediate_nodes_arg_constr.data = NULL;
69038         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
69039                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
69040                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
69041                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
69042                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
69043                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
69044         }
69045         void* destination_arg_ptr = untag_ptr(destination_arg);
69046         CHECK_ACCESS(destination_arg_ptr);
69047         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
69048         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
69049         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
69050         int64_t ret_ref = 0;
69051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69053         return ret_ref;
69054 }
69055
69056 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
69057         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
69058         int64_t ret_ref = 0;
69059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69061         return ret_ref;
69062 }
69063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69064         LDKOnionMessagePath arg_conv;
69065         arg_conv.inner = untag_ptr(arg);
69066         arg_conv.is_owned = ptr_is_owned(arg);
69067         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69068         arg_conv.is_owned = false;
69069         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
69070         return ret_conv;
69071 }
69072
69073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69074         LDKOnionMessagePath orig_conv;
69075         orig_conv.inner = untag_ptr(orig);
69076         orig_conv.is_owned = ptr_is_owned(orig);
69077         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69078         orig_conv.is_owned = false;
69079         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
69080         int64_t ret_ref = 0;
69081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69083         return ret_ref;
69084 }
69085
69086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69087         if (!ptr_is_owned(this_ptr)) return;
69088         void* this_ptr_ptr = untag_ptr(this_ptr);
69089         CHECK_ACCESS(this_ptr_ptr);
69090         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
69091         FREE(untag_ptr(this_ptr));
69092         Destination_free(this_ptr_conv);
69093 }
69094
69095 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
69096         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69097         *ret_copy = Destination_clone(arg);
69098         int64_t ret_ref = tag_ptr(ret_copy, true);
69099         return ret_ref;
69100 }
69101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69102         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
69103         int64_t ret_conv = Destination_clone_ptr(arg_conv);
69104         return ret_conv;
69105 }
69106
69107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69108         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
69109         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69110         *ret_copy = Destination_clone(orig_conv);
69111         int64_t ret_ref = tag_ptr(ret_copy, true);
69112         return ret_ref;
69113 }
69114
69115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
69116         LDKPublicKey a_ref;
69117         CHECK((*env)->GetArrayLength(env, a) == 33);
69118         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
69119         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69120         *ret_copy = Destination_node(a_ref);
69121         int64_t ret_ref = tag_ptr(ret_copy, true);
69122         return ret_ref;
69123 }
69124
69125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
69126         LDKBlindedPath a_conv;
69127         a_conv.inner = untag_ptr(a);
69128         a_conv.is_owned = ptr_is_owned(a);
69129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69130         a_conv = BlindedPath_clone(&a_conv);
69131         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69132         *ret_copy = Destination_blinded_path(a_conv);
69133         int64_t ret_ref = tag_ptr(ret_copy, true);
69134         return ret_ref;
69135 }
69136
69137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69138         if (!ptr_is_owned(this_ptr)) return;
69139         void* this_ptr_ptr = untag_ptr(this_ptr);
69140         CHECK_ACCESS(this_ptr_ptr);
69141         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
69142         FREE(untag_ptr(this_ptr));
69143         SendError_free(this_ptr_conv);
69144 }
69145
69146 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
69147         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69148         *ret_copy = SendError_clone(arg);
69149         int64_t ret_ref = tag_ptr(ret_copy, true);
69150         return ret_ref;
69151 }
69152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69153         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
69154         int64_t ret_conv = SendError_clone_ptr(arg_conv);
69155         return ret_conv;
69156 }
69157
69158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69159         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
69160         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69161         *ret_copy = SendError_clone(orig_conv);
69162         int64_t ret_ref = tag_ptr(ret_copy, true);
69163         return ret_ref;
69164 }
69165
69166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
69167         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
69168         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69169         *ret_copy = SendError_secp256k1(a_conv);
69170         int64_t ret_ref = tag_ptr(ret_copy, true);
69171         return ret_ref;
69172 }
69173
69174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
69175         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69176         *ret_copy = SendError_too_big_packet();
69177         int64_t ret_ref = tag_ptr(ret_copy, true);
69178         return ret_ref;
69179 }
69180
69181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
69182         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69183         *ret_copy = SendError_too_few_blinded_hops();
69184         int64_t ret_ref = tag_ptr(ret_copy, true);
69185         return ret_ref;
69186 }
69187
69188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz) {
69189         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69190         *ret_copy = SendError_invalid_first_hop();
69191         int64_t ret_ref = tag_ptr(ret_copy, true);
69192         return ret_ref;
69193 }
69194
69195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
69196         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69197         *ret_copy = SendError_invalid_message();
69198         int64_t ret_ref = tag_ptr(ret_copy, true);
69199         return ret_ref;
69200 }
69201
69202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
69203         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69204         *ret_copy = SendError_buffer_full();
69205         int64_t ret_ref = tag_ptr(ret_copy, true);
69206         return ret_ref;
69207 }
69208
69209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
69210         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69211         *ret_copy = SendError_get_node_id_failed();
69212         int64_t ret_ref = tag_ptr(ret_copy, true);
69213         return ret_ref;
69214 }
69215
69216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
69217         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
69218         *ret_copy = SendError_blinded_path_advance_failed();
69219         int64_t ret_ref = tag_ptr(ret_copy, true);
69220         return ret_ref;
69221 }
69222
69223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69224         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
69225         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
69226         jboolean ret_conv = SendError_eq(a_conv, b_conv);
69227         return ret_conv;
69228 }
69229
69230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69231         if (!ptr_is_owned(this_ptr)) return;
69232         void* this_ptr_ptr = untag_ptr(this_ptr);
69233         CHECK_ACCESS(this_ptr_ptr);
69234         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
69235         FREE(untag_ptr(this_ptr));
69236         CustomOnionMessageHandler_free(this_ptr_conv);
69237 }
69238
69239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69240         if (!ptr_is_owned(this_ptr)) return;
69241         void* this_ptr_ptr = untag_ptr(this_ptr);
69242         CHECK_ACCESS(this_ptr_ptr);
69243         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
69244         FREE(untag_ptr(this_ptr));
69245         PeeledOnion_free(this_ptr_conv);
69246 }
69247
69248 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
69249         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69250         *ret_copy = PeeledOnion_clone(arg);
69251         int64_t ret_ref = tag_ptr(ret_copy, true);
69252         return ret_ref;
69253 }
69254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69255         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
69256         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
69257         return ret_conv;
69258 }
69259
69260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69261         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
69262         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69263         *ret_copy = PeeledOnion_clone(orig_conv);
69264         int64_t ret_ref = tag_ptr(ret_copy, true);
69265         return ret_ref;
69266 }
69267
69268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
69269         LDKPublicKey a_ref;
69270         CHECK((*env)->GetArrayLength(env, a) == 33);
69271         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
69272         LDKOnionMessage b_conv;
69273         b_conv.inner = untag_ptr(b);
69274         b_conv.is_owned = ptr_is_owned(b);
69275         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69276         b_conv = OnionMessage_clone(&b_conv);
69277         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69278         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
69279         int64_t ret_ref = tag_ptr(ret_copy, true);
69280         return ret_ref;
69281 }
69282
69283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
69284         void* a_ptr = untag_ptr(a);
69285         CHECK_ACCESS(a_ptr);
69286         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
69287         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
69288         LDKThirtyTwoBytes b_ref;
69289         CHECK((*env)->GetArrayLength(env, b) == 32);
69290         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
69291         LDKBlindedPath c_conv;
69292         c_conv.inner = untag_ptr(c);
69293         c_conv.is_owned = ptr_is_owned(c);
69294         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
69295         c_conv = BlindedPath_clone(&c_conv);
69296         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
69297         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
69298         int64_t ret_ref = tag_ptr(ret_copy, true);
69299         return ret_ref;
69300 }
69301
69302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t path, int64_t contents, int64_t reply_path) {
69303         void* entropy_source_ptr = untag_ptr(entropy_source);
69304         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
69305         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
69306         void* node_signer_ptr = untag_ptr(node_signer);
69307         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
69308         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
69309         LDKOnionMessagePath path_conv;
69310         path_conv.inner = untag_ptr(path);
69311         path_conv.is_owned = ptr_is_owned(path);
69312         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69313         path_conv = OnionMessagePath_clone(&path_conv);
69314         void* contents_ptr = untag_ptr(contents);
69315         CHECK_ACCESS(contents_ptr);
69316         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
69317         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
69318                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69319                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
69320         }
69321         LDKBlindedPath reply_path_conv;
69322         reply_path_conv.inner = untag_ptr(reply_path);
69323         reply_path_conv.is_owned = ptr_is_owned(reply_path);
69324         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
69325         reply_path_conv = BlindedPath_clone(&reply_path_conv);
69326         LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ");
69327         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
69328         return tag_ptr(ret_conv, true);
69329 }
69330
69331 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) {
69332         LDKOnionMessage msg_conv;
69333         msg_conv.inner = untag_ptr(msg);
69334         msg_conv.is_owned = ptr_is_owned(msg);
69335         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69336         msg_conv.is_owned = false;
69337         void* node_signer_ptr = untag_ptr(node_signer);
69338         CHECK_ACCESS(node_signer_ptr);
69339         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69340         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69341                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69342                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69343         }
69344         void* logger_ptr = untag_ptr(logger);
69345         CHECK_ACCESS(logger_ptr);
69346         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69347         if (logger_conv.free == LDKLogger_JCalls_free) {
69348                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69349                 LDKLogger_JCalls_cloned(&logger_conv);
69350         }
69351         void* custom_handler_ptr = untag_ptr(custom_handler);
69352         CHECK_ACCESS(custom_handler_ptr);
69353         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
69354         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
69355                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69356                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
69357         }
69358         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
69359         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
69360         return tag_ptr(ret_conv, true);
69361 }
69362
69363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
69364         void* entropy_source_ptr = untag_ptr(entropy_source);
69365         CHECK_ACCESS(entropy_source_ptr);
69366         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69367         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69369                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69370         }
69371         void* node_signer_ptr = untag_ptr(node_signer);
69372         CHECK_ACCESS(node_signer_ptr);
69373         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69374         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69375                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69376                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69377         }
69378         void* logger_ptr = untag_ptr(logger);
69379         CHECK_ACCESS(logger_ptr);
69380         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69381         if (logger_conv.free == LDKLogger_JCalls_free) {
69382                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69383                 LDKLogger_JCalls_cloned(&logger_conv);
69384         }
69385         void* message_router_ptr = untag_ptr(message_router);
69386         CHECK_ACCESS(message_router_ptr);
69387         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
69388         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
69389                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69390                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
69391         }
69392         void* offers_handler_ptr = untag_ptr(offers_handler);
69393         CHECK_ACCESS(offers_handler_ptr);
69394         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
69395         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
69396                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69397                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
69398         }
69399         void* custom_handler_ptr = untag_ptr(custom_handler);
69400         CHECK_ACCESS(custom_handler_ptr);
69401         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
69402         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
69403                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69404                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
69405         }
69406         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
69407         int64_t ret_ref = 0;
69408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69410         return ret_ref;
69411 }
69412
69413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t contents, int64_t reply_path) {
69414         LDKOnionMessenger this_arg_conv;
69415         this_arg_conv.inner = untag_ptr(this_arg);
69416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69418         this_arg_conv.is_owned = false;
69419         LDKOnionMessagePath path_conv;
69420         path_conv.inner = untag_ptr(path);
69421         path_conv.is_owned = ptr_is_owned(path);
69422         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69423         path_conv = OnionMessagePath_clone(&path_conv);
69424         void* contents_ptr = untag_ptr(contents);
69425         CHECK_ACCESS(contents_ptr);
69426         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
69427         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
69428                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69429                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
69430         }
69431         LDKBlindedPath reply_path_conv;
69432         reply_path_conv.inner = untag_ptr(reply_path);
69433         reply_path_conv.is_owned = ptr_is_owned(reply_path);
69434         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
69435         reply_path_conv = BlindedPath_clone(&reply_path_conv);
69436         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
69437         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, contents_conv, reply_path_conv);
69438         return tag_ptr(ret_conv, true);
69439 }
69440
69441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
69442         LDKOnionMessenger this_arg_conv;
69443         this_arg_conv.inner = untag_ptr(this_arg);
69444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69446         this_arg_conv.is_owned = false;
69447         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
69448         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
69449         return tag_ptr(ret_ret, true);
69450 }
69451
69452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69453         if (!ptr_is_owned(this_ptr)) return;
69454         void* this_ptr_ptr = untag_ptr(this_ptr);
69455         CHECK_ACCESS(this_ptr_ptr);
69456         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
69457         FREE(untag_ptr(this_ptr));
69458         OffersMessageHandler_free(this_ptr_conv);
69459 }
69460
69461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69462         if (!ptr_is_owned(this_ptr)) return;
69463         void* this_ptr_ptr = untag_ptr(this_ptr);
69464         CHECK_ACCESS(this_ptr_ptr);
69465         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
69466         FREE(untag_ptr(this_ptr));
69467         OffersMessage_free(this_ptr_conv);
69468 }
69469
69470 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
69471         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69472         *ret_copy = OffersMessage_clone(arg);
69473         int64_t ret_ref = tag_ptr(ret_copy, true);
69474         return ret_ref;
69475 }
69476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69477         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
69478         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
69479         return ret_conv;
69480 }
69481
69482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69483         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
69484         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69485         *ret_copy = OffersMessage_clone(orig_conv);
69486         int64_t ret_ref = tag_ptr(ret_copy, true);
69487         return ret_ref;
69488 }
69489
69490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
69491         LDKInvoiceRequest a_conv;
69492         a_conv.inner = untag_ptr(a);
69493         a_conv.is_owned = ptr_is_owned(a);
69494         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69495         a_conv = InvoiceRequest_clone(&a_conv);
69496         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69497         *ret_copy = OffersMessage_invoice_request(a_conv);
69498         int64_t ret_ref = tag_ptr(ret_copy, true);
69499         return ret_ref;
69500 }
69501
69502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
69503         LDKBolt12Invoice a_conv;
69504         a_conv.inner = untag_ptr(a);
69505         a_conv.is_owned = ptr_is_owned(a);
69506         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69507         a_conv = Bolt12Invoice_clone(&a_conv);
69508         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69509         *ret_copy = OffersMessage_invoice(a_conv);
69510         int64_t ret_ref = tag_ptr(ret_copy, true);
69511         return ret_ref;
69512 }
69513
69514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
69515         LDKInvoiceError a_conv;
69516         a_conv.inner = untag_ptr(a);
69517         a_conv.is_owned = ptr_is_owned(a);
69518         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69519         a_conv = InvoiceError_clone(&a_conv);
69520         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
69521         *ret_copy = OffersMessage_invoice_error(a_conv);
69522         int64_t ret_ref = tag_ptr(ret_copy, true);
69523         return ret_ref;
69524 }
69525
69526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
69527         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
69528         return ret_conv;
69529 }
69530
69531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
69532         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
69533         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
69534         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69535         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69536         CVec_u8Z_free(ret_var);
69537         return ret_arr;
69538 }
69539
69540 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) {
69541         LDKu8slice ser_ref;
69542         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69543         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69544         void* arg_b_ptr = untag_ptr(arg_b);
69545         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
69546         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
69547         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
69548         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
69549         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69550         return tag_ptr(ret_conv, true);
69551 }
69552
69553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69554         LDKPacket this_obj_conv;
69555         this_obj_conv.inner = untag_ptr(this_obj);
69556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69558         Packet_free(this_obj_conv);
69559 }
69560
69561 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
69562         LDKPacket this_ptr_conv;
69563         this_ptr_conv.inner = untag_ptr(this_ptr);
69564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69566         this_ptr_conv.is_owned = false;
69567         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
69568         return ret_conv;
69569 }
69570
69571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
69572         LDKPacket this_ptr_conv;
69573         this_ptr_conv.inner = untag_ptr(this_ptr);
69574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69576         this_ptr_conv.is_owned = false;
69577         Packet_set_version(&this_ptr_conv, val);
69578 }
69579
69580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
69581         LDKPacket this_ptr_conv;
69582         this_ptr_conv.inner = untag_ptr(this_ptr);
69583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69585         this_ptr_conv.is_owned = false;
69586         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69587         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
69588         return ret_arr;
69589 }
69590
69591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69592         LDKPacket this_ptr_conv;
69593         this_ptr_conv.inner = untag_ptr(this_ptr);
69594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69596         this_ptr_conv.is_owned = false;
69597         LDKPublicKey val_ref;
69598         CHECK((*env)->GetArrayLength(env, val) == 33);
69599         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69600         Packet_set_public_key(&this_ptr_conv, val_ref);
69601 }
69602
69603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
69604         LDKPacket this_ptr_conv;
69605         this_ptr_conv.inner = untag_ptr(this_ptr);
69606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69608         this_ptr_conv.is_owned = false;
69609         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
69610         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69611         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69612         CVec_u8Z_free(ret_var);
69613         return ret_arr;
69614 }
69615
69616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69617         LDKPacket this_ptr_conv;
69618         this_ptr_conv.inner = untag_ptr(this_ptr);
69619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69621         this_ptr_conv.is_owned = false;
69622         LDKCVec_u8Z val_ref;
69623         val_ref.datalen = (*env)->GetArrayLength(env, val);
69624         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
69625         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
69626         Packet_set_hop_data(&this_ptr_conv, val_ref);
69627 }
69628
69629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
69630         LDKPacket this_ptr_conv;
69631         this_ptr_conv.inner = untag_ptr(this_ptr);
69632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69634         this_ptr_conv.is_owned = false;
69635         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69636         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
69637         return ret_arr;
69638 }
69639
69640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69641         LDKPacket this_ptr_conv;
69642         this_ptr_conv.inner = untag_ptr(this_ptr);
69643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69645         this_ptr_conv.is_owned = false;
69646         LDKThirtyTwoBytes val_ref;
69647         CHECK((*env)->GetArrayLength(env, val) == 32);
69648         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69649         Packet_set_hmac(&this_ptr_conv, val_ref);
69650 }
69651
69652 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) {
69653         LDKPublicKey public_key_arg_ref;
69654         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
69655         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
69656         LDKCVec_u8Z hop_data_arg_ref;
69657         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
69658         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
69659         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
69660         LDKThirtyTwoBytes hmac_arg_ref;
69661         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
69662         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
69663         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
69664         int64_t ret_ref = 0;
69665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69667         return ret_ref;
69668 }
69669
69670 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
69671         LDKPacket ret_var = Packet_clone(arg);
69672         int64_t ret_ref = 0;
69673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69675         return ret_ref;
69676 }
69677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69678         LDKPacket arg_conv;
69679         arg_conv.inner = untag_ptr(arg);
69680         arg_conv.is_owned = ptr_is_owned(arg);
69681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69682         arg_conv.is_owned = false;
69683         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
69684         return ret_conv;
69685 }
69686
69687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69688         LDKPacket orig_conv;
69689         orig_conv.inner = untag_ptr(orig);
69690         orig_conv.is_owned = ptr_is_owned(orig);
69691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69692         orig_conv.is_owned = false;
69693         LDKPacket ret_var = Packet_clone(&orig_conv);
69694         int64_t ret_ref = 0;
69695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69697         return ret_ref;
69698 }
69699
69700 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69701         LDKPacket a_conv;
69702         a_conv.inner = untag_ptr(a);
69703         a_conv.is_owned = ptr_is_owned(a);
69704         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69705         a_conv.is_owned = false;
69706         LDKPacket b_conv;
69707         b_conv.inner = untag_ptr(b);
69708         b_conv.is_owned = ptr_is_owned(b);
69709         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69710         b_conv.is_owned = false;
69711         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
69712         return ret_conv;
69713 }
69714
69715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
69716         LDKPacket obj_conv;
69717         obj_conv.inner = untag_ptr(obj);
69718         obj_conv.is_owned = ptr_is_owned(obj);
69719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69720         obj_conv.is_owned = false;
69721         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
69722         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69723         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69724         CVec_u8Z_free(ret_var);
69725         return ret_arr;
69726 }
69727
69728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69729         if (!ptr_is_owned(this_ptr)) return;
69730         void* this_ptr_ptr = untag_ptr(this_ptr);
69731         CHECK_ACCESS(this_ptr_ptr);
69732         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
69733         FREE(untag_ptr(this_ptr));
69734         ParsedOnionMessageContents_free(this_ptr_conv);
69735 }
69736
69737 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
69738         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
69739         *ret_copy = ParsedOnionMessageContents_clone(arg);
69740         int64_t ret_ref = tag_ptr(ret_copy, true);
69741         return ret_ref;
69742 }
69743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69744         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
69745         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
69746         return ret_conv;
69747 }
69748
69749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69750         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
69751         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
69752         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
69753         int64_t ret_ref = tag_ptr(ret_copy, true);
69754         return ret_ref;
69755 }
69756
69757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
69758         void* a_ptr = untag_ptr(a);
69759         CHECK_ACCESS(a_ptr);
69760         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
69761         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
69762         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
69763         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
69764         int64_t ret_ref = tag_ptr(ret_copy, true);
69765         return ret_ref;
69766 }
69767
69768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
69769         void* a_ptr = untag_ptr(a);
69770         CHECK_ACCESS(a_ptr);
69771         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
69772         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
69773                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69774                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
69775         }
69776         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
69777         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
69778         int64_t ret_ref = tag_ptr(ret_copy, true);
69779         return ret_ref;
69780 }
69781
69782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
69783         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
69784         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
69785         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
69786         return tag_ptr(ret_ret, true);
69787 }
69788
69789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t obj) {
69790         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
69791         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
69792         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69793         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69794         CVec_u8Z_free(ret_var);
69795         return ret_arr;
69796 }
69797
69798 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
69799         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
69800         *ret_ret = OnionMessageContents_clone(arg);
69801         return tag_ptr(ret_ret, true);
69802 }
69803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69804         void* arg_ptr = untag_ptr(arg);
69805         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
69806         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
69807         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
69808         return ret_conv;
69809 }
69810
69811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69812         void* orig_ptr = untag_ptr(orig);
69813         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
69814         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
69815         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
69816         *ret_ret = OnionMessageContents_clone(orig_conv);
69817         return tag_ptr(ret_ret, true);
69818 }
69819
69820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69821         if (!ptr_is_owned(this_ptr)) return;
69822         void* this_ptr_ptr = untag_ptr(this_ptr);
69823         CHECK_ACCESS(this_ptr_ptr);
69824         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
69825         FREE(untag_ptr(this_ptr));
69826         OnionMessageContents_free(this_ptr_conv);
69827 }
69828
69829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69830         LDKBlindedPath this_obj_conv;
69831         this_obj_conv.inner = untag_ptr(this_obj);
69832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69834         BlindedPath_free(this_obj_conv);
69835 }
69836
69837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69838         LDKBlindedPath this_ptr_conv;
69839         this_ptr_conv.inner = untag_ptr(this_ptr);
69840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69842         this_ptr_conv.is_owned = false;
69843         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69844         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form);
69845         return ret_arr;
69846 }
69847
69848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69849         LDKBlindedPath this_ptr_conv;
69850         this_ptr_conv.inner = untag_ptr(this_ptr);
69851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69853         this_ptr_conv.is_owned = false;
69854         LDKPublicKey val_ref;
69855         CHECK((*env)->GetArrayLength(env, val) == 33);
69856         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69857         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
69858 }
69859
69860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
69861         LDKBlindedPath this_ptr_conv;
69862         this_ptr_conv.inner = untag_ptr(this_ptr);
69863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69865         this_ptr_conv.is_owned = false;
69866         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69867         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
69868         return ret_arr;
69869 }
69870
69871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69872         LDKBlindedPath this_ptr_conv;
69873         this_ptr_conv.inner = untag_ptr(this_ptr);
69874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69876         this_ptr_conv.is_owned = false;
69877         LDKPublicKey val_ref;
69878         CHECK((*env)->GetArrayLength(env, val) == 33);
69879         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69880         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
69881 }
69882
69883 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
69884         LDKBlindedPath this_ptr_conv;
69885         this_ptr_conv.inner = untag_ptr(this_ptr);
69886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69888         this_ptr_conv.is_owned = false;
69889         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
69890         int64_tArray ret_arr = NULL;
69891         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69892         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69893         for (size_t m = 0; m < ret_var.datalen; m++) {
69894                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
69895                 int64_t ret_conv_12_ref = 0;
69896                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
69897                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
69898                 ret_arr_ptr[m] = ret_conv_12_ref;
69899         }
69900         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69901         FREE(ret_var.data);
69902         return ret_arr;
69903 }
69904
69905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
69906         LDKBlindedPath this_ptr_conv;
69907         this_ptr_conv.inner = untag_ptr(this_ptr);
69908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69910         this_ptr_conv.is_owned = false;
69911         LDKCVec_BlindedHopZ val_constr;
69912         val_constr.datalen = (*env)->GetArrayLength(env, val);
69913         if (val_constr.datalen > 0)
69914                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
69915         else
69916                 val_constr.data = NULL;
69917         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
69918         for (size_t m = 0; m < val_constr.datalen; m++) {
69919                 int64_t val_conv_12 = val_vals[m];
69920                 LDKBlindedHop val_conv_12_conv;
69921                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
69922                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
69923                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
69924                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
69925                 val_constr.data[m] = val_conv_12_conv;
69926         }
69927         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
69928         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
69929 }
69930
69931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
69932         LDKPublicKey introduction_node_id_arg_ref;
69933         CHECK((*env)->GetArrayLength(env, introduction_node_id_arg) == 33);
69934         (*env)->GetByteArrayRegion(env, introduction_node_id_arg, 0, 33, introduction_node_id_arg_ref.compressed_form);
69935         LDKPublicKey blinding_point_arg_ref;
69936         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
69937         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
69938         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
69939         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
69940         if (blinded_hops_arg_constr.datalen > 0)
69941                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
69942         else
69943                 blinded_hops_arg_constr.data = NULL;
69944         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
69945         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
69946                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
69947                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
69948                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
69949                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
69950                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
69951                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
69952                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
69953         }
69954         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
69955         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
69956         int64_t ret_ref = 0;
69957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69959         return ret_ref;
69960 }
69961
69962 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
69963         LDKBlindedPath ret_var = BlindedPath_clone(arg);
69964         int64_t ret_ref = 0;
69965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69967         return ret_ref;
69968 }
69969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69970         LDKBlindedPath arg_conv;
69971         arg_conv.inner = untag_ptr(arg);
69972         arg_conv.is_owned = ptr_is_owned(arg);
69973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69974         arg_conv.is_owned = false;
69975         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
69976         return ret_conv;
69977 }
69978
69979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69980         LDKBlindedPath orig_conv;
69981         orig_conv.inner = untag_ptr(orig);
69982         orig_conv.is_owned = ptr_is_owned(orig);
69983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69984         orig_conv.is_owned = false;
69985         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
69986         int64_t ret_ref = 0;
69987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69989         return ret_ref;
69990 }
69991
69992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
69993         LDKBlindedPath o_conv;
69994         o_conv.inner = untag_ptr(o);
69995         o_conv.is_owned = ptr_is_owned(o);
69996         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69997         o_conv.is_owned = false;
69998         int64_t ret_conv = BlindedPath_hash(&o_conv);
69999         return ret_conv;
70000 }
70001
70002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70003         LDKBlindedPath a_conv;
70004         a_conv.inner = untag_ptr(a);
70005         a_conv.is_owned = ptr_is_owned(a);
70006         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70007         a_conv.is_owned = false;
70008         LDKBlindedPath b_conv;
70009         b_conv.inner = untag_ptr(b);
70010         b_conv.is_owned = ptr_is_owned(b);
70011         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70012         b_conv.is_owned = false;
70013         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
70014         return ret_conv;
70015 }
70016
70017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70018         LDKBlindedHop this_obj_conv;
70019         this_obj_conv.inner = untag_ptr(this_obj);
70020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70022         BlindedHop_free(this_obj_conv);
70023 }
70024
70025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
70026         LDKBlindedHop this_ptr_conv;
70027         this_ptr_conv.inner = untag_ptr(this_ptr);
70028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70030         this_ptr_conv.is_owned = false;
70031         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70032         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
70033         return ret_arr;
70034 }
70035
70036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70037         LDKBlindedHop this_ptr_conv;
70038         this_ptr_conv.inner = untag_ptr(this_ptr);
70039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70041         this_ptr_conv.is_owned = false;
70042         LDKPublicKey val_ref;
70043         CHECK((*env)->GetArrayLength(env, val) == 33);
70044         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
70045         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
70046 }
70047
70048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
70049         LDKBlindedHop this_ptr_conv;
70050         this_ptr_conv.inner = untag_ptr(this_ptr);
70051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70053         this_ptr_conv.is_owned = false;
70054         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
70055         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70056         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70057         CVec_u8Z_free(ret_var);
70058         return ret_arr;
70059 }
70060
70061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70062         LDKBlindedHop this_ptr_conv;
70063         this_ptr_conv.inner = untag_ptr(this_ptr);
70064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70066         this_ptr_conv.is_owned = false;
70067         LDKCVec_u8Z val_ref;
70068         val_ref.datalen = (*env)->GetArrayLength(env, val);
70069         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
70070         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
70071         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
70072 }
70073
70074 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) {
70075         LDKPublicKey blinded_node_id_arg_ref;
70076         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
70077         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
70078         LDKCVec_u8Z encrypted_payload_arg_ref;
70079         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
70080         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
70081         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
70082         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
70083         int64_t ret_ref = 0;
70084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70086         return ret_ref;
70087 }
70088
70089 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
70090         LDKBlindedHop ret_var = BlindedHop_clone(arg);
70091         int64_t ret_ref = 0;
70092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70094         return ret_ref;
70095 }
70096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70097         LDKBlindedHop arg_conv;
70098         arg_conv.inner = untag_ptr(arg);
70099         arg_conv.is_owned = ptr_is_owned(arg);
70100         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70101         arg_conv.is_owned = false;
70102         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
70103         return ret_conv;
70104 }
70105
70106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70107         LDKBlindedHop orig_conv;
70108         orig_conv.inner = untag_ptr(orig);
70109         orig_conv.is_owned = ptr_is_owned(orig);
70110         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70111         orig_conv.is_owned = false;
70112         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
70113         int64_t ret_ref = 0;
70114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70116         return ret_ref;
70117 }
70118
70119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
70120         LDKBlindedHop o_conv;
70121         o_conv.inner = untag_ptr(o);
70122         o_conv.is_owned = ptr_is_owned(o);
70123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70124         o_conv.is_owned = false;
70125         int64_t ret_conv = BlindedHop_hash(&o_conv);
70126         return ret_conv;
70127 }
70128
70129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70130         LDKBlindedHop a_conv;
70131         a_conv.inner = untag_ptr(a);
70132         a_conv.is_owned = ptr_is_owned(a);
70133         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70134         a_conv.is_owned = false;
70135         LDKBlindedHop b_conv;
70136         b_conv.inner = untag_ptr(b);
70137         b_conv.is_owned = ptr_is_owned(b);
70138         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70139         b_conv.is_owned = false;
70140         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
70141         return ret_conv;
70142 }
70143
70144 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) {
70145         LDKPublicKey recipient_node_id_ref;
70146         CHECK((*env)->GetArrayLength(env, recipient_node_id) == 33);
70147         (*env)->GetByteArrayRegion(env, recipient_node_id, 0, 33, recipient_node_id_ref.compressed_form);
70148         void* entropy_source_ptr = untag_ptr(entropy_source);
70149         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70150         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70151         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
70152         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
70153         return tag_ptr(ret_conv, true);
70154 }
70155
70156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
70157         LDKCVec_PublicKeyZ node_pks_constr;
70158         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
70159         if (node_pks_constr.datalen > 0)
70160                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
70161         else
70162                 node_pks_constr.data = NULL;
70163         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
70164                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
70165                 LDKPublicKey node_pks_conv_8_ref;
70166                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
70167                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
70168                 node_pks_constr.data[i] = node_pks_conv_8_ref;
70169         }
70170         void* entropy_source_ptr = untag_ptr(entropy_source);
70171         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70172         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70173         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
70174         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
70175         return tag_ptr(ret_conv, true);
70176 }
70177
70178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1payment(JNIEnv *env, jclass clz, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t entropy_source) {
70179         LDKPublicKey payee_node_id_ref;
70180         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
70181         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
70182         LDKReceiveTlvs payee_tlvs_conv;
70183         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
70184         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
70185         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
70186         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
70187         void* entropy_source_ptr = untag_ptr(entropy_source);
70188         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70189         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70190         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
70191         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
70192         return tag_ptr(ret_conv, true);
70193 }
70194
70195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
70196         LDKBlindedPath obj_conv;
70197         obj_conv.inner = untag_ptr(obj);
70198         obj_conv.is_owned = ptr_is_owned(obj);
70199         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70200         obj_conv.is_owned = false;
70201         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
70202         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70203         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70204         CVec_u8Z_free(ret_var);
70205         return ret_arr;
70206 }
70207
70208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70209         LDKu8slice ser_ref;
70210         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70211         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70212         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
70213         *ret_conv = BlindedPath_read(ser_ref);
70214         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70215         return tag_ptr(ret_conv, true);
70216 }
70217
70218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
70219         LDKBlindedHop obj_conv;
70220         obj_conv.inner = untag_ptr(obj);
70221         obj_conv.is_owned = ptr_is_owned(obj);
70222         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70223         obj_conv.is_owned = false;
70224         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
70225         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70226         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70227         CVec_u8Z_free(ret_var);
70228         return ret_arr;
70229 }
70230
70231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70232         LDKu8slice ser_ref;
70233         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70234         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70235         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
70236         *ret_conv = BlindedHop_read(ser_ref);
70237         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70238         return tag_ptr(ret_conv, true);
70239 }
70240
70241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70242         LDKForwardNode this_obj_conv;
70243         this_obj_conv.inner = untag_ptr(this_obj);
70244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70246         ForwardNode_free(this_obj_conv);
70247 }
70248
70249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
70250         LDKForwardNode this_ptr_conv;
70251         this_ptr_conv.inner = untag_ptr(this_ptr);
70252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70254         this_ptr_conv.is_owned = false;
70255         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
70256         int64_t ret_ref = 0;
70257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70259         return ret_ref;
70260 }
70261
70262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70263         LDKForwardNode this_ptr_conv;
70264         this_ptr_conv.inner = untag_ptr(this_ptr);
70265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70267         this_ptr_conv.is_owned = false;
70268         LDKForwardTlvs val_conv;
70269         val_conv.inner = untag_ptr(val);
70270         val_conv.is_owned = ptr_is_owned(val);
70271         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70272         val_conv = ForwardTlvs_clone(&val_conv);
70273         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
70274 }
70275
70276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
70277         LDKForwardNode this_ptr_conv;
70278         this_ptr_conv.inner = untag_ptr(this_ptr);
70279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70281         this_ptr_conv.is_owned = false;
70282         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70283         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
70284         return ret_arr;
70285 }
70286
70287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70288         LDKForwardNode this_ptr_conv;
70289         this_ptr_conv.inner = untag_ptr(this_ptr);
70290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70292         this_ptr_conv.is_owned = false;
70293         LDKPublicKey val_ref;
70294         CHECK((*env)->GetArrayLength(env, val) == 33);
70295         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
70296         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
70297 }
70298
70299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70300         LDKForwardNode this_ptr_conv;
70301         this_ptr_conv.inner = untag_ptr(this_ptr);
70302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70304         this_ptr_conv.is_owned = false;
70305         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
70306         return ret_conv;
70307 }
70308
70309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70310         LDKForwardNode this_ptr_conv;
70311         this_ptr_conv.inner = untag_ptr(this_ptr);
70312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70314         this_ptr_conv.is_owned = false;
70315         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
70316 }
70317
70318 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) {
70319         LDKForwardTlvs tlvs_arg_conv;
70320         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
70321         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
70322         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
70323         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
70324         LDKPublicKey node_id_arg_ref;
70325         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
70326         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
70327         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
70328         int64_t ret_ref = 0;
70329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70331         return ret_ref;
70332 }
70333
70334 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
70335         LDKForwardNode ret_var = ForwardNode_clone(arg);
70336         int64_t ret_ref = 0;
70337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70339         return ret_ref;
70340 }
70341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70342         LDKForwardNode arg_conv;
70343         arg_conv.inner = untag_ptr(arg);
70344         arg_conv.is_owned = ptr_is_owned(arg);
70345         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70346         arg_conv.is_owned = false;
70347         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
70348         return ret_conv;
70349 }
70350
70351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70352         LDKForwardNode orig_conv;
70353         orig_conv.inner = untag_ptr(orig);
70354         orig_conv.is_owned = ptr_is_owned(orig);
70355         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70356         orig_conv.is_owned = false;
70357         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
70358         int64_t ret_ref = 0;
70359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70361         return ret_ref;
70362 }
70363
70364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70365         LDKForwardTlvs this_obj_conv;
70366         this_obj_conv.inner = untag_ptr(this_obj);
70367         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70369         ForwardTlvs_free(this_obj_conv);
70370 }
70371
70372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
70373         LDKForwardTlvs this_ptr_conv;
70374         this_ptr_conv.inner = untag_ptr(this_ptr);
70375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70377         this_ptr_conv.is_owned = false;
70378         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
70379         return ret_conv;
70380 }
70381
70382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70383         LDKForwardTlvs this_ptr_conv;
70384         this_ptr_conv.inner = untag_ptr(this_ptr);
70385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70387         this_ptr_conv.is_owned = false;
70388         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
70389 }
70390
70391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
70392         LDKForwardTlvs this_ptr_conv;
70393         this_ptr_conv.inner = untag_ptr(this_ptr);
70394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70396         this_ptr_conv.is_owned = false;
70397         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
70398         int64_t ret_ref = 0;
70399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70401         return ret_ref;
70402 }
70403
70404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70405         LDKForwardTlvs this_ptr_conv;
70406         this_ptr_conv.inner = untag_ptr(this_ptr);
70407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70409         this_ptr_conv.is_owned = false;
70410         LDKPaymentRelay val_conv;
70411         val_conv.inner = untag_ptr(val);
70412         val_conv.is_owned = ptr_is_owned(val);
70413         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70414         val_conv = PaymentRelay_clone(&val_conv);
70415         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
70416 }
70417
70418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
70419         LDKForwardTlvs this_ptr_conv;
70420         this_ptr_conv.inner = untag_ptr(this_ptr);
70421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70423         this_ptr_conv.is_owned = false;
70424         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
70425         int64_t ret_ref = 0;
70426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70428         return ret_ref;
70429 }
70430
70431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70432         LDKForwardTlvs this_ptr_conv;
70433         this_ptr_conv.inner = untag_ptr(this_ptr);
70434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70436         this_ptr_conv.is_owned = false;
70437         LDKPaymentConstraints val_conv;
70438         val_conv.inner = untag_ptr(val);
70439         val_conv.is_owned = ptr_is_owned(val);
70440         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70441         val_conv = PaymentConstraints_clone(&val_conv);
70442         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
70443 }
70444
70445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
70446         LDKForwardTlvs this_ptr_conv;
70447         this_ptr_conv.inner = untag_ptr(this_ptr);
70448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70450         this_ptr_conv.is_owned = false;
70451         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
70452         int64_t ret_ref = 0;
70453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70455         return ret_ref;
70456 }
70457
70458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70459         LDKForwardTlvs this_ptr_conv;
70460         this_ptr_conv.inner = untag_ptr(this_ptr);
70461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70463         this_ptr_conv.is_owned = false;
70464         LDKBlindedHopFeatures val_conv;
70465         val_conv.inner = untag_ptr(val);
70466         val_conv.is_owned = ptr_is_owned(val);
70467         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70468         val_conv = BlindedHopFeatures_clone(&val_conv);
70469         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
70470 }
70471
70472 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) {
70473         LDKPaymentRelay payment_relay_arg_conv;
70474         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
70475         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
70476         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
70477         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
70478         LDKPaymentConstraints payment_constraints_arg_conv;
70479         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
70480         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
70481         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
70482         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
70483         LDKBlindedHopFeatures features_arg_conv;
70484         features_arg_conv.inner = untag_ptr(features_arg);
70485         features_arg_conv.is_owned = ptr_is_owned(features_arg);
70486         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
70487         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
70488         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
70489         int64_t ret_ref = 0;
70490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70492         return ret_ref;
70493 }
70494
70495 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
70496         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
70497         int64_t ret_ref = 0;
70498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70500         return ret_ref;
70501 }
70502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70503         LDKForwardTlvs arg_conv;
70504         arg_conv.inner = untag_ptr(arg);
70505         arg_conv.is_owned = ptr_is_owned(arg);
70506         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70507         arg_conv.is_owned = false;
70508         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
70509         return ret_conv;
70510 }
70511
70512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70513         LDKForwardTlvs orig_conv;
70514         orig_conv.inner = untag_ptr(orig);
70515         orig_conv.is_owned = ptr_is_owned(orig);
70516         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70517         orig_conv.is_owned = false;
70518         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
70519         int64_t ret_ref = 0;
70520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70522         return ret_ref;
70523 }
70524
70525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70526         LDKReceiveTlvs this_obj_conv;
70527         this_obj_conv.inner = untag_ptr(this_obj);
70528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70530         ReceiveTlvs_free(this_obj_conv);
70531 }
70532
70533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
70534         LDKReceiveTlvs this_ptr_conv;
70535         this_ptr_conv.inner = untag_ptr(this_ptr);
70536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70538         this_ptr_conv.is_owned = false;
70539         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70540         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
70541         return ret_arr;
70542 }
70543
70544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70545         LDKReceiveTlvs this_ptr_conv;
70546         this_ptr_conv.inner = untag_ptr(this_ptr);
70547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70549         this_ptr_conv.is_owned = false;
70550         LDKThirtyTwoBytes val_ref;
70551         CHECK((*env)->GetArrayLength(env, val) == 32);
70552         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
70553         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
70554 }
70555
70556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
70557         LDKReceiveTlvs this_ptr_conv;
70558         this_ptr_conv.inner = untag_ptr(this_ptr);
70559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70561         this_ptr_conv.is_owned = false;
70562         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
70563         int64_t ret_ref = 0;
70564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70566         return ret_ref;
70567 }
70568
70569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70570         LDKReceiveTlvs this_ptr_conv;
70571         this_ptr_conv.inner = untag_ptr(this_ptr);
70572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70574         this_ptr_conv.is_owned = false;
70575         LDKPaymentConstraints val_conv;
70576         val_conv.inner = untag_ptr(val);
70577         val_conv.is_owned = ptr_is_owned(val);
70578         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70579         val_conv = PaymentConstraints_clone(&val_conv);
70580         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
70581 }
70582
70583 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) {
70584         LDKThirtyTwoBytes payment_secret_arg_ref;
70585         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
70586         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
70587         LDKPaymentConstraints payment_constraints_arg_conv;
70588         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
70589         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
70590         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
70591         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
70592         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
70593         int64_t ret_ref = 0;
70594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70596         return ret_ref;
70597 }
70598
70599 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
70600         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
70601         int64_t ret_ref = 0;
70602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70604         return ret_ref;
70605 }
70606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70607         LDKReceiveTlvs arg_conv;
70608         arg_conv.inner = untag_ptr(arg);
70609         arg_conv.is_owned = ptr_is_owned(arg);
70610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70611         arg_conv.is_owned = false;
70612         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
70613         return ret_conv;
70614 }
70615
70616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70617         LDKReceiveTlvs orig_conv;
70618         orig_conv.inner = untag_ptr(orig);
70619         orig_conv.is_owned = ptr_is_owned(orig);
70620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70621         orig_conv.is_owned = false;
70622         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
70623         int64_t ret_ref = 0;
70624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70626         return ret_ref;
70627 }
70628
70629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70630         LDKPaymentRelay this_obj_conv;
70631         this_obj_conv.inner = untag_ptr(this_obj);
70632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70634         PaymentRelay_free(this_obj_conv);
70635 }
70636
70637 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
70638         LDKPaymentRelay this_ptr_conv;
70639         this_ptr_conv.inner = untag_ptr(this_ptr);
70640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70642         this_ptr_conv.is_owned = false;
70643         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
70644         return ret_conv;
70645 }
70646
70647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
70648         LDKPaymentRelay this_ptr_conv;
70649         this_ptr_conv.inner = untag_ptr(this_ptr);
70650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70652         this_ptr_conv.is_owned = false;
70653         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
70654 }
70655
70656 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
70657         LDKPaymentRelay this_ptr_conv;
70658         this_ptr_conv.inner = untag_ptr(this_ptr);
70659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70661         this_ptr_conv.is_owned = false;
70662         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
70663         return ret_conv;
70664 }
70665
70666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70667         LDKPaymentRelay this_ptr_conv;
70668         this_ptr_conv.inner = untag_ptr(this_ptr);
70669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70671         this_ptr_conv.is_owned = false;
70672         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
70673 }
70674
70675 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70676         LDKPaymentRelay this_ptr_conv;
70677         this_ptr_conv.inner = untag_ptr(this_ptr);
70678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70680         this_ptr_conv.is_owned = false;
70681         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
70682         return ret_conv;
70683 }
70684
70685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70686         LDKPaymentRelay this_ptr_conv;
70687         this_ptr_conv.inner = untag_ptr(this_ptr);
70688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70690         this_ptr_conv.is_owned = false;
70691         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
70692 }
70693
70694 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) {
70695         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
70696         int64_t ret_ref = 0;
70697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70699         return ret_ref;
70700 }
70701
70702 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
70703         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
70704         int64_t ret_ref = 0;
70705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70707         return ret_ref;
70708 }
70709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70710         LDKPaymentRelay arg_conv;
70711         arg_conv.inner = untag_ptr(arg);
70712         arg_conv.is_owned = ptr_is_owned(arg);
70713         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70714         arg_conv.is_owned = false;
70715         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
70716         return ret_conv;
70717 }
70718
70719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70720         LDKPaymentRelay orig_conv;
70721         orig_conv.inner = untag_ptr(orig);
70722         orig_conv.is_owned = ptr_is_owned(orig);
70723         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70724         orig_conv.is_owned = false;
70725         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
70726         int64_t ret_ref = 0;
70727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70729         return ret_ref;
70730 }
70731
70732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70733         LDKPaymentConstraints this_obj_conv;
70734         this_obj_conv.inner = untag_ptr(this_obj);
70735         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70737         PaymentConstraints_free(this_obj_conv);
70738 }
70739
70740 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
70741         LDKPaymentConstraints this_ptr_conv;
70742         this_ptr_conv.inner = untag_ptr(this_ptr);
70743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70745         this_ptr_conv.is_owned = false;
70746         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
70747         return ret_conv;
70748 }
70749
70750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70751         LDKPaymentConstraints this_ptr_conv;
70752         this_ptr_conv.inner = untag_ptr(this_ptr);
70753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70755         this_ptr_conv.is_owned = false;
70756         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
70757 }
70758
70759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70760         LDKPaymentConstraints this_ptr_conv;
70761         this_ptr_conv.inner = untag_ptr(this_ptr);
70762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70764         this_ptr_conv.is_owned = false;
70765         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
70766         return ret_conv;
70767 }
70768
70769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70770         LDKPaymentConstraints this_ptr_conv;
70771         this_ptr_conv.inner = untag_ptr(this_ptr);
70772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70774         this_ptr_conv.is_owned = false;
70775         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
70776 }
70777
70778 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) {
70779         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
70780         int64_t ret_ref = 0;
70781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70783         return ret_ref;
70784 }
70785
70786 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
70787         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
70788         int64_t ret_ref = 0;
70789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70791         return ret_ref;
70792 }
70793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70794         LDKPaymentConstraints arg_conv;
70795         arg_conv.inner = untag_ptr(arg);
70796         arg_conv.is_owned = ptr_is_owned(arg);
70797         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70798         arg_conv.is_owned = false;
70799         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
70800         return ret_conv;
70801 }
70802
70803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70804         LDKPaymentConstraints orig_conv;
70805         orig_conv.inner = untag_ptr(orig);
70806         orig_conv.is_owned = ptr_is_owned(orig);
70807         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70808         orig_conv.is_owned = false;
70809         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
70810         int64_t ret_ref = 0;
70811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70813         return ret_ref;
70814 }
70815
70816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
70817         LDKForwardTlvs obj_conv;
70818         obj_conv.inner = untag_ptr(obj);
70819         obj_conv.is_owned = ptr_is_owned(obj);
70820         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70821         obj_conv.is_owned = false;
70822         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
70823         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70824         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70825         CVec_u8Z_free(ret_var);
70826         return ret_arr;
70827 }
70828
70829 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
70830         LDKReceiveTlvs obj_conv;
70831         obj_conv.inner = untag_ptr(obj);
70832         obj_conv.is_owned = ptr_is_owned(obj);
70833         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70834         obj_conv.is_owned = false;
70835         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
70836         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70837         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70838         CVec_u8Z_free(ret_var);
70839         return ret_arr;
70840 }
70841
70842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70843         LDKu8slice ser_ref;
70844         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70845         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70846         LDKCResult_ReceiveTlvsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReceiveTlvsDecodeErrorZ), "LDKCResult_ReceiveTlvsDecodeErrorZ");
70847         *ret_conv = ReceiveTlvs_read(ser_ref);
70848         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70849         return tag_ptr(ret_conv, true);
70850 }
70851
70852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
70853         LDKPaymentRelay obj_conv;
70854         obj_conv.inner = untag_ptr(obj);
70855         obj_conv.is_owned = ptr_is_owned(obj);
70856         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70857         obj_conv.is_owned = false;
70858         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
70859         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70860         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70861         CVec_u8Z_free(ret_var);
70862         return ret_arr;
70863 }
70864
70865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70866         LDKu8slice ser_ref;
70867         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70868         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70869         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
70870         *ret_conv = PaymentRelay_read(ser_ref);
70871         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70872         return tag_ptr(ret_conv, true);
70873 }
70874
70875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
70876         LDKPaymentConstraints obj_conv;
70877         obj_conv.inner = untag_ptr(obj);
70878         obj_conv.is_owned = ptr_is_owned(obj);
70879         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70880         obj_conv.is_owned = false;
70881         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
70882         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70883         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70884         CVec_u8Z_free(ret_var);
70885         return ret_arr;
70886 }
70887
70888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70889         LDKu8slice ser_ref;
70890         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70891         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70892         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
70893         *ret_conv = PaymentConstraints_read(ser_ref);
70894         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70895         return tag_ptr(ret_conv, true);
70896 }
70897
70898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70899         if (!ptr_is_owned(this_ptr)) return;
70900         void* this_ptr_ptr = untag_ptr(this_ptr);
70901         CHECK_ACCESS(this_ptr_ptr);
70902         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
70903         FREE(untag_ptr(this_ptr));
70904         PaymentPurpose_free(this_ptr_conv);
70905 }
70906
70907 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
70908         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
70909         *ret_copy = PaymentPurpose_clone(arg);
70910         int64_t ret_ref = tag_ptr(ret_copy, true);
70911         return ret_ref;
70912 }
70913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70914         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
70915         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
70916         return ret_conv;
70917 }
70918
70919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70920         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
70921         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
70922         *ret_copy = PaymentPurpose_clone(orig_conv);
70923         int64_t ret_ref = tag_ptr(ret_copy, true);
70924         return ret_ref;
70925 }
70926
70927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
70928         void* payment_preimage_ptr = untag_ptr(payment_preimage);
70929         CHECK_ACCESS(payment_preimage_ptr);
70930         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
70931         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
70932         LDKThirtyTwoBytes payment_secret_ref;
70933         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
70934         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
70935         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
70936         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
70937         int64_t ret_ref = tag_ptr(ret_copy, true);
70938         return ret_ref;
70939 }
70940
70941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
70942         LDKThirtyTwoBytes a_ref;
70943         CHECK((*env)->GetArrayLength(env, a) == 32);
70944         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
70945         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
70946         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
70947         int64_t ret_ref = tag_ptr(ret_copy, true);
70948         return ret_ref;
70949 }
70950
70951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70952         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
70953         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
70954         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
70955         return ret_conv;
70956 }
70957
70958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
70959         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
70960         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
70961         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70962         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70963         CVec_u8Z_free(ret_var);
70964         return ret_arr;
70965 }
70966
70967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70968         LDKu8slice ser_ref;
70969         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70970         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70971         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
70972         *ret_conv = PaymentPurpose_read(ser_ref);
70973         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70974         return tag_ptr(ret_conv, true);
70975 }
70976
70977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70978         LDKClaimedHTLC this_obj_conv;
70979         this_obj_conv.inner = untag_ptr(this_obj);
70980         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70982         ClaimedHTLC_free(this_obj_conv);
70983 }
70984
70985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
70986         LDKClaimedHTLC this_ptr_conv;
70987         this_ptr_conv.inner = untag_ptr(this_ptr);
70988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70990         this_ptr_conv.is_owned = false;
70991         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70992         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClaimedHTLC_get_channel_id(&this_ptr_conv));
70993         return ret_arr;
70994 }
70995
70996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70997         LDKClaimedHTLC this_ptr_conv;
70998         this_ptr_conv.inner = untag_ptr(this_ptr);
70999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71001         this_ptr_conv.is_owned = false;
71002         LDKThirtyTwoBytes val_ref;
71003         CHECK((*env)->GetArrayLength(env, val) == 32);
71004         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
71005         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
71006 }
71007
71008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71009         LDKClaimedHTLC this_ptr_conv;
71010         this_ptr_conv.inner = untag_ptr(this_ptr);
71011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71013         this_ptr_conv.is_owned = false;
71014         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
71015         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
71016         return ret_arr;
71017 }
71018
71019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71020         LDKClaimedHTLC this_ptr_conv;
71021         this_ptr_conv.inner = untag_ptr(this_ptr);
71022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71024         this_ptr_conv.is_owned = false;
71025         LDKU128 val_ref;
71026         CHECK((*env)->GetArrayLength(env, val) == 16);
71027         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
71028         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
71029 }
71030
71031 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
71032         LDKClaimedHTLC this_ptr_conv;
71033         this_ptr_conv.inner = untag_ptr(this_ptr);
71034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71036         this_ptr_conv.is_owned = false;
71037         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
71038         return ret_conv;
71039 }
71040
71041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
71042         LDKClaimedHTLC 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         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
71048 }
71049
71050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71051         LDKClaimedHTLC this_ptr_conv;
71052         this_ptr_conv.inner = untag_ptr(this_ptr);
71053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71055         this_ptr_conv.is_owned = false;
71056         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
71057         return ret_conv;
71058 }
71059
71060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71061         LDKClaimedHTLC 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         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
71067 }
71068
71069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg) {
71070         LDKThirtyTwoBytes channel_id_arg_ref;
71071         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
71072         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
71073         LDKU128 user_channel_id_arg_ref;
71074         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
71075         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
71076         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg);
71077         int64_t ret_ref = 0;
71078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71080         return ret_ref;
71081 }
71082
71083 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
71084         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
71085         int64_t ret_ref = 0;
71086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71088         return ret_ref;
71089 }
71090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71091         LDKClaimedHTLC arg_conv;
71092         arg_conv.inner = untag_ptr(arg);
71093         arg_conv.is_owned = ptr_is_owned(arg);
71094         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71095         arg_conv.is_owned = false;
71096         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
71097         return ret_conv;
71098 }
71099
71100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71101         LDKClaimedHTLC orig_conv;
71102         orig_conv.inner = untag_ptr(orig);
71103         orig_conv.is_owned = ptr_is_owned(orig);
71104         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71105         orig_conv.is_owned = false;
71106         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
71107         int64_t ret_ref = 0;
71108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71110         return ret_ref;
71111 }
71112
71113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71114         LDKClaimedHTLC a_conv;
71115         a_conv.inner = untag_ptr(a);
71116         a_conv.is_owned = ptr_is_owned(a);
71117         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71118         a_conv.is_owned = false;
71119         LDKClaimedHTLC b_conv;
71120         b_conv.inner = untag_ptr(b);
71121         b_conv.is_owned = ptr_is_owned(b);
71122         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71123         b_conv.is_owned = false;
71124         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
71125         return ret_conv;
71126 }
71127
71128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
71129         LDKClaimedHTLC obj_conv;
71130         obj_conv.inner = untag_ptr(obj);
71131         obj_conv.is_owned = ptr_is_owned(obj);
71132         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71133         obj_conv.is_owned = false;
71134         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
71135         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71136         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71137         CVec_u8Z_free(ret_var);
71138         return ret_arr;
71139 }
71140
71141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71142         LDKu8slice ser_ref;
71143         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71144         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71145         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
71146         *ret_conv = ClaimedHTLC_read(ser_ref);
71147         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71148         return tag_ptr(ret_conv, true);
71149 }
71150
71151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71152         if (!ptr_is_owned(this_ptr)) return;
71153         void* this_ptr_ptr = untag_ptr(this_ptr);
71154         CHECK_ACCESS(this_ptr_ptr);
71155         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
71156         FREE(untag_ptr(this_ptr));
71157         PathFailure_free(this_ptr_conv);
71158 }
71159
71160 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
71161         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71162         *ret_copy = PathFailure_clone(arg);
71163         int64_t ret_ref = tag_ptr(ret_copy, true);
71164         return ret_ref;
71165 }
71166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71167         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
71168         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
71169         return ret_conv;
71170 }
71171
71172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71173         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
71174         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71175         *ret_copy = PathFailure_clone(orig_conv);
71176         int64_t ret_ref = tag_ptr(ret_copy, true);
71177         return ret_ref;
71178 }
71179
71180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
71181         void* err_ptr = untag_ptr(err);
71182         CHECK_ACCESS(err_ptr);
71183         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
71184         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
71185         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71186         *ret_copy = PathFailure_initial_send(err_conv);
71187         int64_t ret_ref = tag_ptr(ret_copy, true);
71188         return ret_ref;
71189 }
71190
71191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
71192         void* network_update_ptr = untag_ptr(network_update);
71193         CHECK_ACCESS(network_update_ptr);
71194         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
71195         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
71196         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
71197         *ret_copy = PathFailure_on_path(network_update_conv);
71198         int64_t ret_ref = tag_ptr(ret_copy, true);
71199         return ret_ref;
71200 }
71201
71202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71203         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
71204         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
71205         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
71206         return ret_conv;
71207 }
71208
71209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
71210         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
71211         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
71212         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71213         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71214         CVec_u8Z_free(ret_var);
71215         return ret_arr;
71216 }
71217
71218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71219         LDKu8slice ser_ref;
71220         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71221         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71222         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
71223         *ret_conv = PathFailure_read(ser_ref);
71224         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71225         return tag_ptr(ret_conv, true);
71226 }
71227
71228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71229         if (!ptr_is_owned(this_ptr)) return;
71230         void* this_ptr_ptr = untag_ptr(this_ptr);
71231         CHECK_ACCESS(this_ptr_ptr);
71232         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
71233         FREE(untag_ptr(this_ptr));
71234         ClosureReason_free(this_ptr_conv);
71235 }
71236
71237 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
71238         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71239         *ret_copy = ClosureReason_clone(arg);
71240         int64_t ret_ref = tag_ptr(ret_copy, true);
71241         return ret_ref;
71242 }
71243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71244         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
71245         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
71246         return ret_conv;
71247 }
71248
71249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71250         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
71251         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71252         *ret_copy = ClosureReason_clone(orig_conv);
71253         int64_t ret_ref = tag_ptr(ret_copy, true);
71254         return ret_ref;
71255 }
71256
71257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
71258         LDKUntrustedString peer_msg_conv;
71259         peer_msg_conv.inner = untag_ptr(peer_msg);
71260         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
71261         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
71262         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
71263         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71264         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
71265         int64_t ret_ref = tag_ptr(ret_copy, true);
71266         return ret_ref;
71267 }
71268
71269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
71270         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71271         *ret_copy = ClosureReason_holder_force_closed();
71272         int64_t ret_ref = tag_ptr(ret_copy, true);
71273         return ret_ref;
71274 }
71275
71276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
71277         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71278         *ret_copy = ClosureReason_cooperative_closure();
71279         int64_t ret_ref = tag_ptr(ret_copy, true);
71280         return ret_ref;
71281 }
71282
71283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
71284         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71285         *ret_copy = ClosureReason_commitment_tx_confirmed();
71286         int64_t ret_ref = tag_ptr(ret_copy, true);
71287         return ret_ref;
71288 }
71289
71290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
71291         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71292         *ret_copy = ClosureReason_funding_timed_out();
71293         int64_t ret_ref = tag_ptr(ret_copy, true);
71294         return ret_ref;
71295 }
71296
71297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
71298         LDKStr err_conv = java_to_owned_str(env, err);
71299         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71300         *ret_copy = ClosureReason_processing_error(err_conv);
71301         int64_t ret_ref = tag_ptr(ret_copy, true);
71302         return ret_ref;
71303 }
71304
71305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
71306         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71307         *ret_copy = ClosureReason_disconnected_peer();
71308         int64_t ret_ref = tag_ptr(ret_copy, true);
71309         return ret_ref;
71310 }
71311
71312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
71313         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71314         *ret_copy = ClosureReason_outdated_channel_manager();
71315         int64_t ret_ref = tag_ptr(ret_copy, true);
71316         return ret_ref;
71317 }
71318
71319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
71320         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71321         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
71322         int64_t ret_ref = tag_ptr(ret_copy, true);
71323         return ret_ref;
71324 }
71325
71326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
71327         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
71328         *ret_copy = ClosureReason_funding_batch_closure();
71329         int64_t ret_ref = tag_ptr(ret_copy, true);
71330         return ret_ref;
71331 }
71332
71333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71334         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
71335         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
71336         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
71337         return ret_conv;
71338 }
71339
71340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
71341         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
71342         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
71343         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71344         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71345         CVec_u8Z_free(ret_var);
71346         return ret_arr;
71347 }
71348
71349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71350         LDKu8slice ser_ref;
71351         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71352         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71353         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
71354         *ret_conv = ClosureReason_read(ser_ref);
71355         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71356         return tag_ptr(ret_conv, true);
71357 }
71358
71359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71360         if (!ptr_is_owned(this_ptr)) return;
71361         void* this_ptr_ptr = untag_ptr(this_ptr);
71362         CHECK_ACCESS(this_ptr_ptr);
71363         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
71364         FREE(untag_ptr(this_ptr));
71365         HTLCDestination_free(this_ptr_conv);
71366 }
71367
71368 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
71369         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71370         *ret_copy = HTLCDestination_clone(arg);
71371         int64_t ret_ref = tag_ptr(ret_copy, true);
71372         return ret_ref;
71373 }
71374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71375         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
71376         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
71377         return ret_conv;
71378 }
71379
71380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71381         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
71382         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71383         *ret_copy = HTLCDestination_clone(orig_conv);
71384         int64_t ret_ref = tag_ptr(ret_copy, true);
71385         return ret_ref;
71386 }
71387
71388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) {
71389         LDKPublicKey node_id_ref;
71390         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71391         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71392         LDKThirtyTwoBytes channel_id_ref;
71393         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71394         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71395         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71396         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
71397         int64_t ret_ref = tag_ptr(ret_copy, true);
71398         return ret_ref;
71399 }
71400
71401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
71402         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71403         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
71404         int64_t ret_ref = tag_ptr(ret_copy, true);
71405         return ret_ref;
71406 }
71407
71408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
71409         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71410         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
71411         int64_t ret_ref = tag_ptr(ret_copy, true);
71412         return ret_ref;
71413 }
71414
71415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
71416         LDKThirtyTwoBytes payment_hash_ref;
71417         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71418         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71419         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
71420         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
71421         int64_t ret_ref = tag_ptr(ret_copy, true);
71422         return ret_ref;
71423 }
71424
71425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71426         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
71427         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
71428         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
71429         return ret_conv;
71430 }
71431
71432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
71433         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
71434         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
71435         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71436         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71437         CVec_u8Z_free(ret_var);
71438         return ret_arr;
71439 }
71440
71441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71442         LDKu8slice ser_ref;
71443         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71444         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71445         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
71446         *ret_conv = HTLCDestination_read(ser_ref);
71447         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71448         return tag_ptr(ret_conv, true);
71449 }
71450
71451 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71452         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
71453         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
71454         return ret_conv;
71455 }
71456
71457 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
71458         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
71459         return ret_conv;
71460 }
71461
71462 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
71463         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
71464         return ret_conv;
71465 }
71466
71467 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
71468         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
71469         return ret_conv;
71470 }
71471
71472 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
71473         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
71474         return ret_conv;
71475 }
71476
71477 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
71478         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
71479         return ret_conv;
71480 }
71481
71482 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
71483         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
71484         return ret_conv;
71485 }
71486
71487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71488         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
71489         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
71490         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
71491         return ret_conv;
71492 }
71493
71494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
71495         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
71496         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
71497         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71498         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71499         CVec_u8Z_free(ret_var);
71500         return ret_arr;
71501 }
71502
71503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71504         LDKu8slice ser_ref;
71505         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71506         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71507         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
71508         *ret_conv = PaymentFailureReason_read(ser_ref);
71509         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71510         return tag_ptr(ret_conv, true);
71511 }
71512
71513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71514         if (!ptr_is_owned(this_ptr)) return;
71515         void* this_ptr_ptr = untag_ptr(this_ptr);
71516         CHECK_ACCESS(this_ptr_ptr);
71517         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
71518         FREE(untag_ptr(this_ptr));
71519         Event_free(this_ptr_conv);
71520 }
71521
71522 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
71523         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71524         *ret_copy = Event_clone(arg);
71525         int64_t ret_ref = tag_ptr(ret_copy, true);
71526         return ret_ref;
71527 }
71528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71529         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
71530         int64_t ret_conv = Event_clone_ptr(arg_conv);
71531         return ret_conv;
71532 }
71533
71534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71535         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
71536         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71537         *ret_copy = Event_clone(orig_conv);
71538         int64_t ret_ref = tag_ptr(ret_copy, true);
71539         return ret_ref;
71540 }
71541
71542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
71543         LDKThirtyTwoBytes temporary_channel_id_ref;
71544         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
71545         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
71546         LDKPublicKey counterparty_node_id_ref;
71547         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71548         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71549         LDKCVec_u8Z output_script_ref;
71550         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
71551         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
71552         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
71553         LDKU128 user_channel_id_ref;
71554         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
71555         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
71556         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71557         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
71558         int64_t ret_ref = tag_ptr(ret_copy, true);
71559         return ret_ref;
71560 }
71561
71562 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) {
71563         LDKPublicKey receiver_node_id_ref;
71564         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
71565         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
71566         LDKThirtyTwoBytes payment_hash_ref;
71567         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71568         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71569         LDKRecipientOnionFields onion_fields_conv;
71570         onion_fields_conv.inner = untag_ptr(onion_fields);
71571         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
71572         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
71573         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
71574         void* purpose_ptr = untag_ptr(purpose);
71575         CHECK_ACCESS(purpose_ptr);
71576         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
71577         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
71578         void* via_channel_id_ptr = untag_ptr(via_channel_id);
71579         CHECK_ACCESS(via_channel_id_ptr);
71580         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
71581         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
71582         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
71583         CHECK_ACCESS(via_user_channel_id_ptr);
71584         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
71585         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
71586         void* claim_deadline_ptr = untag_ptr(claim_deadline);
71587         CHECK_ACCESS(claim_deadline_ptr);
71588         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
71589         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
71590         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71591         *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);
71592         int64_t ret_ref = tag_ptr(ret_copy, true);
71593         return ret_ref;
71594 }
71595
71596 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) {
71597         LDKPublicKey receiver_node_id_ref;
71598         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
71599         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
71600         LDKThirtyTwoBytes payment_hash_ref;
71601         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71602         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71603         void* purpose_ptr = untag_ptr(purpose);
71604         CHECK_ACCESS(purpose_ptr);
71605         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
71606         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
71607         LDKCVec_ClaimedHTLCZ htlcs_constr;
71608         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
71609         if (htlcs_constr.datalen > 0)
71610                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
71611         else
71612                 htlcs_constr.data = NULL;
71613         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
71614         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
71615                 int64_t htlcs_conv_13 = htlcs_vals[n];
71616                 LDKClaimedHTLC htlcs_conv_13_conv;
71617                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
71618                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
71619                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
71620                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
71621                 htlcs_constr.data[n] = htlcs_conv_13_conv;
71622         }
71623         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
71624         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
71625         CHECK_ACCESS(sender_intended_total_msat_ptr);
71626         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
71627         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
71628         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71629         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
71630         int64_t ret_ref = tag_ptr(ret_copy, true);
71631         return ret_ref;
71632 }
71633
71634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id) {
71635         LDKThirtyTwoBytes payment_id_ref;
71636         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71637         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71638         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71639         *ret_copy = Event_invoice_request_failed(payment_id_ref);
71640         int64_t ret_ref = tag_ptr(ret_copy, true);
71641         return ret_ref;
71642 }
71643
71644 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) {
71645         void* payment_id_ptr = untag_ptr(payment_id);
71646         CHECK_ACCESS(payment_id_ptr);
71647         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
71648         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
71649         LDKThirtyTwoBytes payment_preimage_ref;
71650         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
71651         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
71652         LDKThirtyTwoBytes payment_hash_ref;
71653         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71654         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71655         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
71656         CHECK_ACCESS(fee_paid_msat_ptr);
71657         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
71658         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
71659         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71660         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
71661         int64_t ret_ref = tag_ptr(ret_copy, true);
71662         return ret_ref;
71663 }
71664
71665 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) {
71666         LDKThirtyTwoBytes payment_id_ref;
71667         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71668         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71669         LDKThirtyTwoBytes payment_hash_ref;
71670         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71671         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71672         void* reason_ptr = untag_ptr(reason);
71673         CHECK_ACCESS(reason_ptr);
71674         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
71675         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
71676         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71677         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
71678         int64_t ret_ref = tag_ptr(ret_copy, true);
71679         return ret_ref;
71680 }
71681
71682 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) {
71683         LDKThirtyTwoBytes payment_id_ref;
71684         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71685         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71686         void* payment_hash_ptr = untag_ptr(payment_hash);
71687         CHECK_ACCESS(payment_hash_ptr);
71688         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
71689         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
71690         LDKPath path_conv;
71691         path_conv.inner = untag_ptr(path);
71692         path_conv.is_owned = ptr_is_owned(path);
71693         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71694         path_conv = Path_clone(&path_conv);
71695         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71696         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
71697         int64_t ret_ref = tag_ptr(ret_copy, true);
71698         return ret_ref;
71699 }
71700
71701 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) {
71702         void* payment_id_ptr = untag_ptr(payment_id);
71703         CHECK_ACCESS(payment_id_ptr);
71704         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
71705         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
71706         LDKThirtyTwoBytes payment_hash_ref;
71707         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71708         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71709         void* failure_ptr = untag_ptr(failure);
71710         CHECK_ACCESS(failure_ptr);
71711         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
71712         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
71713         LDKPath path_conv;
71714         path_conv.inner = untag_ptr(path);
71715         path_conv.is_owned = ptr_is_owned(path);
71716         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71717         path_conv = Path_clone(&path_conv);
71718         void* short_channel_id_ptr = untag_ptr(short_channel_id);
71719         CHECK_ACCESS(short_channel_id_ptr);
71720         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
71721         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
71722         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71723         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
71724         int64_t ret_ref = tag_ptr(ret_copy, true);
71725         return ret_ref;
71726 }
71727
71728 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) {
71729         LDKThirtyTwoBytes payment_id_ref;
71730         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71731         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71732         LDKThirtyTwoBytes payment_hash_ref;
71733         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71734         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71735         LDKPath path_conv;
71736         path_conv.inner = untag_ptr(path);
71737         path_conv.is_owned = ptr_is_owned(path);
71738         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71739         path_conv = Path_clone(&path_conv);
71740         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71741         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
71742         int64_t ret_ref = tag_ptr(ret_copy, true);
71743         return ret_ref;
71744 }
71745
71746 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) {
71747         LDKThirtyTwoBytes payment_id_ref;
71748         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
71749         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
71750         LDKThirtyTwoBytes payment_hash_ref;
71751         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71752         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71753         LDKPath path_conv;
71754         path_conv.inner = untag_ptr(path);
71755         path_conv.is_owned = ptr_is_owned(path);
71756         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71757         path_conv = Path_clone(&path_conv);
71758         void* short_channel_id_ptr = untag_ptr(short_channel_id);
71759         CHECK_ACCESS(short_channel_id_ptr);
71760         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
71761         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
71762         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71763         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
71764         int64_t ret_ref = tag_ptr(ret_copy, true);
71765         return ret_ref;
71766 }
71767
71768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
71769         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71770         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
71771         int64_t ret_ref = tag_ptr(ret_copy, true);
71772         return ret_ref;
71773 }
71774
71775 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) {
71776         LDKThirtyTwoBytes intercept_id_ref;
71777         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
71778         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
71779         LDKThirtyTwoBytes payment_hash_ref;
71780         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
71781         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
71782         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71783         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
71784         int64_t ret_ref = tag_ptr(ret_copy, true);
71785         return ret_ref;
71786 }
71787
71788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
71789         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
71790         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
71791         if (outputs_constr.datalen > 0)
71792                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
71793         else
71794                 outputs_constr.data = NULL;
71795         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
71796         for (size_t b = 0; b < outputs_constr.datalen; b++) {
71797                 int64_t outputs_conv_27 = outputs_vals[b];
71798                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
71799                 CHECK_ACCESS(outputs_conv_27_ptr);
71800                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
71801                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
71802                 outputs_constr.data[b] = outputs_conv_27_conv;
71803         }
71804         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
71805         void* channel_id_ptr = untag_ptr(channel_id);
71806         CHECK_ACCESS(channel_id_ptr);
71807         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
71808         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
71809         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71810         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
71811         int64_t ret_ref = tag_ptr(ret_copy, true);
71812         return ret_ref;
71813 }
71814
71815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t prev_channel_id, int64_t next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
71816         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
71817         CHECK_ACCESS(prev_channel_id_ptr);
71818         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
71819         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
71820         void* next_channel_id_ptr = untag_ptr(next_channel_id);
71821         CHECK_ACCESS(next_channel_id_ptr);
71822         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
71823         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
71824         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
71825         CHECK_ACCESS(fee_earned_msat_ptr);
71826         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
71827         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
71828         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
71829         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
71830         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
71831         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
71832         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71833         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
71834         int64_t ret_ref = tag_ptr(ret_copy, true);
71835         return ret_ref;
71836 }
71837
71838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1pending(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo) {
71839         LDKThirtyTwoBytes channel_id_ref;
71840         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71841         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71842         LDKU128 user_channel_id_ref;
71843         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
71844         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
71845         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
71846         CHECK_ACCESS(former_temporary_channel_id_ptr);
71847         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
71848         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
71849         LDKPublicKey counterparty_node_id_ref;
71850         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71851         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71852         LDKOutPoint funding_txo_conv;
71853         funding_txo_conv.inner = untag_ptr(funding_txo);
71854         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
71855         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
71856         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
71857         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71858         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
71859         int64_t ret_ref = tag_ptr(ret_copy, true);
71860         return ret_ref;
71861 }
71862
71863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
71864         LDKThirtyTwoBytes channel_id_ref;
71865         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71866         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71867         LDKU128 user_channel_id_ref;
71868         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
71869         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
71870         LDKPublicKey counterparty_node_id_ref;
71871         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71872         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71873         LDKChannelTypeFeatures channel_type_conv;
71874         channel_type_conv.inner = untag_ptr(channel_type);
71875         channel_type_conv.is_owned = ptr_is_owned(channel_type);
71876         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
71877         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
71878         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71879         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
71880         int64_t ret_ref = tag_ptr(ret_copy, true);
71881         return ret_ref;
71882 }
71883
71884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t reason, int8_tArray counterparty_node_id, int64_t channel_capacity_sats) {
71885         LDKThirtyTwoBytes channel_id_ref;
71886         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71887         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71888         LDKU128 user_channel_id_ref;
71889         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
71890         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
71891         void* reason_ptr = untag_ptr(reason);
71892         CHECK_ACCESS(reason_ptr);
71893         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
71894         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
71895         LDKPublicKey counterparty_node_id_ref;
71896         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71897         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71898         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
71899         CHECK_ACCESS(channel_capacity_sats_ptr);
71900         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
71901         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
71902         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71903         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv);
71904         int64_t ret_ref = tag_ptr(ret_copy, true);
71905         return ret_ref;
71906 }
71907
71908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
71909         LDKThirtyTwoBytes channel_id_ref;
71910         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
71911         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
71912         LDKTransaction transaction_ref;
71913         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
71914         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
71915         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
71916         transaction_ref.data_is_owned = true;
71917         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71918         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
71919         int64_t ret_ref = tag_ptr(ret_copy, true);
71920         return ret_ref;
71921 }
71922
71923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
71924         LDKThirtyTwoBytes temporary_channel_id_ref;
71925         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
71926         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
71927         LDKPublicKey counterparty_node_id_ref;
71928         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
71929         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
71930         LDKChannelTypeFeatures channel_type_conv;
71931         channel_type_conv.inner = untag_ptr(channel_type);
71932         channel_type_conv.is_owned = ptr_is_owned(channel_type);
71933         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
71934         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
71935         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71936         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
71937         int64_t ret_ref = tag_ptr(ret_copy, true);
71938         return ret_ref;
71939 }
71940
71941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) {
71942         LDKThirtyTwoBytes prev_channel_id_ref;
71943         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
71944         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
71945         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
71946         CHECK_ACCESS(failed_next_destination_ptr);
71947         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
71948         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
71949         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71950         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
71951         int64_t ret_ref = tag_ptr(ret_copy, true);
71952         return ret_ref;
71953 }
71954
71955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
71956         void* a_ptr = untag_ptr(a);
71957         CHECK_ACCESS(a_ptr);
71958         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
71959         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
71960         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
71961         *ret_copy = Event_bump_transaction(a_conv);
71962         int64_t ret_ref = tag_ptr(ret_copy, true);
71963         return ret_ref;
71964 }
71965
71966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71967         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
71968         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
71969         jboolean ret_conv = Event_eq(a_conv, b_conv);
71970         return ret_conv;
71971 }
71972
71973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
71974         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
71975         LDKCVec_u8Z ret_var = Event_write(obj_conv);
71976         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71977         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71978         CVec_u8Z_free(ret_var);
71979         return ret_arr;
71980 }
71981
71982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71983         LDKu8slice ser_ref;
71984         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71985         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71986         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
71987         *ret_conv = Event_read(ser_ref);
71988         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71989         return tag_ptr(ret_conv, true);
71990 }
71991
71992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71993         if (!ptr_is_owned(this_ptr)) return;
71994         void* this_ptr_ptr = untag_ptr(this_ptr);
71995         CHECK_ACCESS(this_ptr_ptr);
71996         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
71997         FREE(untag_ptr(this_ptr));
71998         MessageSendEvent_free(this_ptr_conv);
71999 }
72000
72001 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
72002         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72003         *ret_copy = MessageSendEvent_clone(arg);
72004         int64_t ret_ref = tag_ptr(ret_copy, true);
72005         return ret_ref;
72006 }
72007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72008         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
72009         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
72010         return ret_conv;
72011 }
72012
72013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72014         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
72015         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72016         *ret_copy = MessageSendEvent_clone(orig_conv);
72017         int64_t ret_ref = tag_ptr(ret_copy, true);
72018         return ret_ref;
72019 }
72020
72021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72022         LDKPublicKey node_id_ref;
72023         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72024         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72025         LDKAcceptChannel msg_conv;
72026         msg_conv.inner = untag_ptr(msg);
72027         msg_conv.is_owned = ptr_is_owned(msg);
72028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72029         msg_conv = AcceptChannel_clone(&msg_conv);
72030         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72031         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
72032         int64_t ret_ref = tag_ptr(ret_copy, true);
72033         return ret_ref;
72034 }
72035
72036 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) {
72037         LDKPublicKey node_id_ref;
72038         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72039         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72040         LDKAcceptChannelV2 msg_conv;
72041         msg_conv.inner = untag_ptr(msg);
72042         msg_conv.is_owned = ptr_is_owned(msg);
72043         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72044         msg_conv = AcceptChannelV2_clone(&msg_conv);
72045         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72046         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
72047         int64_t ret_ref = tag_ptr(ret_copy, true);
72048         return ret_ref;
72049 }
72050
72051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72052         LDKPublicKey node_id_ref;
72053         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72054         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72055         LDKOpenChannel msg_conv;
72056         msg_conv.inner = untag_ptr(msg);
72057         msg_conv.is_owned = ptr_is_owned(msg);
72058         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72059         msg_conv = OpenChannel_clone(&msg_conv);
72060         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72061         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
72062         int64_t ret_ref = tag_ptr(ret_copy, true);
72063         return ret_ref;
72064 }
72065
72066 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) {
72067         LDKPublicKey node_id_ref;
72068         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72069         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72070         LDKOpenChannelV2 msg_conv;
72071         msg_conv.inner = untag_ptr(msg);
72072         msg_conv.is_owned = ptr_is_owned(msg);
72073         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72074         msg_conv = OpenChannelV2_clone(&msg_conv);
72075         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72076         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
72077         int64_t ret_ref = tag_ptr(ret_copy, true);
72078         return ret_ref;
72079 }
72080
72081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72082         LDKPublicKey node_id_ref;
72083         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72084         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72085         LDKFundingCreated msg_conv;
72086         msg_conv.inner = untag_ptr(msg);
72087         msg_conv.is_owned = ptr_is_owned(msg);
72088         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72089         msg_conv = FundingCreated_clone(&msg_conv);
72090         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72091         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
72092         int64_t ret_ref = tag_ptr(ret_copy, true);
72093         return ret_ref;
72094 }
72095
72096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72097         LDKPublicKey node_id_ref;
72098         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72099         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72100         LDKFundingSigned msg_conv;
72101         msg_conv.inner = untag_ptr(msg);
72102         msg_conv.is_owned = ptr_is_owned(msg);
72103         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72104         msg_conv = FundingSigned_clone(&msg_conv);
72105         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72106         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
72107         int64_t ret_ref = tag_ptr(ret_copy, true);
72108         return ret_ref;
72109 }
72110
72111 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) {
72112         LDKPublicKey node_id_ref;
72113         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72114         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72115         LDKTxAddInput msg_conv;
72116         msg_conv.inner = untag_ptr(msg);
72117         msg_conv.is_owned = ptr_is_owned(msg);
72118         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72119         msg_conv = TxAddInput_clone(&msg_conv);
72120         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72121         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
72122         int64_t ret_ref = tag_ptr(ret_copy, true);
72123         return ret_ref;
72124 }
72125
72126 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) {
72127         LDKPublicKey node_id_ref;
72128         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72129         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72130         LDKTxAddOutput msg_conv;
72131         msg_conv.inner = untag_ptr(msg);
72132         msg_conv.is_owned = ptr_is_owned(msg);
72133         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72134         msg_conv = TxAddOutput_clone(&msg_conv);
72135         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72136         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
72137         int64_t ret_ref = tag_ptr(ret_copy, true);
72138         return ret_ref;
72139 }
72140
72141 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) {
72142         LDKPublicKey node_id_ref;
72143         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72144         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72145         LDKTxRemoveInput msg_conv;
72146         msg_conv.inner = untag_ptr(msg);
72147         msg_conv.is_owned = ptr_is_owned(msg);
72148         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72149         msg_conv = TxRemoveInput_clone(&msg_conv);
72150         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72151         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
72152         int64_t ret_ref = tag_ptr(ret_copy, true);
72153         return ret_ref;
72154 }
72155
72156 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) {
72157         LDKPublicKey node_id_ref;
72158         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72159         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72160         LDKTxRemoveOutput msg_conv;
72161         msg_conv.inner = untag_ptr(msg);
72162         msg_conv.is_owned = ptr_is_owned(msg);
72163         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72164         msg_conv = TxRemoveOutput_clone(&msg_conv);
72165         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72166         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
72167         int64_t ret_ref = tag_ptr(ret_copy, true);
72168         return ret_ref;
72169 }
72170
72171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72172         LDKPublicKey node_id_ref;
72173         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72174         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72175         LDKTxComplete msg_conv;
72176         msg_conv.inner = untag_ptr(msg);
72177         msg_conv.is_owned = ptr_is_owned(msg);
72178         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72179         msg_conv = TxComplete_clone(&msg_conv);
72180         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72181         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
72182         int64_t ret_ref = tag_ptr(ret_copy, true);
72183         return ret_ref;
72184 }
72185
72186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72187         LDKPublicKey node_id_ref;
72188         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72189         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72190         LDKTxSignatures msg_conv;
72191         msg_conv.inner = untag_ptr(msg);
72192         msg_conv.is_owned = ptr_is_owned(msg);
72193         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72194         msg_conv = TxSignatures_clone(&msg_conv);
72195         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72196         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
72197         int64_t ret_ref = tag_ptr(ret_copy, true);
72198         return ret_ref;
72199 }
72200
72201 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) {
72202         LDKPublicKey node_id_ref;
72203         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72204         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72205         LDKTxInitRbf msg_conv;
72206         msg_conv.inner = untag_ptr(msg);
72207         msg_conv.is_owned = ptr_is_owned(msg);
72208         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72209         msg_conv = TxInitRbf_clone(&msg_conv);
72210         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72211         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
72212         int64_t ret_ref = tag_ptr(ret_copy, true);
72213         return ret_ref;
72214 }
72215
72216 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) {
72217         LDKPublicKey node_id_ref;
72218         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72219         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72220         LDKTxAckRbf msg_conv;
72221         msg_conv.inner = untag_ptr(msg);
72222         msg_conv.is_owned = ptr_is_owned(msg);
72223         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72224         msg_conv = TxAckRbf_clone(&msg_conv);
72225         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72226         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
72227         int64_t ret_ref = tag_ptr(ret_copy, true);
72228         return ret_ref;
72229 }
72230
72231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72232         LDKPublicKey node_id_ref;
72233         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72234         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72235         LDKTxAbort msg_conv;
72236         msg_conv.inner = untag_ptr(msg);
72237         msg_conv.is_owned = ptr_is_owned(msg);
72238         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72239         msg_conv = TxAbort_clone(&msg_conv);
72240         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72241         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
72242         int64_t ret_ref = tag_ptr(ret_copy, true);
72243         return ret_ref;
72244 }
72245
72246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72247         LDKPublicKey node_id_ref;
72248         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72249         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72250         LDKChannelReady msg_conv;
72251         msg_conv.inner = untag_ptr(msg);
72252         msg_conv.is_owned = ptr_is_owned(msg);
72253         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72254         msg_conv = ChannelReady_clone(&msg_conv);
72255         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72256         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
72257         int64_t ret_ref = tag_ptr(ret_copy, true);
72258         return ret_ref;
72259 }
72260
72261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72262         LDKPublicKey node_id_ref;
72263         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72264         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72265         LDKAnnouncementSignatures msg_conv;
72266         msg_conv.inner = untag_ptr(msg);
72267         msg_conv.is_owned = ptr_is_owned(msg);
72268         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72269         msg_conv = AnnouncementSignatures_clone(&msg_conv);
72270         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72271         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
72272         int64_t ret_ref = tag_ptr(ret_copy, true);
72273         return ret_ref;
72274 }
72275
72276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
72277         LDKPublicKey node_id_ref;
72278         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72279         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72280         LDKCommitmentUpdate updates_conv;
72281         updates_conv.inner = untag_ptr(updates);
72282         updates_conv.is_owned = ptr_is_owned(updates);
72283         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
72284         updates_conv = CommitmentUpdate_clone(&updates_conv);
72285         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72286         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
72287         int64_t ret_ref = tag_ptr(ret_copy, true);
72288         return ret_ref;
72289 }
72290
72291 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) {
72292         LDKPublicKey node_id_ref;
72293         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72294         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72295         LDKRevokeAndACK msg_conv;
72296         msg_conv.inner = untag_ptr(msg);
72297         msg_conv.is_owned = ptr_is_owned(msg);
72298         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72299         msg_conv = RevokeAndACK_clone(&msg_conv);
72300         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72301         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
72302         int64_t ret_ref = tag_ptr(ret_copy, true);
72303         return ret_ref;
72304 }
72305
72306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72307         LDKPublicKey node_id_ref;
72308         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72309         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72310         LDKClosingSigned msg_conv;
72311         msg_conv.inner = untag_ptr(msg);
72312         msg_conv.is_owned = ptr_is_owned(msg);
72313         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72314         msg_conv = ClosingSigned_clone(&msg_conv);
72315         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72316         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
72317         int64_t ret_ref = tag_ptr(ret_copy, true);
72318         return ret_ref;
72319 }
72320
72321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72322         LDKPublicKey node_id_ref;
72323         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72324         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72325         LDKShutdown msg_conv;
72326         msg_conv.inner = untag_ptr(msg);
72327         msg_conv.is_owned = ptr_is_owned(msg);
72328         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72329         msg_conv = Shutdown_clone(&msg_conv);
72330         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72331         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
72332         int64_t ret_ref = tag_ptr(ret_copy, true);
72333         return ret_ref;
72334 }
72335
72336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72337         LDKPublicKey node_id_ref;
72338         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72339         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72340         LDKChannelReestablish msg_conv;
72341         msg_conv.inner = untag_ptr(msg);
72342         msg_conv.is_owned = ptr_is_owned(msg);
72343         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72344         msg_conv = ChannelReestablish_clone(&msg_conv);
72345         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72346         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
72347         int64_t ret_ref = tag_ptr(ret_copy, true);
72348         return ret_ref;
72349 }
72350
72351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1announcement(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg, int64_t update_msg) {
72352         LDKPublicKey node_id_ref;
72353         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72354         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72355         LDKChannelAnnouncement msg_conv;
72356         msg_conv.inner = untag_ptr(msg);
72357         msg_conv.is_owned = ptr_is_owned(msg);
72358         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72359         msg_conv = ChannelAnnouncement_clone(&msg_conv);
72360         LDKChannelUpdate update_msg_conv;
72361         update_msg_conv.inner = untag_ptr(update_msg);
72362         update_msg_conv.is_owned = ptr_is_owned(update_msg);
72363         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
72364         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
72365         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72366         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
72367         int64_t ret_ref = tag_ptr(ret_copy, true);
72368         return ret_ref;
72369 }
72370
72371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
72372         LDKChannelAnnouncement msg_conv;
72373         msg_conv.inner = untag_ptr(msg);
72374         msg_conv.is_owned = ptr_is_owned(msg);
72375         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72376         msg_conv = ChannelAnnouncement_clone(&msg_conv);
72377         LDKChannelUpdate update_msg_conv;
72378         update_msg_conv.inner = untag_ptr(update_msg);
72379         update_msg_conv.is_owned = ptr_is_owned(update_msg);
72380         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
72381         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
72382         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72383         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
72384         int64_t ret_ref = tag_ptr(ret_copy, true);
72385         return ret_ref;
72386 }
72387
72388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
72389         LDKChannelUpdate msg_conv;
72390         msg_conv.inner = untag_ptr(msg);
72391         msg_conv.is_owned = ptr_is_owned(msg);
72392         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72393         msg_conv = ChannelUpdate_clone(&msg_conv);
72394         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72395         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
72396         int64_t ret_ref = tag_ptr(ret_copy, true);
72397         return ret_ref;
72398 }
72399
72400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
72401         LDKNodeAnnouncement msg_conv;
72402         msg_conv.inner = untag_ptr(msg);
72403         msg_conv.is_owned = ptr_is_owned(msg);
72404         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72405         msg_conv = NodeAnnouncement_clone(&msg_conv);
72406         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72407         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
72408         int64_t ret_ref = tag_ptr(ret_copy, true);
72409         return ret_ref;
72410 }
72411
72412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
72413         LDKPublicKey node_id_ref;
72414         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72415         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72416         LDKChannelUpdate msg_conv;
72417         msg_conv.inner = untag_ptr(msg);
72418         msg_conv.is_owned = ptr_is_owned(msg);
72419         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72420         msg_conv = ChannelUpdate_clone(&msg_conv);
72421         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72422         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
72423         int64_t ret_ref = tag_ptr(ret_copy, true);
72424         return ret_ref;
72425 }
72426
72427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
72428         LDKPublicKey node_id_ref;
72429         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72430         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72431         void* action_ptr = untag_ptr(action);
72432         CHECK_ACCESS(action_ptr);
72433         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
72434         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
72435         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72436         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
72437         int64_t ret_ref = tag_ptr(ret_copy, true);
72438         return ret_ref;
72439 }
72440
72441 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) {
72442         LDKPublicKey node_id_ref;
72443         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72444         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72445         LDKQueryChannelRange msg_conv;
72446         msg_conv.inner = untag_ptr(msg);
72447         msg_conv.is_owned = ptr_is_owned(msg);
72448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72449         msg_conv = QueryChannelRange_clone(&msg_conv);
72450         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72451         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
72452         int64_t ret_ref = tag_ptr(ret_copy, true);
72453         return ret_ref;
72454 }
72455
72456 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) {
72457         LDKPublicKey node_id_ref;
72458         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72459         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72460         LDKQueryShortChannelIds msg_conv;
72461         msg_conv.inner = untag_ptr(msg);
72462         msg_conv.is_owned = ptr_is_owned(msg);
72463         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72464         msg_conv = QueryShortChannelIds_clone(&msg_conv);
72465         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72466         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
72467         int64_t ret_ref = tag_ptr(ret_copy, true);
72468         return ret_ref;
72469 }
72470
72471 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) {
72472         LDKPublicKey node_id_ref;
72473         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72474         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72475         LDKReplyChannelRange msg_conv;
72476         msg_conv.inner = untag_ptr(msg);
72477         msg_conv.is_owned = ptr_is_owned(msg);
72478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72479         msg_conv = ReplyChannelRange_clone(&msg_conv);
72480         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72481         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
72482         int64_t ret_ref = tag_ptr(ret_copy, true);
72483         return ret_ref;
72484 }
72485
72486 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) {
72487         LDKPublicKey node_id_ref;
72488         CHECK((*env)->GetArrayLength(env, node_id) == 33);
72489         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
72490         LDKGossipTimestampFilter msg_conv;
72491         msg_conv.inner = untag_ptr(msg);
72492         msg_conv.is_owned = ptr_is_owned(msg);
72493         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
72494         msg_conv = GossipTimestampFilter_clone(&msg_conv);
72495         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
72496         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
72497         int64_t ret_ref = tag_ptr(ret_copy, true);
72498         return ret_ref;
72499 }
72500
72501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72502         if (!ptr_is_owned(this_ptr)) return;
72503         void* this_ptr_ptr = untag_ptr(this_ptr);
72504         CHECK_ACCESS(this_ptr_ptr);
72505         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
72506         FREE(untag_ptr(this_ptr));
72507         MessageSendEventsProvider_free(this_ptr_conv);
72508 }
72509
72510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72511         if (!ptr_is_owned(this_ptr)) return;
72512         void* this_ptr_ptr = untag_ptr(this_ptr);
72513         CHECK_ACCESS(this_ptr_ptr);
72514         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
72515         FREE(untag_ptr(this_ptr));
72516         EventsProvider_free(this_ptr_conv);
72517 }
72518
72519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72520         if (!ptr_is_owned(this_ptr)) return;
72521         void* this_ptr_ptr = untag_ptr(this_ptr);
72522         CHECK_ACCESS(this_ptr_ptr);
72523         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
72524         FREE(untag_ptr(this_ptr));
72525         EventHandler_free(this_ptr_conv);
72526 }
72527
72528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72529         LDKAnchorDescriptor this_obj_conv;
72530         this_obj_conv.inner = untag_ptr(this_obj);
72531         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72533         AnchorDescriptor_free(this_obj_conv);
72534 }
72535
72536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
72537         LDKAnchorDescriptor this_ptr_conv;
72538         this_ptr_conv.inner = untag_ptr(this_ptr);
72539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72541         this_ptr_conv.is_owned = false;
72542         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
72543         int64_t ret_ref = 0;
72544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72546         return ret_ref;
72547 }
72548
72549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72550         LDKAnchorDescriptor this_ptr_conv;
72551         this_ptr_conv.inner = untag_ptr(this_ptr);
72552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72554         this_ptr_conv.is_owned = false;
72555         LDKChannelDerivationParameters val_conv;
72556         val_conv.inner = untag_ptr(val);
72557         val_conv.is_owned = ptr_is_owned(val);
72558         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72559         val_conv = ChannelDerivationParameters_clone(&val_conv);
72560         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
72561 }
72562
72563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72564         LDKAnchorDescriptor this_ptr_conv;
72565         this_ptr_conv.inner = untag_ptr(this_ptr);
72566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72568         this_ptr_conv.is_owned = false;
72569         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
72570         int64_t ret_ref = 0;
72571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72573         return ret_ref;
72574 }
72575
72576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72577         LDKAnchorDescriptor this_ptr_conv;
72578         this_ptr_conv.inner = untag_ptr(this_ptr);
72579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72581         this_ptr_conv.is_owned = false;
72582         LDKOutPoint val_conv;
72583         val_conv.inner = untag_ptr(val);
72584         val_conv.is_owned = ptr_is_owned(val);
72585         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72586         val_conv = OutPoint_clone(&val_conv);
72587         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
72588 }
72589
72590 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) {
72591         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
72592         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
72593         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
72594         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
72595         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
72596         LDKOutPoint outpoint_arg_conv;
72597         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
72598         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
72599         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
72600         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
72601         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
72602         int64_t ret_ref = 0;
72603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72605         return ret_ref;
72606 }
72607
72608 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
72609         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
72610         int64_t ret_ref = 0;
72611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72613         return ret_ref;
72614 }
72615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72616         LDKAnchorDescriptor arg_conv;
72617         arg_conv.inner = untag_ptr(arg);
72618         arg_conv.is_owned = ptr_is_owned(arg);
72619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72620         arg_conv.is_owned = false;
72621         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
72622         return ret_conv;
72623 }
72624
72625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72626         LDKAnchorDescriptor orig_conv;
72627         orig_conv.inner = untag_ptr(orig);
72628         orig_conv.is_owned = ptr_is_owned(orig);
72629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72630         orig_conv.is_owned = false;
72631         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
72632         int64_t ret_ref = 0;
72633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72635         return ret_ref;
72636 }
72637
72638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72639         LDKAnchorDescriptor a_conv;
72640         a_conv.inner = untag_ptr(a);
72641         a_conv.is_owned = ptr_is_owned(a);
72642         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72643         a_conv.is_owned = false;
72644         LDKAnchorDescriptor b_conv;
72645         b_conv.inner = untag_ptr(b);
72646         b_conv.is_owned = ptr_is_owned(b);
72647         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72648         b_conv.is_owned = false;
72649         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
72650         return ret_conv;
72651 }
72652
72653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
72654         LDKAnchorDescriptor this_arg_conv;
72655         this_arg_conv.inner = untag_ptr(this_arg);
72656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72658         this_arg_conv.is_owned = false;
72659         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
72660         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
72661         return tag_ptr(ret_ref, true);
72662 }
72663
72664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
72665         LDKAnchorDescriptor this_arg_conv;
72666         this_arg_conv.inner = untag_ptr(this_arg);
72667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72669         this_arg_conv.is_owned = false;
72670         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
72671         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
72672         return tag_ptr(ret_ref, true);
72673 }
72674
72675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
72676         LDKAnchorDescriptor this_arg_conv;
72677         this_arg_conv.inner = untag_ptr(this_arg);
72678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72680         this_arg_conv.is_owned = false;
72681         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
72682         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72683         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72684         CVec_u8Z_free(ret_var);
72685         return ret_arr;
72686 }
72687
72688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
72689         LDKAnchorDescriptor this_arg_conv;
72690         this_arg_conv.inner = untag_ptr(this_arg);
72691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72693         this_arg_conv.is_owned = false;
72694         LDKECDSASignature signature_ref;
72695         CHECK((*env)->GetArrayLength(env, signature) == 64);
72696         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
72697         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
72698         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72699         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72700         Witness_free(ret_var);
72701         return ret_arr;
72702 }
72703
72704 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) {
72705         LDKAnchorDescriptor this_arg_conv;
72706         this_arg_conv.inner = untag_ptr(this_arg);
72707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72709         this_arg_conv.is_owned = false;
72710         void* signer_provider_ptr = untag_ptr(signer_provider);
72711         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
72712         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
72713         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
72714         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
72715         return tag_ptr(ret_ret, true);
72716 }
72717
72718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72719         if (!ptr_is_owned(this_ptr)) return;
72720         void* this_ptr_ptr = untag_ptr(this_ptr);
72721         CHECK_ACCESS(this_ptr_ptr);
72722         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
72723         FREE(untag_ptr(this_ptr));
72724         BumpTransactionEvent_free(this_ptr_conv);
72725 }
72726
72727 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
72728         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72729         *ret_copy = BumpTransactionEvent_clone(arg);
72730         int64_t ret_ref = tag_ptr(ret_copy, true);
72731         return ret_ref;
72732 }
72733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72734         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
72735         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
72736         return ret_conv;
72737 }
72738
72739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72740         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
72741         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72742         *ret_copy = BumpTransactionEvent_clone(orig_conv);
72743         int64_t ret_ref = tag_ptr(ret_copy, true);
72744         return ret_ref;
72745 }
72746
72747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1channel_1close(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t package_target_feerate_sat_per_1000_weight, int8_tArray commitment_tx, int64_t commitment_tx_fee_satoshis, int64_t anchor_descriptor, int64_tArray pending_htlcs) {
72748         LDKThirtyTwoBytes claim_id_ref;
72749         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
72750         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
72751         LDKTransaction commitment_tx_ref;
72752         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
72753         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
72754         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
72755         commitment_tx_ref.data_is_owned = true;
72756         LDKAnchorDescriptor anchor_descriptor_conv;
72757         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
72758         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
72759         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
72760         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
72761         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
72762         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
72763         if (pending_htlcs_constr.datalen > 0)
72764                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
72765         else
72766                 pending_htlcs_constr.data = NULL;
72767         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
72768         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
72769                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
72770                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
72771                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
72772                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
72773                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
72774                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
72775                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
72776         }
72777         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
72778         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72779         *ret_copy = BumpTransactionEvent_channel_close(claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
72780         int64_t ret_ref = tag_ptr(ret_copy, true);
72781         return ret_ref;
72782 }
72783
72784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1htlcresolution(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
72785         LDKThirtyTwoBytes claim_id_ref;
72786         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
72787         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
72788         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
72789         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
72790         if (htlc_descriptors_constr.datalen > 0)
72791                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
72792         else
72793                 htlc_descriptors_constr.data = NULL;
72794         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
72795         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
72796                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
72797                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
72798                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
72799                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
72800                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
72801                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
72802                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
72803         }
72804         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
72805         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
72806         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
72807         int64_t ret_ref = tag_ptr(ret_copy, true);
72808         return ret_ref;
72809 }
72810
72811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72812         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
72813         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
72814         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
72815         return ret_conv;
72816 }
72817
72818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72819         LDKInput this_obj_conv;
72820         this_obj_conv.inner = untag_ptr(this_obj);
72821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72823         Input_free(this_obj_conv);
72824 }
72825
72826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72827         LDKInput this_ptr_conv;
72828         this_ptr_conv.inner = untag_ptr(this_ptr);
72829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72831         this_ptr_conv.is_owned = false;
72832         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
72833         int64_t ret_ref = 0;
72834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72836         return ret_ref;
72837 }
72838
72839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72840         LDKInput this_ptr_conv;
72841         this_ptr_conv.inner = untag_ptr(this_ptr);
72842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72844         this_ptr_conv.is_owned = false;
72845         LDKOutPoint val_conv;
72846         val_conv.inner = untag_ptr(val);
72847         val_conv.is_owned = ptr_is_owned(val);
72848         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72849         val_conv = OutPoint_clone(&val_conv);
72850         Input_set_outpoint(&this_ptr_conv, val_conv);
72851 }
72852
72853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
72854         LDKInput this_ptr_conv;
72855         this_ptr_conv.inner = untag_ptr(this_ptr);
72856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72858         this_ptr_conv.is_owned = false;
72859         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
72860         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
72861         return tag_ptr(ret_ref, true);
72862 }
72863
72864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72865         LDKInput this_ptr_conv;
72866         this_ptr_conv.inner = untag_ptr(this_ptr);
72867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72869         this_ptr_conv.is_owned = false;
72870         void* val_ptr = untag_ptr(val);
72871         CHECK_ACCESS(val_ptr);
72872         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
72873         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
72874         Input_set_previous_utxo(&this_ptr_conv, val_conv);
72875 }
72876
72877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
72878         LDKInput this_ptr_conv;
72879         this_ptr_conv.inner = untag_ptr(this_ptr);
72880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72882         this_ptr_conv.is_owned = false;
72883         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
72884         return ret_conv;
72885 }
72886
72887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72888         LDKInput this_ptr_conv;
72889         this_ptr_conv.inner = untag_ptr(this_ptr);
72890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72892         this_ptr_conv.is_owned = false;
72893         Input_set_satisfaction_weight(&this_ptr_conv, val);
72894 }
72895
72896 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) {
72897         LDKOutPoint outpoint_arg_conv;
72898         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
72899         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
72900         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
72901         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
72902         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
72903         CHECK_ACCESS(previous_utxo_arg_ptr);
72904         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
72905         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
72906         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
72907         int64_t ret_ref = 0;
72908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72910         return ret_ref;
72911 }
72912
72913 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
72914         LDKInput ret_var = Input_clone(arg);
72915         int64_t ret_ref = 0;
72916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72918         return ret_ref;
72919 }
72920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72921         LDKInput arg_conv;
72922         arg_conv.inner = untag_ptr(arg);
72923         arg_conv.is_owned = ptr_is_owned(arg);
72924         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72925         arg_conv.is_owned = false;
72926         int64_t ret_conv = Input_clone_ptr(&arg_conv);
72927         return ret_conv;
72928 }
72929
72930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72931         LDKInput orig_conv;
72932         orig_conv.inner = untag_ptr(orig);
72933         orig_conv.is_owned = ptr_is_owned(orig);
72934         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72935         orig_conv.is_owned = false;
72936         LDKInput ret_var = Input_clone(&orig_conv);
72937         int64_t ret_ref = 0;
72938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72940         return ret_ref;
72941 }
72942
72943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
72944         LDKInput o_conv;
72945         o_conv.inner = untag_ptr(o);
72946         o_conv.is_owned = ptr_is_owned(o);
72947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72948         o_conv.is_owned = false;
72949         int64_t ret_conv = Input_hash(&o_conv);
72950         return ret_conv;
72951 }
72952
72953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72954         LDKInput a_conv;
72955         a_conv.inner = untag_ptr(a);
72956         a_conv.is_owned = ptr_is_owned(a);
72957         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72958         a_conv.is_owned = false;
72959         LDKInput b_conv;
72960         b_conv.inner = untag_ptr(b);
72961         b_conv.is_owned = ptr_is_owned(b);
72962         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72963         b_conv.is_owned = false;
72964         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
72965         return ret_conv;
72966 }
72967
72968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72969         LDKUtxo this_obj_conv;
72970         this_obj_conv.inner = untag_ptr(this_obj);
72971         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72973         Utxo_free(this_obj_conv);
72974 }
72975
72976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
72977         LDKUtxo this_ptr_conv;
72978         this_ptr_conv.inner = untag_ptr(this_ptr);
72979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72981         this_ptr_conv.is_owned = false;
72982         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
72983         int64_t ret_ref = 0;
72984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72986         return ret_ref;
72987 }
72988
72989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72990         LDKUtxo this_ptr_conv;
72991         this_ptr_conv.inner = untag_ptr(this_ptr);
72992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72994         this_ptr_conv.is_owned = false;
72995         LDKOutPoint val_conv;
72996         val_conv.inner = untag_ptr(val);
72997         val_conv.is_owned = ptr_is_owned(val);
72998         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72999         val_conv = OutPoint_clone(&val_conv);
73000         Utxo_set_outpoint(&this_ptr_conv, val_conv);
73001 }
73002
73003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
73004         LDKUtxo this_ptr_conv;
73005         this_ptr_conv.inner = untag_ptr(this_ptr);
73006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73008         this_ptr_conv.is_owned = false;
73009         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73010         *ret_ref = Utxo_get_output(&this_ptr_conv);
73011         return tag_ptr(ret_ref, true);
73012 }
73013
73014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73015         LDKUtxo this_ptr_conv;
73016         this_ptr_conv.inner = untag_ptr(this_ptr);
73017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73019         this_ptr_conv.is_owned = false;
73020         void* val_ptr = untag_ptr(val);
73021         CHECK_ACCESS(val_ptr);
73022         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73023         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73024         Utxo_set_output(&this_ptr_conv, val_conv);
73025 }
73026
73027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
73028         LDKUtxo this_ptr_conv;
73029         this_ptr_conv.inner = untag_ptr(this_ptr);
73030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73032         this_ptr_conv.is_owned = false;
73033         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
73034         return ret_conv;
73035 }
73036
73037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73038         LDKUtxo this_ptr_conv;
73039         this_ptr_conv.inner = untag_ptr(this_ptr);
73040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73042         this_ptr_conv.is_owned = false;
73043         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
73044 }
73045
73046 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) {
73047         LDKOutPoint outpoint_arg_conv;
73048         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73049         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73050         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73051         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73052         void* output_arg_ptr = untag_ptr(output_arg);
73053         CHECK_ACCESS(output_arg_ptr);
73054         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73055         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73056         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
73057         int64_t ret_ref = 0;
73058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73060         return ret_ref;
73061 }
73062
73063 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
73064         LDKUtxo ret_var = Utxo_clone(arg);
73065         int64_t ret_ref = 0;
73066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73068         return ret_ref;
73069 }
73070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73071         LDKUtxo arg_conv;
73072         arg_conv.inner = untag_ptr(arg);
73073         arg_conv.is_owned = ptr_is_owned(arg);
73074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73075         arg_conv.is_owned = false;
73076         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
73077         return ret_conv;
73078 }
73079
73080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73081         LDKUtxo orig_conv;
73082         orig_conv.inner = untag_ptr(orig);
73083         orig_conv.is_owned = ptr_is_owned(orig);
73084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73085         orig_conv.is_owned = false;
73086         LDKUtxo ret_var = Utxo_clone(&orig_conv);
73087         int64_t ret_ref = 0;
73088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73090         return ret_ref;
73091 }
73092
73093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
73094         LDKUtxo o_conv;
73095         o_conv.inner = untag_ptr(o);
73096         o_conv.is_owned = ptr_is_owned(o);
73097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73098         o_conv.is_owned = false;
73099         int64_t ret_conv = Utxo_hash(&o_conv);
73100         return ret_conv;
73101 }
73102
73103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73104         LDKUtxo a_conv;
73105         a_conv.inner = untag_ptr(a);
73106         a_conv.is_owned = ptr_is_owned(a);
73107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73108         a_conv.is_owned = false;
73109         LDKUtxo b_conv;
73110         b_conv.inner = untag_ptr(b);
73111         b_conv.is_owned = ptr_is_owned(b);
73112         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73113         b_conv.is_owned = false;
73114         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
73115         return ret_conv;
73116 }
73117
73118 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) {
73119         LDKOutPoint outpoint_conv;
73120         outpoint_conv.inner = untag_ptr(outpoint);
73121         outpoint_conv.is_owned = ptr_is_owned(outpoint);
73122         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
73123         outpoint_conv = OutPoint_clone(&outpoint_conv);
73124         uint8_t pubkey_hash_arr[20];
73125         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
73126         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
73127         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
73128         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
73129         int64_t ret_ref = 0;
73130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73132         return ret_ref;
73133 }
73134
73135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73136         LDKCoinSelection this_obj_conv;
73137         this_obj_conv.inner = untag_ptr(this_obj);
73138         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73140         CoinSelection_free(this_obj_conv);
73141 }
73142
73143 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
73144         LDKCoinSelection this_ptr_conv;
73145         this_ptr_conv.inner = untag_ptr(this_ptr);
73146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73148         this_ptr_conv.is_owned = false;
73149         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
73150         int64_tArray ret_arr = NULL;
73151         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
73152         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
73153         for (size_t g = 0; g < ret_var.datalen; g++) {
73154                 LDKUtxo ret_conv_6_var = ret_var.data[g];
73155                 int64_t ret_conv_6_ref = 0;
73156                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
73157                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
73158                 ret_arr_ptr[g] = ret_conv_6_ref;
73159         }
73160         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
73161         FREE(ret_var.data);
73162         return ret_arr;
73163 }
73164
73165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
73166         LDKCoinSelection this_ptr_conv;
73167         this_ptr_conv.inner = untag_ptr(this_ptr);
73168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73170         this_ptr_conv.is_owned = false;
73171         LDKCVec_UtxoZ val_constr;
73172         val_constr.datalen = (*env)->GetArrayLength(env, val);
73173         if (val_constr.datalen > 0)
73174                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
73175         else
73176                 val_constr.data = NULL;
73177         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
73178         for (size_t g = 0; g < val_constr.datalen; g++) {
73179                 int64_t val_conv_6 = val_vals[g];
73180                 LDKUtxo val_conv_6_conv;
73181                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
73182                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
73183                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
73184                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
73185                 val_constr.data[g] = val_conv_6_conv;
73186         }
73187         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
73188         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
73189 }
73190
73191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
73192         LDKCoinSelection this_ptr_conv;
73193         this_ptr_conv.inner = untag_ptr(this_ptr);
73194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73196         this_ptr_conv.is_owned = false;
73197         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
73198         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
73199         int64_t ret_ref = tag_ptr(ret_copy, true);
73200         return ret_ref;
73201 }
73202
73203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73204         LDKCoinSelection this_ptr_conv;
73205         this_ptr_conv.inner = untag_ptr(this_ptr);
73206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73208         this_ptr_conv.is_owned = false;
73209         void* val_ptr = untag_ptr(val);
73210         CHECK_ACCESS(val_ptr);
73211         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
73212         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
73213         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
73214 }
73215
73216 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) {
73217         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
73218         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
73219         if (confirmed_utxos_arg_constr.datalen > 0)
73220                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
73221         else
73222                 confirmed_utxos_arg_constr.data = NULL;
73223         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
73224         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
73225                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
73226                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
73227                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
73228                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
73229                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
73230                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
73231                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
73232         }
73233         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
73234         void* change_output_arg_ptr = untag_ptr(change_output_arg);
73235         CHECK_ACCESS(change_output_arg_ptr);
73236         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
73237         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
73238         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
73239         int64_t ret_ref = 0;
73240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73242         return ret_ref;
73243 }
73244
73245 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
73246         LDKCoinSelection ret_var = CoinSelection_clone(arg);
73247         int64_t ret_ref = 0;
73248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73250         return ret_ref;
73251 }
73252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73253         LDKCoinSelection arg_conv;
73254         arg_conv.inner = untag_ptr(arg);
73255         arg_conv.is_owned = ptr_is_owned(arg);
73256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73257         arg_conv.is_owned = false;
73258         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
73259         return ret_conv;
73260 }
73261
73262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73263         LDKCoinSelection orig_conv;
73264         orig_conv.inner = untag_ptr(orig);
73265         orig_conv.is_owned = ptr_is_owned(orig);
73266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73267         orig_conv.is_owned = false;
73268         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
73269         int64_t ret_ref = 0;
73270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73272         return ret_ref;
73273 }
73274
73275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73276         if (!ptr_is_owned(this_ptr)) return;
73277         void* this_ptr_ptr = untag_ptr(this_ptr);
73278         CHECK_ACCESS(this_ptr_ptr);
73279         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
73280         FREE(untag_ptr(this_ptr));
73281         CoinSelectionSource_free(this_ptr_conv);
73282 }
73283
73284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73285         if (!ptr_is_owned(this_ptr)) return;
73286         void* this_ptr_ptr = untag_ptr(this_ptr);
73287         CHECK_ACCESS(this_ptr_ptr);
73288         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
73289         FREE(untag_ptr(this_ptr));
73290         WalletSource_free(this_ptr_conv);
73291 }
73292
73293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73294         LDKWallet this_obj_conv;
73295         this_obj_conv.inner = untag_ptr(this_obj);
73296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73298         Wallet_free(this_obj_conv);
73299 }
73300
73301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
73302         void* source_ptr = untag_ptr(source);
73303         CHECK_ACCESS(source_ptr);
73304         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
73305         if (source_conv.free == LDKWalletSource_JCalls_free) {
73306                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73307                 LDKWalletSource_JCalls_cloned(&source_conv);
73308         }
73309         void* logger_ptr = untag_ptr(logger);
73310         CHECK_ACCESS(logger_ptr);
73311         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73312         if (logger_conv.free == LDKLogger_JCalls_free) {
73313                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73314                 LDKLogger_JCalls_cloned(&logger_conv);
73315         }
73316         LDKWallet ret_var = Wallet_new(source_conv, logger_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_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
73324         LDKWallet 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         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
73330         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
73331         return tag_ptr(ret_ret, true);
73332 }
73333
73334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73335         LDKBumpTransactionEventHandler this_obj_conv;
73336         this_obj_conv.inner = untag_ptr(this_obj);
73337         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73339         BumpTransactionEventHandler_free(this_obj_conv);
73340 }
73341
73342 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) {
73343         void* broadcaster_ptr = untag_ptr(broadcaster);
73344         CHECK_ACCESS(broadcaster_ptr);
73345         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
73346         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
73347                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73348                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
73349         }
73350         void* utxo_source_ptr = untag_ptr(utxo_source);
73351         CHECK_ACCESS(utxo_source_ptr);
73352         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
73353         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
73354                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73355                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
73356         }
73357         void* signer_provider_ptr = untag_ptr(signer_provider);
73358         CHECK_ACCESS(signer_provider_ptr);
73359         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
73360         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
73361                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73362                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
73363         }
73364         void* logger_ptr = untag_ptr(logger);
73365         CHECK_ACCESS(logger_ptr);
73366         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73367         if (logger_conv.free == LDKLogger_JCalls_free) {
73368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73369                 LDKLogger_JCalls_cloned(&logger_conv);
73370         }
73371         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
73372         int64_t ret_ref = 0;
73373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73375         return ret_ref;
73376 }
73377
73378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
73379         LDKBumpTransactionEventHandler this_arg_conv;
73380         this_arg_conv.inner = untag_ptr(this_arg);
73381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73383         this_arg_conv.is_owned = false;
73384         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
73385         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
73386 }
73387
73388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73389         LDKFilesystemStore this_obj_conv;
73390         this_obj_conv.inner = untag_ptr(this_obj);
73391         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73393         FilesystemStore_free(this_obj_conv);
73394 }
73395
73396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
73397         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
73398         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
73399         int64_t ret_ref = 0;
73400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73402         return ret_ref;
73403 }
73404
73405 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
73406         LDKFilesystemStore this_arg_conv;
73407         this_arg_conv.inner = untag_ptr(this_arg);
73408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73410         this_arg_conv.is_owned = false;
73411         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
73412         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
73413         Str_free(ret_str);
73414         return ret_conv;
73415 }
73416
73417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
73418         LDKFilesystemStore this_arg_conv;
73419         this_arg_conv.inner = untag_ptr(this_arg);
73420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73422         this_arg_conv.is_owned = false;
73423         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
73424         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
73425         return tag_ptr(ret_ret, true);
73426 }
73427
73428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73429         LDKBackgroundProcessor this_obj_conv;
73430         this_obj_conv.inner = untag_ptr(this_obj);
73431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73433         BackgroundProcessor_free(this_obj_conv);
73434 }
73435
73436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73437         if (!ptr_is_owned(this_ptr)) return;
73438         void* this_ptr_ptr = untag_ptr(this_ptr);
73439         CHECK_ACCESS(this_ptr_ptr);
73440         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
73441         FREE(untag_ptr(this_ptr));
73442         GossipSync_free(this_ptr_conv);
73443 }
73444
73445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
73446         LDKP2PGossipSync a_conv;
73447         a_conv.inner = untag_ptr(a);
73448         a_conv.is_owned = ptr_is_owned(a);
73449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73450         a_conv.is_owned = false;
73451         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
73452         *ret_copy = GossipSync_p2_p(&a_conv);
73453         int64_t ret_ref = tag_ptr(ret_copy, true);
73454         return ret_ref;
73455 }
73456
73457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
73458         LDKRapidGossipSync a_conv;
73459         a_conv.inner = untag_ptr(a);
73460         a_conv.is_owned = ptr_is_owned(a);
73461         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73462         a_conv.is_owned = false;
73463         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
73464         *ret_copy = GossipSync_rapid(&a_conv);
73465         int64_t ret_ref = tag_ptr(ret_copy, true);
73466         return ret_ref;
73467 }
73468
73469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
73470         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
73471         *ret_copy = GossipSync_none();
73472         int64_t ret_ref = tag_ptr(ret_copy, true);
73473         return ret_ref;
73474 }
73475
73476 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) {
73477         void* persister_ptr = untag_ptr(persister);
73478         CHECK_ACCESS(persister_ptr);
73479         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
73480         if (persister_conv.free == LDKPersister_JCalls_free) {
73481                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73482                 LDKPersister_JCalls_cloned(&persister_conv);
73483         }
73484         void* event_handler_ptr = untag_ptr(event_handler);
73485         CHECK_ACCESS(event_handler_ptr);
73486         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
73487         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
73488                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73489                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
73490         }
73491         LDKChainMonitor chain_monitor_conv;
73492         chain_monitor_conv.inner = untag_ptr(chain_monitor);
73493         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
73494         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
73495         chain_monitor_conv.is_owned = false;
73496         LDKChannelManager channel_manager_conv;
73497         channel_manager_conv.inner = untag_ptr(channel_manager);
73498         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
73499         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
73500         channel_manager_conv.is_owned = false;
73501         void* gossip_sync_ptr = untag_ptr(gossip_sync);
73502         CHECK_ACCESS(gossip_sync_ptr);
73503         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
73504         // WARNING: we may need a move here but no clone is available for LDKGossipSync
73505         LDKPeerManager peer_manager_conv;
73506         peer_manager_conv.inner = untag_ptr(peer_manager);
73507         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
73508         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
73509         peer_manager_conv.is_owned = false;
73510         void* logger_ptr = untag_ptr(logger);
73511         CHECK_ACCESS(logger_ptr);
73512         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73513         if (logger_conv.free == LDKLogger_JCalls_free) {
73514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73515                 LDKLogger_JCalls_cloned(&logger_conv);
73516         }
73517         void* scorer_ptr = untag_ptr(scorer);
73518         CHECK_ACCESS(scorer_ptr);
73519         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
73520         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
73521         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
73522                 // Manually implement clone for Java trait instances
73523                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
73524                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73525                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
73526                 }
73527         }
73528         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);
73529         int64_t ret_ref = 0;
73530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73532         return ret_ref;
73533 }
73534
73535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
73536         LDKBackgroundProcessor this_arg_conv;
73537         this_arg_conv.inner = untag_ptr(this_arg);
73538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73540         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
73541         
73542         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
73543         *ret_conv = BackgroundProcessor_join(this_arg_conv);
73544         return tag_ptr(ret_conv, true);
73545 }
73546
73547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
73548         LDKBackgroundProcessor this_arg_conv;
73549         this_arg_conv.inner = untag_ptr(this_arg);
73550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73552         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
73553         
73554         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
73555         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
73556         return tag_ptr(ret_conv, true);
73557 }
73558
73559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73560         if (!ptr_is_owned(this_ptr)) return;
73561         void* this_ptr_ptr = untag_ptr(this_ptr);
73562         CHECK_ACCESS(this_ptr_ptr);
73563         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
73564         FREE(untag_ptr(this_ptr));
73565         Bolt11ParseError_free(this_ptr_conv);
73566 }
73567
73568 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
73569         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73570         *ret_copy = Bolt11ParseError_clone(arg);
73571         int64_t ret_ref = tag_ptr(ret_copy, true);
73572         return ret_ref;
73573 }
73574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73575         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
73576         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
73577         return ret_conv;
73578 }
73579
73580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73581         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
73582         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73583         *ret_copy = Bolt11ParseError_clone(orig_conv);
73584         int64_t ret_ref = tag_ptr(ret_copy, true);
73585         return ret_ref;
73586 }
73587
73588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
73589         void* a_ptr = untag_ptr(a);
73590         CHECK_ACCESS(a_ptr);
73591         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
73592         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
73593         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73594         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
73595         int64_t ret_ref = tag_ptr(ret_copy, true);
73596         return ret_ref;
73597 }
73598
73599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
73600         
73601         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73602         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
73603         int64_t ret_ref = tag_ptr(ret_copy, true);
73604         return ret_ref;
73605 }
73606
73607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
73608         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
73609         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73610         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
73611         int64_t ret_ref = tag_ptr(ret_copy, true);
73612         return ret_ref;
73613 }
73614
73615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
73616         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73617         *ret_copy = Bolt11ParseError_bad_prefix();
73618         int64_t ret_ref = tag_ptr(ret_copy, true);
73619         return ret_ref;
73620 }
73621
73622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
73623         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73624         *ret_copy = Bolt11ParseError_unknown_currency();
73625         int64_t ret_ref = tag_ptr(ret_copy, true);
73626         return ret_ref;
73627 }
73628
73629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
73630         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73631         *ret_copy = Bolt11ParseError_unknown_si_prefix();
73632         int64_t ret_ref = tag_ptr(ret_copy, true);
73633         return ret_ref;
73634 }
73635
73636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
73637         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73638         *ret_copy = Bolt11ParseError_malformed_hrp();
73639         int64_t ret_ref = tag_ptr(ret_copy, true);
73640         return ret_ref;
73641 }
73642
73643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
73644         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73645         *ret_copy = Bolt11ParseError_too_short_data_part();
73646         int64_t ret_ref = tag_ptr(ret_copy, true);
73647         return ret_ref;
73648 }
73649
73650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
73651         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73652         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
73653         int64_t ret_ref = tag_ptr(ret_copy, true);
73654         return ret_ref;
73655 }
73656
73657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
73658         
73659         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73660         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
73661         int64_t ret_ref = tag_ptr(ret_copy, true);
73662         return ret_ref;
73663 }
73664
73665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
73666         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73667         *ret_copy = Bolt11ParseError_padding_error();
73668         int64_t ret_ref = tag_ptr(ret_copy, true);
73669         return ret_ref;
73670 }
73671
73672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
73673         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73674         *ret_copy = Bolt11ParseError_integer_overflow_error();
73675         int64_t ret_ref = tag_ptr(ret_copy, true);
73676         return ret_ref;
73677 }
73678
73679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
73680         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73681         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
73682         int64_t ret_ref = tag_ptr(ret_copy, true);
73683         return ret_ref;
73684 }
73685
73686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
73687         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73688         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
73689         int64_t ret_ref = tag_ptr(ret_copy, true);
73690         return ret_ref;
73691 }
73692
73693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
73694         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73695         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
73696         int64_t ret_ref = tag_ptr(ret_copy, true);
73697         return ret_ref;
73698 }
73699
73700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
73701         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73702         *ret_copy = Bolt11ParseError_invalid_recovery_id();
73703         int64_t ret_ref = tag_ptr(ret_copy, true);
73704         return ret_ref;
73705 }
73706
73707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
73708         LDKStr a_conv = java_to_owned_str(env, a);
73709         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73710         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
73711         int64_t ret_ref = tag_ptr(ret_copy, true);
73712         return ret_ref;
73713 }
73714
73715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
73716         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
73717         *ret_copy = Bolt11ParseError_skip();
73718         int64_t ret_ref = tag_ptr(ret_copy, true);
73719         return ret_ref;
73720 }
73721
73722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73723         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
73724         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
73725         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
73726         return ret_conv;
73727 }
73728
73729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73730         if (!ptr_is_owned(this_ptr)) return;
73731         void* this_ptr_ptr = untag_ptr(this_ptr);
73732         CHECK_ACCESS(this_ptr_ptr);
73733         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
73734         FREE(untag_ptr(this_ptr));
73735         ParseOrSemanticError_free(this_ptr_conv);
73736 }
73737
73738 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
73739         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
73740         *ret_copy = ParseOrSemanticError_clone(arg);
73741         int64_t ret_ref = tag_ptr(ret_copy, true);
73742         return ret_ref;
73743 }
73744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73745         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
73746         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
73747         return ret_conv;
73748 }
73749
73750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73751         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
73752         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
73753         *ret_copy = ParseOrSemanticError_clone(orig_conv);
73754         int64_t ret_ref = tag_ptr(ret_copy, true);
73755         return ret_ref;
73756 }
73757
73758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
73759         void* a_ptr = untag_ptr(a);
73760         CHECK_ACCESS(a_ptr);
73761         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
73762         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
73763         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
73764         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
73765         int64_t ret_ref = tag_ptr(ret_copy, true);
73766         return ret_ref;
73767 }
73768
73769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
73770         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
73771         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
73772         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
73773         int64_t ret_ref = tag_ptr(ret_copy, true);
73774         return ret_ref;
73775 }
73776
73777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73778         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
73779         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
73780         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
73781         return ret_conv;
73782 }
73783
73784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73785         LDKBolt11Invoice this_obj_conv;
73786         this_obj_conv.inner = untag_ptr(this_obj);
73787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73789         Bolt11Invoice_free(this_obj_conv);
73790 }
73791
73792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73793         LDKBolt11Invoice a_conv;
73794         a_conv.inner = untag_ptr(a);
73795         a_conv.is_owned = ptr_is_owned(a);
73796         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73797         a_conv.is_owned = false;
73798         LDKBolt11Invoice b_conv;
73799         b_conv.inner = untag_ptr(b);
73800         b_conv.is_owned = ptr_is_owned(b);
73801         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73802         b_conv.is_owned = false;
73803         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
73804         return ret_conv;
73805 }
73806
73807 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
73808         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
73809         int64_t ret_ref = 0;
73810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73812         return ret_ref;
73813 }
73814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73815         LDKBolt11Invoice arg_conv;
73816         arg_conv.inner = untag_ptr(arg);
73817         arg_conv.is_owned = ptr_is_owned(arg);
73818         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73819         arg_conv.is_owned = false;
73820         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
73821         return ret_conv;
73822 }
73823
73824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73825         LDKBolt11Invoice orig_conv;
73826         orig_conv.inner = untag_ptr(orig);
73827         orig_conv.is_owned = ptr_is_owned(orig);
73828         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73829         orig_conv.is_owned = false;
73830         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
73831         int64_t ret_ref = 0;
73832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73834         return ret_ref;
73835 }
73836
73837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73838         LDKBolt11Invoice o_conv;
73839         o_conv.inner = untag_ptr(o);
73840         o_conv.is_owned = ptr_is_owned(o);
73841         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73842         o_conv.is_owned = false;
73843         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
73844         return ret_conv;
73845 }
73846
73847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73848         LDKSignedRawBolt11Invoice this_obj_conv;
73849         this_obj_conv.inner = untag_ptr(this_obj);
73850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73852         SignedRawBolt11Invoice_free(this_obj_conv);
73853 }
73854
73855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73856         LDKSignedRawBolt11Invoice a_conv;
73857         a_conv.inner = untag_ptr(a);
73858         a_conv.is_owned = ptr_is_owned(a);
73859         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73860         a_conv.is_owned = false;
73861         LDKSignedRawBolt11Invoice b_conv;
73862         b_conv.inner = untag_ptr(b);
73863         b_conv.is_owned = ptr_is_owned(b);
73864         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73865         b_conv.is_owned = false;
73866         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
73867         return ret_conv;
73868 }
73869
73870 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
73871         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
73872         int64_t ret_ref = 0;
73873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73875         return ret_ref;
73876 }
73877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73878         LDKSignedRawBolt11Invoice arg_conv;
73879         arg_conv.inner = untag_ptr(arg);
73880         arg_conv.is_owned = ptr_is_owned(arg);
73881         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73882         arg_conv.is_owned = false;
73883         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
73884         return ret_conv;
73885 }
73886
73887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73888         LDKSignedRawBolt11Invoice orig_conv;
73889         orig_conv.inner = untag_ptr(orig);
73890         orig_conv.is_owned = ptr_is_owned(orig);
73891         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73892         orig_conv.is_owned = false;
73893         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
73894         int64_t ret_ref = 0;
73895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73897         return ret_ref;
73898 }
73899
73900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73901         LDKSignedRawBolt11Invoice o_conv;
73902         o_conv.inner = untag_ptr(o);
73903         o_conv.is_owned = ptr_is_owned(o);
73904         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73905         o_conv.is_owned = false;
73906         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
73907         return ret_conv;
73908 }
73909
73910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73911         LDKRawBolt11Invoice this_obj_conv;
73912         this_obj_conv.inner = untag_ptr(this_obj);
73913         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73915         RawBolt11Invoice_free(this_obj_conv);
73916 }
73917
73918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
73919         LDKRawBolt11Invoice this_ptr_conv;
73920         this_ptr_conv.inner = untag_ptr(this_ptr);
73921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73923         this_ptr_conv.is_owned = false;
73924         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
73925         int64_t ret_ref = 0;
73926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73928         return ret_ref;
73929 }
73930
73931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73932         LDKRawBolt11Invoice this_ptr_conv;
73933         this_ptr_conv.inner = untag_ptr(this_ptr);
73934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73936         this_ptr_conv.is_owned = false;
73937         LDKRawDataPart val_conv;
73938         val_conv.inner = untag_ptr(val);
73939         val_conv.is_owned = ptr_is_owned(val);
73940         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73941         val_conv = RawDataPart_clone(&val_conv);
73942         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
73943 }
73944
73945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73946         LDKRawBolt11Invoice a_conv;
73947         a_conv.inner = untag_ptr(a);
73948         a_conv.is_owned = ptr_is_owned(a);
73949         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73950         a_conv.is_owned = false;
73951         LDKRawBolt11Invoice b_conv;
73952         b_conv.inner = untag_ptr(b);
73953         b_conv.is_owned = ptr_is_owned(b);
73954         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73955         b_conv.is_owned = false;
73956         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
73957         return ret_conv;
73958 }
73959
73960 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
73961         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
73962         int64_t ret_ref = 0;
73963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73965         return ret_ref;
73966 }
73967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73968         LDKRawBolt11Invoice arg_conv;
73969         arg_conv.inner = untag_ptr(arg);
73970         arg_conv.is_owned = ptr_is_owned(arg);
73971         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73972         arg_conv.is_owned = false;
73973         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
73974         return ret_conv;
73975 }
73976
73977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73978         LDKRawBolt11Invoice orig_conv;
73979         orig_conv.inner = untag_ptr(orig);
73980         orig_conv.is_owned = ptr_is_owned(orig);
73981         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73982         orig_conv.is_owned = false;
73983         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
73984         int64_t ret_ref = 0;
73985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73987         return ret_ref;
73988 }
73989
73990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
73991         LDKRawBolt11Invoice o_conv;
73992         o_conv.inner = untag_ptr(o);
73993         o_conv.is_owned = ptr_is_owned(o);
73994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73995         o_conv.is_owned = false;
73996         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
73997         return ret_conv;
73998 }
73999
74000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74001         LDKRawDataPart this_obj_conv;
74002         this_obj_conv.inner = untag_ptr(this_obj);
74003         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74005         RawDataPart_free(this_obj_conv);
74006 }
74007
74008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
74009         LDKRawDataPart this_ptr_conv;
74010         this_ptr_conv.inner = untag_ptr(this_ptr);
74011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74013         this_ptr_conv.is_owned = false;
74014         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
74015         int64_t ret_ref = 0;
74016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74018         return ret_ref;
74019 }
74020
74021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74022         LDKRawDataPart this_ptr_conv;
74023         this_ptr_conv.inner = untag_ptr(this_ptr);
74024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74026         this_ptr_conv.is_owned = false;
74027         LDKPositiveTimestamp val_conv;
74028         val_conv.inner = untag_ptr(val);
74029         val_conv.is_owned = ptr_is_owned(val);
74030         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74031         val_conv = PositiveTimestamp_clone(&val_conv);
74032         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
74033 }
74034
74035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74036         LDKRawDataPart a_conv;
74037         a_conv.inner = untag_ptr(a);
74038         a_conv.is_owned = ptr_is_owned(a);
74039         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74040         a_conv.is_owned = false;
74041         LDKRawDataPart b_conv;
74042         b_conv.inner = untag_ptr(b);
74043         b_conv.is_owned = ptr_is_owned(b);
74044         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74045         b_conv.is_owned = false;
74046         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
74047         return ret_conv;
74048 }
74049
74050 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
74051         LDKRawDataPart ret_var = RawDataPart_clone(arg);
74052         int64_t ret_ref = 0;
74053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74055         return ret_ref;
74056 }
74057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74058         LDKRawDataPart arg_conv;
74059         arg_conv.inner = untag_ptr(arg);
74060         arg_conv.is_owned = ptr_is_owned(arg);
74061         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74062         arg_conv.is_owned = false;
74063         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
74064         return ret_conv;
74065 }
74066
74067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74068         LDKRawDataPart orig_conv;
74069         orig_conv.inner = untag_ptr(orig);
74070         orig_conv.is_owned = ptr_is_owned(orig);
74071         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74072         orig_conv.is_owned = false;
74073         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
74074         int64_t ret_ref = 0;
74075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74077         return ret_ref;
74078 }
74079
74080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
74081         LDKRawDataPart o_conv;
74082         o_conv.inner = untag_ptr(o);
74083         o_conv.is_owned = ptr_is_owned(o);
74084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74085         o_conv.is_owned = false;
74086         int64_t ret_conv = RawDataPart_hash(&o_conv);
74087         return ret_conv;
74088 }
74089
74090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74091         LDKPositiveTimestamp this_obj_conv;
74092         this_obj_conv.inner = untag_ptr(this_obj);
74093         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74095         PositiveTimestamp_free(this_obj_conv);
74096 }
74097
74098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74099         LDKPositiveTimestamp a_conv;
74100         a_conv.inner = untag_ptr(a);
74101         a_conv.is_owned = ptr_is_owned(a);
74102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74103         a_conv.is_owned = false;
74104         LDKPositiveTimestamp b_conv;
74105         b_conv.inner = untag_ptr(b);
74106         b_conv.is_owned = ptr_is_owned(b);
74107         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74108         b_conv.is_owned = false;
74109         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
74110         return ret_conv;
74111 }
74112
74113 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
74114         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
74115         int64_t ret_ref = 0;
74116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74118         return ret_ref;
74119 }
74120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74121         LDKPositiveTimestamp arg_conv;
74122         arg_conv.inner = untag_ptr(arg);
74123         arg_conv.is_owned = ptr_is_owned(arg);
74124         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74125         arg_conv.is_owned = false;
74126         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
74127         return ret_conv;
74128 }
74129
74130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74131         LDKPositiveTimestamp orig_conv;
74132         orig_conv.inner = untag_ptr(orig);
74133         orig_conv.is_owned = ptr_is_owned(orig);
74134         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74135         orig_conv.is_owned = false;
74136         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
74137         int64_t ret_ref = 0;
74138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74140         return ret_ref;
74141 }
74142
74143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
74144         LDKPositiveTimestamp o_conv;
74145         o_conv.inner = untag_ptr(o);
74146         o_conv.is_owned = ptr_is_owned(o);
74147         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74148         o_conv.is_owned = false;
74149         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
74150         return ret_conv;
74151 }
74152
74153 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74154         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
74155         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
74156         return ret_conv;
74157 }
74158
74159 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
74160         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
74161         return ret_conv;
74162 }
74163
74164 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
74165         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
74166         return ret_conv;
74167 }
74168
74169 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
74170         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
74171         return ret_conv;
74172 }
74173
74174 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
74175         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
74176         return ret_conv;
74177 }
74178
74179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74180         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
74181         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
74182         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
74183         return ret_conv;
74184 }
74185
74186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
74187         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
74188         int64_t ret_conv = SiPrefix_hash(o_conv);
74189         return ret_conv;
74190 }
74191
74192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
74193         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
74194         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
74195         return ret_conv;
74196 }
74197
74198 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74199         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
74200         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
74201         return ret_conv;
74202 }
74203
74204 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
74205         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
74206         return ret_conv;
74207 }
74208
74209 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
74210         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
74211         return ret_conv;
74212 }
74213
74214 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
74215         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
74216         return ret_conv;
74217 }
74218
74219 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
74220         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
74221         return ret_conv;
74222 }
74223
74224 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
74225         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
74226         return ret_conv;
74227 }
74228
74229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
74230         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
74231         int64_t ret_conv = Currency_hash(o_conv);
74232         return ret_conv;
74233 }
74234
74235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74236         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
74237         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
74238         jboolean ret_conv = Currency_eq(a_conv, b_conv);
74239         return ret_conv;
74240 }
74241
74242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74243         LDKSha256 this_obj_conv;
74244         this_obj_conv.inner = untag_ptr(this_obj);
74245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74247         Sha256_free(this_obj_conv);
74248 }
74249
74250 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
74251         LDKSha256 ret_var = Sha256_clone(arg);
74252         int64_t ret_ref = 0;
74253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74255         return ret_ref;
74256 }
74257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74258         LDKSha256 arg_conv;
74259         arg_conv.inner = untag_ptr(arg);
74260         arg_conv.is_owned = ptr_is_owned(arg);
74261         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74262         arg_conv.is_owned = false;
74263         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
74264         return ret_conv;
74265 }
74266
74267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74268         LDKSha256 orig_conv;
74269         orig_conv.inner = untag_ptr(orig);
74270         orig_conv.is_owned = ptr_is_owned(orig);
74271         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74272         orig_conv.is_owned = false;
74273         LDKSha256 ret_var = Sha256_clone(&orig_conv);
74274         int64_t ret_ref = 0;
74275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74277         return ret_ref;
74278 }
74279
74280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
74281         LDKSha256 o_conv;
74282         o_conv.inner = untag_ptr(o);
74283         o_conv.is_owned = ptr_is_owned(o);
74284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74285         o_conv.is_owned = false;
74286         int64_t ret_conv = Sha256_hash(&o_conv);
74287         return ret_conv;
74288 }
74289
74290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74291         LDKSha256 a_conv;
74292         a_conv.inner = untag_ptr(a);
74293         a_conv.is_owned = ptr_is_owned(a);
74294         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74295         a_conv.is_owned = false;
74296         LDKSha256 b_conv;
74297         b_conv.inner = untag_ptr(b);
74298         b_conv.is_owned = ptr_is_owned(b);
74299         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74300         b_conv.is_owned = false;
74301         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
74302         return ret_conv;
74303 }
74304
74305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
74306         uint8_t bytes_arr[32];
74307         CHECK((*env)->GetArrayLength(env, bytes) == 32);
74308         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
74309         uint8_t (*bytes_ref)[32] = &bytes_arr;
74310         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
74311         int64_t ret_ref = 0;
74312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74314         return ret_ref;
74315 }
74316
74317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74318         LDKDescription this_obj_conv;
74319         this_obj_conv.inner = untag_ptr(this_obj);
74320         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74322         Description_free(this_obj_conv);
74323 }
74324
74325 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
74326         LDKDescription ret_var = Description_clone(arg);
74327         int64_t ret_ref = 0;
74328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74330         return ret_ref;
74331 }
74332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74333         LDKDescription arg_conv;
74334         arg_conv.inner = untag_ptr(arg);
74335         arg_conv.is_owned = ptr_is_owned(arg);
74336         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74337         arg_conv.is_owned = false;
74338         int64_t ret_conv = Description_clone_ptr(&arg_conv);
74339         return ret_conv;
74340 }
74341
74342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74343         LDKDescription orig_conv;
74344         orig_conv.inner = untag_ptr(orig);
74345         orig_conv.is_owned = ptr_is_owned(orig);
74346         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74347         orig_conv.is_owned = false;
74348         LDKDescription ret_var = Description_clone(&orig_conv);
74349         int64_t ret_ref = 0;
74350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74352         return ret_ref;
74353 }
74354
74355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
74356         LDKDescription o_conv;
74357         o_conv.inner = untag_ptr(o);
74358         o_conv.is_owned = ptr_is_owned(o);
74359         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74360         o_conv.is_owned = false;
74361         int64_t ret_conv = Description_hash(&o_conv);
74362         return ret_conv;
74363 }
74364
74365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74366         LDKDescription a_conv;
74367         a_conv.inner = untag_ptr(a);
74368         a_conv.is_owned = ptr_is_owned(a);
74369         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74370         a_conv.is_owned = false;
74371         LDKDescription b_conv;
74372         b_conv.inner = untag_ptr(b);
74373         b_conv.is_owned = ptr_is_owned(b);
74374         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74375         b_conv.is_owned = false;
74376         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
74377         return ret_conv;
74378 }
74379
74380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74381         LDKPayeePubKey this_obj_conv;
74382         this_obj_conv.inner = untag_ptr(this_obj);
74383         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74385         PayeePubKey_free(this_obj_conv);
74386 }
74387
74388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
74389         LDKPayeePubKey this_ptr_conv;
74390         this_ptr_conv.inner = untag_ptr(this_ptr);
74391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74393         this_ptr_conv.is_owned = false;
74394         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
74395         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
74396         return ret_arr;
74397 }
74398
74399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74400         LDKPayeePubKey this_ptr_conv;
74401         this_ptr_conv.inner = untag_ptr(this_ptr);
74402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74404         this_ptr_conv.is_owned = false;
74405         LDKPublicKey val_ref;
74406         CHECK((*env)->GetArrayLength(env, val) == 33);
74407         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
74408         PayeePubKey_set_a(&this_ptr_conv, val_ref);
74409 }
74410
74411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
74412         LDKPublicKey a_arg_ref;
74413         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
74414         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
74415         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
74416         int64_t ret_ref = 0;
74417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74419         return ret_ref;
74420 }
74421
74422 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
74423         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
74424         int64_t ret_ref = 0;
74425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74427         return ret_ref;
74428 }
74429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74430         LDKPayeePubKey arg_conv;
74431         arg_conv.inner = untag_ptr(arg);
74432         arg_conv.is_owned = ptr_is_owned(arg);
74433         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74434         arg_conv.is_owned = false;
74435         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
74436         return ret_conv;
74437 }
74438
74439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74440         LDKPayeePubKey orig_conv;
74441         orig_conv.inner = untag_ptr(orig);
74442         orig_conv.is_owned = ptr_is_owned(orig);
74443         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74444         orig_conv.is_owned = false;
74445         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
74446         int64_t ret_ref = 0;
74447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74449         return ret_ref;
74450 }
74451
74452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
74453         LDKPayeePubKey o_conv;
74454         o_conv.inner = untag_ptr(o);
74455         o_conv.is_owned = ptr_is_owned(o);
74456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74457         o_conv.is_owned = false;
74458         int64_t ret_conv = PayeePubKey_hash(&o_conv);
74459         return ret_conv;
74460 }
74461
74462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74463         LDKPayeePubKey a_conv;
74464         a_conv.inner = untag_ptr(a);
74465         a_conv.is_owned = ptr_is_owned(a);
74466         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74467         a_conv.is_owned = false;
74468         LDKPayeePubKey b_conv;
74469         b_conv.inner = untag_ptr(b);
74470         b_conv.is_owned = ptr_is_owned(b);
74471         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74472         b_conv.is_owned = false;
74473         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
74474         return ret_conv;
74475 }
74476
74477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74478         LDKExpiryTime this_obj_conv;
74479         this_obj_conv.inner = untag_ptr(this_obj);
74480         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74482         ExpiryTime_free(this_obj_conv);
74483 }
74484
74485 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
74486         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
74487         int64_t ret_ref = 0;
74488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74490         return ret_ref;
74491 }
74492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74493         LDKExpiryTime arg_conv;
74494         arg_conv.inner = untag_ptr(arg);
74495         arg_conv.is_owned = ptr_is_owned(arg);
74496         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74497         arg_conv.is_owned = false;
74498         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
74499         return ret_conv;
74500 }
74501
74502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74503         LDKExpiryTime orig_conv;
74504         orig_conv.inner = untag_ptr(orig);
74505         orig_conv.is_owned = ptr_is_owned(orig);
74506         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74507         orig_conv.is_owned = false;
74508         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
74509         int64_t ret_ref = 0;
74510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74512         return ret_ref;
74513 }
74514
74515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
74516         LDKExpiryTime o_conv;
74517         o_conv.inner = untag_ptr(o);
74518         o_conv.is_owned = ptr_is_owned(o);
74519         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74520         o_conv.is_owned = false;
74521         int64_t ret_conv = ExpiryTime_hash(&o_conv);
74522         return ret_conv;
74523 }
74524
74525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74526         LDKExpiryTime a_conv;
74527         a_conv.inner = untag_ptr(a);
74528         a_conv.is_owned = ptr_is_owned(a);
74529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74530         a_conv.is_owned = false;
74531         LDKExpiryTime b_conv;
74532         b_conv.inner = untag_ptr(b);
74533         b_conv.is_owned = ptr_is_owned(b);
74534         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74535         b_conv.is_owned = false;
74536         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
74537         return ret_conv;
74538 }
74539
74540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74541         LDKMinFinalCltvExpiryDelta this_obj_conv;
74542         this_obj_conv.inner = untag_ptr(this_obj);
74543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74545         MinFinalCltvExpiryDelta_free(this_obj_conv);
74546 }
74547
74548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
74549         LDKMinFinalCltvExpiryDelta this_ptr_conv;
74550         this_ptr_conv.inner = untag_ptr(this_ptr);
74551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74553         this_ptr_conv.is_owned = false;
74554         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
74555         return ret_conv;
74556 }
74557
74558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74559         LDKMinFinalCltvExpiryDelta this_ptr_conv;
74560         this_ptr_conv.inner = untag_ptr(this_ptr);
74561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74563         this_ptr_conv.is_owned = false;
74564         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
74565 }
74566
74567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
74568         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
74569         int64_t ret_ref = 0;
74570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74572         return ret_ref;
74573 }
74574
74575 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
74576         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
74577         int64_t ret_ref = 0;
74578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74580         return ret_ref;
74581 }
74582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74583         LDKMinFinalCltvExpiryDelta arg_conv;
74584         arg_conv.inner = untag_ptr(arg);
74585         arg_conv.is_owned = ptr_is_owned(arg);
74586         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74587         arg_conv.is_owned = false;
74588         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
74589         return ret_conv;
74590 }
74591
74592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74593         LDKMinFinalCltvExpiryDelta orig_conv;
74594         orig_conv.inner = untag_ptr(orig);
74595         orig_conv.is_owned = ptr_is_owned(orig);
74596         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74597         orig_conv.is_owned = false;
74598         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
74599         int64_t ret_ref = 0;
74600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74602         return ret_ref;
74603 }
74604
74605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
74606         LDKMinFinalCltvExpiryDelta o_conv;
74607         o_conv.inner = untag_ptr(o);
74608         o_conv.is_owned = ptr_is_owned(o);
74609         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74610         o_conv.is_owned = false;
74611         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
74612         return ret_conv;
74613 }
74614
74615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74616         LDKMinFinalCltvExpiryDelta a_conv;
74617         a_conv.inner = untag_ptr(a);
74618         a_conv.is_owned = ptr_is_owned(a);
74619         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74620         a_conv.is_owned = false;
74621         LDKMinFinalCltvExpiryDelta b_conv;
74622         b_conv.inner = untag_ptr(b);
74623         b_conv.is_owned = ptr_is_owned(b);
74624         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74625         b_conv.is_owned = false;
74626         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
74627         return ret_conv;
74628 }
74629
74630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74631         if (!ptr_is_owned(this_ptr)) return;
74632         void* this_ptr_ptr = untag_ptr(this_ptr);
74633         CHECK_ACCESS(this_ptr_ptr);
74634         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
74635         FREE(untag_ptr(this_ptr));
74636         Fallback_free(this_ptr_conv);
74637 }
74638
74639 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
74640         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74641         *ret_copy = Fallback_clone(arg);
74642         int64_t ret_ref = tag_ptr(ret_copy, true);
74643         return ret_ref;
74644 }
74645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74646         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
74647         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
74648         return ret_conv;
74649 }
74650
74651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74652         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
74653         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74654         *ret_copy = Fallback_clone(orig_conv);
74655         int64_t ret_ref = tag_ptr(ret_copy, true);
74656         return ret_ref;
74657 }
74658
74659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
74660         
74661         LDKCVec_u8Z program_ref;
74662         program_ref.datalen = (*env)->GetArrayLength(env, program);
74663         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
74664         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
74665         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74666         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
74667         int64_t ret_ref = tag_ptr(ret_copy, true);
74668         return ret_ref;
74669 }
74670
74671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
74672         LDKTwentyBytes a_ref;
74673         CHECK((*env)->GetArrayLength(env, a) == 20);
74674         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
74675         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74676         *ret_copy = Fallback_pub_key_hash(a_ref);
74677         int64_t ret_ref = tag_ptr(ret_copy, true);
74678         return ret_ref;
74679 }
74680
74681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
74682         LDKTwentyBytes a_ref;
74683         CHECK((*env)->GetArrayLength(env, a) == 20);
74684         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
74685         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
74686         *ret_copy = Fallback_script_hash(a_ref);
74687         int64_t ret_ref = tag_ptr(ret_copy, true);
74688         return ret_ref;
74689 }
74690
74691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
74692         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
74693         int64_t ret_conv = Fallback_hash(o_conv);
74694         return ret_conv;
74695 }
74696
74697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74698         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
74699         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
74700         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
74701         return ret_conv;
74702 }
74703
74704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74705         LDKBolt11InvoiceSignature this_obj_conv;
74706         this_obj_conv.inner = untag_ptr(this_obj);
74707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74709         Bolt11InvoiceSignature_free(this_obj_conv);
74710 }
74711
74712 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
74713         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
74714         int64_t ret_ref = 0;
74715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74717         return ret_ref;
74718 }
74719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74720         LDKBolt11InvoiceSignature arg_conv;
74721         arg_conv.inner = untag_ptr(arg);
74722         arg_conv.is_owned = ptr_is_owned(arg);
74723         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74724         arg_conv.is_owned = false;
74725         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
74726         return ret_conv;
74727 }
74728
74729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74730         LDKBolt11InvoiceSignature orig_conv;
74731         orig_conv.inner = untag_ptr(orig);
74732         orig_conv.is_owned = ptr_is_owned(orig);
74733         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74734         orig_conv.is_owned = false;
74735         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
74736         int64_t ret_ref = 0;
74737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74739         return ret_ref;
74740 }
74741
74742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
74743         LDKBolt11InvoiceSignature o_conv;
74744         o_conv.inner = untag_ptr(o);
74745         o_conv.is_owned = ptr_is_owned(o);
74746         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74747         o_conv.is_owned = false;
74748         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
74749         return ret_conv;
74750 }
74751
74752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74753         LDKBolt11InvoiceSignature a_conv;
74754         a_conv.inner = untag_ptr(a);
74755         a_conv.is_owned = ptr_is_owned(a);
74756         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74757         a_conv.is_owned = false;
74758         LDKBolt11InvoiceSignature b_conv;
74759         b_conv.inner = untag_ptr(b);
74760         b_conv.is_owned = ptr_is_owned(b);
74761         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74762         b_conv.is_owned = false;
74763         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
74764         return ret_conv;
74765 }
74766
74767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74768         LDKPrivateRoute this_obj_conv;
74769         this_obj_conv.inner = untag_ptr(this_obj);
74770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74772         PrivateRoute_free(this_obj_conv);
74773 }
74774
74775 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
74776         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
74777         int64_t ret_ref = 0;
74778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74780         return ret_ref;
74781 }
74782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74783         LDKPrivateRoute arg_conv;
74784         arg_conv.inner = untag_ptr(arg);
74785         arg_conv.is_owned = ptr_is_owned(arg);
74786         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74787         arg_conv.is_owned = false;
74788         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
74789         return ret_conv;
74790 }
74791
74792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74793         LDKPrivateRoute orig_conv;
74794         orig_conv.inner = untag_ptr(orig);
74795         orig_conv.is_owned = ptr_is_owned(orig);
74796         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74797         orig_conv.is_owned = false;
74798         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
74799         int64_t ret_ref = 0;
74800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74802         return ret_ref;
74803 }
74804
74805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
74806         LDKPrivateRoute o_conv;
74807         o_conv.inner = untag_ptr(o);
74808         o_conv.is_owned = ptr_is_owned(o);
74809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74810         o_conv.is_owned = false;
74811         int64_t ret_conv = PrivateRoute_hash(&o_conv);
74812         return ret_conv;
74813 }
74814
74815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74816         LDKPrivateRoute a_conv;
74817         a_conv.inner = untag_ptr(a);
74818         a_conv.is_owned = ptr_is_owned(a);
74819         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74820         a_conv.is_owned = false;
74821         LDKPrivateRoute b_conv;
74822         b_conv.inner = untag_ptr(b);
74823         b_conv.is_owned = ptr_is_owned(b);
74824         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74825         b_conv.is_owned = false;
74826         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
74827         return ret_conv;
74828 }
74829
74830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
74831         LDKSignedRawBolt11Invoice this_arg_conv;
74832         this_arg_conv.inner = untag_ptr(this_arg);
74833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74835         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
74836         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
74837         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
74838         return tag_ptr(ret_conv, true);
74839 }
74840
74841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
74842         LDKSignedRawBolt11Invoice this_arg_conv;
74843         this_arg_conv.inner = untag_ptr(this_arg);
74844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74846         this_arg_conv.is_owned = false;
74847         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
74848         int64_t ret_ref = 0;
74849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74851         return ret_ref;
74852 }
74853
74854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74855         LDKSignedRawBolt11Invoice this_arg_conv;
74856         this_arg_conv.inner = untag_ptr(this_arg);
74857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74859         this_arg_conv.is_owned = false;
74860         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74861         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
74862         return ret_arr;
74863 }
74864
74865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74866         LDKSignedRawBolt11Invoice this_arg_conv;
74867         this_arg_conv.inner = untag_ptr(this_arg);
74868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74870         this_arg_conv.is_owned = false;
74871         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
74872         int64_t ret_ref = 0;
74873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74875         return ret_ref;
74876 }
74877
74878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74879         LDKSignedRawBolt11Invoice this_arg_conv;
74880         this_arg_conv.inner = untag_ptr(this_arg);
74881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74883         this_arg_conv.is_owned = false;
74884         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
74885         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
74886         return tag_ptr(ret_conv, true);
74887 }
74888
74889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
74890         LDKSignedRawBolt11Invoice this_arg_conv;
74891         this_arg_conv.inner = untag_ptr(this_arg);
74892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74894         this_arg_conv.is_owned = false;
74895         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
74896         return ret_conv;
74897 }
74898
74899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74900         LDKRawBolt11Invoice this_arg_conv;
74901         this_arg_conv.inner = untag_ptr(this_arg);
74902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74904         this_arg_conv.is_owned = false;
74905         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74906         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
74907         return ret_arr;
74908 }
74909
74910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74911         LDKRawBolt11Invoice this_arg_conv;
74912         this_arg_conv.inner = untag_ptr(this_arg);
74913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74915         this_arg_conv.is_owned = false;
74916         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
74917         int64_t ret_ref = 0;
74918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74920         return ret_ref;
74921 }
74922
74923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
74924         LDKRawBolt11Invoice this_arg_conv;
74925         this_arg_conv.inner = untag_ptr(this_arg);
74926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74928         this_arg_conv.is_owned = false;
74929         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
74930         int64_t ret_ref = 0;
74931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74933         return ret_ref;
74934 }
74935
74936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74937         LDKRawBolt11Invoice this_arg_conv;
74938         this_arg_conv.inner = untag_ptr(this_arg);
74939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74941         this_arg_conv.is_owned = false;
74942         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
74943         int64_t ret_ref = 0;
74944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74946         return ret_ref;
74947 }
74948
74949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
74950         LDKRawBolt11Invoice this_arg_conv;
74951         this_arg_conv.inner = untag_ptr(this_arg);
74952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74954         this_arg_conv.is_owned = false;
74955         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
74956         int64_t ret_ref = 0;
74957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74959         return ret_ref;
74960 }
74961
74962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
74963         LDKRawBolt11Invoice this_arg_conv;
74964         this_arg_conv.inner = untag_ptr(this_arg);
74965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74967         this_arg_conv.is_owned = false;
74968         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
74969         int64_t ret_ref = 0;
74970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74972         return ret_ref;
74973 }
74974
74975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
74976         LDKRawBolt11Invoice this_arg_conv;
74977         this_arg_conv.inner = untag_ptr(this_arg);
74978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74980         this_arg_conv.is_owned = false;
74981         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
74989         LDKRawBolt11Invoice this_arg_conv;
74990         this_arg_conv.inner = untag_ptr(this_arg);
74991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74993         this_arg_conv.is_owned = false;
74994         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74995         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
74996         int64_t ret_ref = tag_ptr(ret_copy, true);
74997         return ret_ref;
74998 }
74999
75000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
75001         LDKRawBolt11Invoice this_arg_conv;
75002         this_arg_conv.inner = untag_ptr(this_arg);
75003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75005         this_arg_conv.is_owned = false;
75006         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75007         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
75008         int64_t ret_ref = tag_ptr(ret_copy, true);
75009         return ret_ref;
75010 }
75011
75012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
75013         LDKRawBolt11Invoice this_arg_conv;
75014         this_arg_conv.inner = untag_ptr(this_arg);
75015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75017         this_arg_conv.is_owned = false;
75018         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
75019         int64_t ret_ref = 0;
75020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75022         return ret_ref;
75023 }
75024
75025 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
75026         LDKRawBolt11Invoice this_arg_conv;
75027         this_arg_conv.inner = untag_ptr(this_arg);
75028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75030         this_arg_conv.is_owned = false;
75031         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
75032         int64_tArray ret_arr = NULL;
75033         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75034         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75035         for (size_t o = 0; o < ret_var.datalen; o++) {
75036                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
75037                 int64_t ret_conv_14_ref = 0;
75038                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
75039                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
75040                 ret_arr_ptr[o] = ret_conv_14_ref;
75041         }
75042         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75043         FREE(ret_var.data);
75044         return ret_arr;
75045 }
75046
75047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
75048         LDKRawBolt11Invoice this_arg_conv;
75049         this_arg_conv.inner = untag_ptr(this_arg);
75050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75052         this_arg_conv.is_owned = false;
75053         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75054         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
75055         int64_t ret_ref = tag_ptr(ret_copy, true);
75056         return ret_ref;
75057 }
75058
75059 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
75060         LDKRawBolt11Invoice this_arg_conv;
75061         this_arg_conv.inner = untag_ptr(this_arg);
75062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75064         this_arg_conv.is_owned = false;
75065         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
75066         return ret_conv;
75067 }
75068
75069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
75070         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75071         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
75072         return tag_ptr(ret_conv, true);
75073 }
75074
75075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
75076         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75077         *ret_conv = PositiveTimestamp_from_system_time(time);
75078         return tag_ptr(ret_conv, true);
75079 }
75080
75081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
75082         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
75083         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
75084         return tag_ptr(ret_conv, true);
75085 }
75086
75087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
75088         LDKPositiveTimestamp this_arg_conv;
75089         this_arg_conv.inner = untag_ptr(this_arg);
75090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75092         this_arg_conv.is_owned = false;
75093         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
75094         return ret_conv;
75095 }
75096
75097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
75098         LDKPositiveTimestamp this_arg_conv;
75099         this_arg_conv.inner = untag_ptr(this_arg);
75100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75102         this_arg_conv.is_owned = false;
75103         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
75104         return ret_conv;
75105 }
75106
75107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
75108         LDKPositiveTimestamp this_arg_conv;
75109         this_arg_conv.inner = untag_ptr(this_arg);
75110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75112         this_arg_conv.is_owned = false;
75113         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
75114         return ret_conv;
75115 }
75116
75117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
75118         LDKBolt11Invoice this_arg_conv;
75119         this_arg_conv.inner = untag_ptr(this_arg);
75120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75122         this_arg_conv.is_owned = false;
75123         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75124         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
75125         return ret_arr;
75126 }
75127
75128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
75129         LDKBolt11Invoice this_arg_conv;
75130         this_arg_conv.inner = untag_ptr(this_arg);
75131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75133         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
75134         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
75135         int64_t ret_ref = 0;
75136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75138         return ret_ref;
75139 }
75140
75141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
75142         LDKBolt11Invoice this_arg_conv;
75143         this_arg_conv.inner = untag_ptr(this_arg);
75144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75146         this_arg_conv.is_owned = false;
75147         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
75148         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
75149         return tag_ptr(ret_conv, true);
75150 }
75151
75152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
75153         LDKSignedRawBolt11Invoice signed_invoice_conv;
75154         signed_invoice_conv.inner = untag_ptr(signed_invoice);
75155         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
75156         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
75157         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
75158         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
75159         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
75160         return tag_ptr(ret_conv, true);
75161 }
75162
75163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
75164         LDKBolt11Invoice this_arg_conv;
75165         this_arg_conv.inner = untag_ptr(this_arg);
75166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75168         this_arg_conv.is_owned = false;
75169         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
75170         return ret_conv;
75171 }
75172
75173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
75174         LDKBolt11Invoice this_arg_conv;
75175         this_arg_conv.inner = untag_ptr(this_arg);
75176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75178         this_arg_conv.is_owned = false;
75179         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
75180         return ret_conv;
75181 }
75182
75183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
75184         LDKBolt11Invoice this_arg_conv;
75185         this_arg_conv.inner = untag_ptr(this_arg);
75186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75188         this_arg_conv.is_owned = false;
75189         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75190         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
75191         return ret_arr;
75192 }
75193
75194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
75195         LDKBolt11Invoice this_arg_conv;
75196         this_arg_conv.inner = untag_ptr(this_arg);
75197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75199         this_arg_conv.is_owned = false;
75200         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75201         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
75202         return ret_arr;
75203 }
75204
75205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
75206         LDKBolt11Invoice this_arg_conv;
75207         this_arg_conv.inner = untag_ptr(this_arg);
75208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75210         this_arg_conv.is_owned = false;
75211         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75212         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
75213         return ret_arr;
75214 }
75215
75216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
75217         LDKBolt11Invoice this_arg_conv;
75218         this_arg_conv.inner = untag_ptr(this_arg);
75219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75221         this_arg_conv.is_owned = false;
75222         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75223         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
75224         int64_t ret_ref = tag_ptr(ret_copy, true);
75225         return ret_ref;
75226 }
75227
75228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
75229         LDKBolt11Invoice this_arg_conv;
75230         this_arg_conv.inner = untag_ptr(this_arg);
75231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75233         this_arg_conv.is_owned = false;
75234         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
75235         int64_t ret_ref = 0;
75236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75238         return ret_ref;
75239 }
75240
75241 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
75242         LDKBolt11Invoice this_arg_conv;
75243         this_arg_conv.inner = untag_ptr(this_arg);
75244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75246         this_arg_conv.is_owned = false;
75247         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75248         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
75249         return ret_arr;
75250 }
75251
75252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
75253         LDKBolt11Invoice this_arg_conv;
75254         this_arg_conv.inner = untag_ptr(this_arg);
75255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75257         this_arg_conv.is_owned = false;
75258         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75259         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
75260         int64_t ret_ref = tag_ptr(ret_copy, true);
75261         return ret_ref;
75262 }
75263
75264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
75265         LDKBolt11Invoice this_arg_conv;
75266         this_arg_conv.inner = untag_ptr(this_arg);
75267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75269         this_arg_conv.is_owned = false;
75270         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
75271         return ret_conv;
75272 }
75273
75274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
75275         LDKBolt11Invoice this_arg_conv;
75276         this_arg_conv.inner = untag_ptr(this_arg);
75277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75279         this_arg_conv.is_owned = false;
75280         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
75281         return ret_conv;
75282 }
75283
75284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
75285         LDKBolt11Invoice this_arg_conv;
75286         this_arg_conv.inner = untag_ptr(this_arg);
75287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75289         this_arg_conv.is_owned = false;
75290         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
75291         return ret_conv;
75292 }
75293
75294 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) {
75295         LDKBolt11Invoice this_arg_conv;
75296         this_arg_conv.inner = untag_ptr(this_arg);
75297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75299         this_arg_conv.is_owned = false;
75300         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
75301         return ret_conv;
75302 }
75303
75304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
75305         LDKBolt11Invoice this_arg_conv;
75306         this_arg_conv.inner = untag_ptr(this_arg);
75307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75309         this_arg_conv.is_owned = false;
75310         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
75311         return ret_conv;
75312 }
75313
75314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
75315         LDKBolt11Invoice this_arg_conv;
75316         this_arg_conv.inner = untag_ptr(this_arg);
75317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75319         this_arg_conv.is_owned = false;
75320         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
75321         return ret_conv;
75322 }
75323
75324 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
75325         LDKBolt11Invoice this_arg_conv;
75326         this_arg_conv.inner = untag_ptr(this_arg);
75327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75329         this_arg_conv.is_owned = false;
75330         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
75331         jobjectArray ret_arr = NULL;
75332         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
75333         ;
75334         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75335         for (size_t i = 0; i < ret_var.datalen; i++) {
75336                 LDKStr ret_conv_8_str = ret_var.data[i];
75337                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
75338                 Str_free(ret_conv_8_str);
75339                 ret_arr_ptr[i] = ret_conv_8_conv;
75340         }
75341         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75342         FREE(ret_var.data);
75343         return ret_arr;
75344 }
75345
75346 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
75347         LDKBolt11Invoice this_arg_conv;
75348         this_arg_conv.inner = untag_ptr(this_arg);
75349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75351         this_arg_conv.is_owned = false;
75352         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
75353         int64_tArray ret_arr = NULL;
75354         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75355         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75356         for (size_t o = 0; o < ret_var.datalen; o++) {
75357                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
75358                 int64_t ret_conv_14_ref = 0;
75359                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
75360                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
75361                 ret_arr_ptr[o] = ret_conv_14_ref;
75362         }
75363         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75364         FREE(ret_var.data);
75365         return ret_arr;
75366 }
75367
75368 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
75369         LDKBolt11Invoice this_arg_conv;
75370         this_arg_conv.inner = untag_ptr(this_arg);
75371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75373         this_arg_conv.is_owned = false;
75374         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
75375         int64_tArray ret_arr = NULL;
75376         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75377         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75378         for (size_t l = 0; l < ret_var.datalen; l++) {
75379                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
75380                 int64_t ret_conv_11_ref = 0;
75381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
75382                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
75383                 ret_arr_ptr[l] = ret_conv_11_ref;
75384         }
75385         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75386         FREE(ret_var.data);
75387         return ret_arr;
75388 }
75389
75390 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
75391         LDKBolt11Invoice this_arg_conv;
75392         this_arg_conv.inner = untag_ptr(this_arg);
75393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75395         this_arg_conv.is_owned = false;
75396         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
75397         return ret_conv;
75398 }
75399
75400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
75401         LDKBolt11Invoice this_arg_conv;
75402         this_arg_conv.inner = untag_ptr(this_arg);
75403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75405         this_arg_conv.is_owned = false;
75406         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75407         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
75408         int64_t ret_ref = tag_ptr(ret_copy, true);
75409         return ret_ref;
75410 }
75411
75412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
75413         LDKStr description_conv = java_to_owned_str(env, description);
75414         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
75415         *ret_conv = Description_new(description_conv);
75416         return tag_ptr(ret_conv, true);
75417 }
75418
75419 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
75420         LDKDescription this_arg_conv;
75421         this_arg_conv.inner = untag_ptr(this_arg);
75422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75424         this_arg_conv = Description_clone(&this_arg_conv);
75425         LDKStr ret_str = Description_into_inner(this_arg_conv);
75426         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75427         Str_free(ret_str);
75428         return ret_conv;
75429 }
75430
75431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
75432         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
75433         int64_t ret_ref = 0;
75434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75436         return ret_ref;
75437 }
75438
75439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
75440         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
75441         int64_t ret_ref = 0;
75442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75444         return ret_ref;
75445 }
75446
75447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
75448         LDKExpiryTime this_arg_conv;
75449         this_arg_conv.inner = untag_ptr(this_arg);
75450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75452         this_arg_conv.is_owned = false;
75453         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
75454         return ret_conv;
75455 }
75456
75457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
75458         LDKExpiryTime this_arg_conv;
75459         this_arg_conv.inner = untag_ptr(this_arg);
75460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75462         this_arg_conv.is_owned = false;
75463         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
75464         return ret_conv;
75465 }
75466
75467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
75468         LDKRouteHint hops_conv;
75469         hops_conv.inner = untag_ptr(hops);
75470         hops_conv.is_owned = ptr_is_owned(hops);
75471         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
75472         hops_conv = RouteHint_clone(&hops_conv);
75473         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
75474         *ret_conv = PrivateRoute_new(hops_conv);
75475         return tag_ptr(ret_conv, true);
75476 }
75477
75478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
75479         LDKPrivateRoute this_arg_conv;
75480         this_arg_conv.inner = untag_ptr(this_arg);
75481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75483         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
75484         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
75485         int64_t ret_ref = 0;
75486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75488         return ret_ref;
75489 }
75490
75491 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75492         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
75493         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
75494         return ret_conv;
75495 }
75496
75497 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
75498         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
75499         return ret_conv;
75500 }
75501
75502 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
75503         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
75504         return ret_conv;
75505 }
75506
75507 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
75508         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
75509         return ret_conv;
75510 }
75511
75512 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
75513         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
75514         return ret_conv;
75515 }
75516
75517 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
75518         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
75519         return ret_conv;
75520 }
75521
75522 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
75523         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
75524         return ret_conv;
75525 }
75526
75527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75528         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
75529         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
75530         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
75531         return ret_conv;
75532 }
75533
75534 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75535         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
75536         LDKStr ret_str = CreationError_to_str(o_conv);
75537         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75538         Str_free(ret_str);
75539         return ret_conv;
75540 }
75541
75542 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75543         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
75544         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
75545         return ret_conv;
75546 }
75547
75548 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
75549         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
75550         return ret_conv;
75551 }
75552
75553 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
75554         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
75555         return ret_conv;
75556 }
75557
75558 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
75559         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
75560         return ret_conv;
75561 }
75562
75563 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
75564         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
75565         return ret_conv;
75566 }
75567
75568 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
75569         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
75570         return ret_conv;
75571 }
75572
75573 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
75574         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
75575         return ret_conv;
75576 }
75577
75578 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
75579         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
75580         return ret_conv;
75581 }
75582
75583 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
75584         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
75585         return ret_conv;
75586 }
75587
75588 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
75589         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
75590         return ret_conv;
75591 }
75592
75593 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
75594         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
75595         return ret_conv;
75596 }
75597
75598 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75599         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
75600         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
75601         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
75602         return ret_conv;
75603 }
75604
75605 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75606         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
75607         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
75608         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75609         Str_free(ret_str);
75610         return ret_conv;
75611 }
75612
75613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75614         if (!ptr_is_owned(this_ptr)) return;
75615         void* this_ptr_ptr = untag_ptr(this_ptr);
75616         CHECK_ACCESS(this_ptr_ptr);
75617         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
75618         FREE(untag_ptr(this_ptr));
75619         SignOrCreationError_free(this_ptr_conv);
75620 }
75621
75622 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
75623         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
75624         *ret_copy = SignOrCreationError_clone(arg);
75625         int64_t ret_ref = tag_ptr(ret_copy, true);
75626         return ret_ref;
75627 }
75628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75629         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
75630         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
75631         return ret_conv;
75632 }
75633
75634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75635         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
75636         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
75637         *ret_copy = SignOrCreationError_clone(orig_conv);
75638         int64_t ret_ref = tag_ptr(ret_copy, true);
75639         return ret_ref;
75640 }
75641
75642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
75643         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
75644         *ret_copy = SignOrCreationError_sign_error();
75645         int64_t ret_ref = tag_ptr(ret_copy, true);
75646         return ret_ref;
75647 }
75648
75649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
75650         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
75651         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
75652         *ret_copy = SignOrCreationError_creation_error(a_conv);
75653         int64_t ret_ref = tag_ptr(ret_copy, true);
75654         return ret_ref;
75655 }
75656
75657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75658         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
75659         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
75660         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
75661         return ret_conv;
75662 }
75663
75664 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
75665         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
75666         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
75667         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
75668         Str_free(ret_str);
75669         return ret_conv;
75670 }
75671
75672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t retry_strategy, int64_t channelmanager) {
75673         LDKBolt11Invoice invoice_conv;
75674         invoice_conv.inner = untag_ptr(invoice);
75675         invoice_conv.is_owned = ptr_is_owned(invoice);
75676         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75677         invoice_conv.is_owned = false;
75678         void* retry_strategy_ptr = untag_ptr(retry_strategy);
75679         CHECK_ACCESS(retry_strategy_ptr);
75680         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
75681         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
75682         LDKChannelManager channelmanager_conv;
75683         channelmanager_conv.inner = untag_ptr(channelmanager);
75684         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75685         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75686         channelmanager_conv.is_owned = false;
75687         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
75688         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
75689         return tag_ptr(ret_conv, true);
75690 }
75691
75692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) {
75693         LDKBolt11Invoice invoice_conv;
75694         invoice_conv.inner = untag_ptr(invoice);
75695         invoice_conv.is_owned = ptr_is_owned(invoice);
75696         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75697         invoice_conv.is_owned = false;
75698         LDKThirtyTwoBytes payment_id_ref;
75699         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
75700         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
75701         void* retry_strategy_ptr = untag_ptr(retry_strategy);
75702         CHECK_ACCESS(retry_strategy_ptr);
75703         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
75704         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
75705         LDKChannelManager channelmanager_conv;
75706         channelmanager_conv.inner = untag_ptr(channelmanager);
75707         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75708         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75709         channelmanager_conv.is_owned = false;
75710         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
75711         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
75712         return tag_ptr(ret_conv, true);
75713 }
75714
75715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int64_t retry_strategy, int64_t channelmanager) {
75716         LDKBolt11Invoice invoice_conv;
75717         invoice_conv.inner = untag_ptr(invoice);
75718         invoice_conv.is_owned = ptr_is_owned(invoice);
75719         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75720         invoice_conv.is_owned = false;
75721         void* retry_strategy_ptr = untag_ptr(retry_strategy);
75722         CHECK_ACCESS(retry_strategy_ptr);
75723         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
75724         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
75725         LDKChannelManager channelmanager_conv;
75726         channelmanager_conv.inner = untag_ptr(channelmanager);
75727         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75728         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75729         channelmanager_conv.is_owned = false;
75730         LDKCResult_ThirtyTwoBytesPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentErrorZ), "LDKCResult_ThirtyTwoBytesPaymentErrorZ");
75731         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
75732         return tag_ptr(ret_conv, true);
75733 }
75734
75735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) {
75736         LDKBolt11Invoice invoice_conv;
75737         invoice_conv.inner = untag_ptr(invoice);
75738         invoice_conv.is_owned = ptr_is_owned(invoice);
75739         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75740         invoice_conv.is_owned = false;
75741         LDKThirtyTwoBytes payment_id_ref;
75742         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
75743         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
75744         void* retry_strategy_ptr = untag_ptr(retry_strategy);
75745         CHECK_ACCESS(retry_strategy_ptr);
75746         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
75747         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
75748         LDKChannelManager channelmanager_conv;
75749         channelmanager_conv.inner = untag_ptr(channelmanager);
75750         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75751         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75752         channelmanager_conv.is_owned = false;
75753         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
75754         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
75755         return tag_ptr(ret_conv, true);
75756 }
75757
75758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_preflight_1probe_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t channelmanager, int64_t liquidity_limit_multiplier) {
75759         LDKBolt11Invoice invoice_conv;
75760         invoice_conv.inner = untag_ptr(invoice);
75761         invoice_conv.is_owned = ptr_is_owned(invoice);
75762         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75763         invoice_conv.is_owned = false;
75764         LDKChannelManager channelmanager_conv;
75765         channelmanager_conv.inner = untag_ptr(channelmanager);
75766         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75767         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75768         channelmanager_conv.is_owned = false;
75769         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
75770         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
75771         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
75772         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
75773         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
75774         *ret_conv = preflight_probe_invoice(&invoice_conv, &channelmanager_conv, liquidity_limit_multiplier_conv);
75775         return tag_ptr(ret_conv, true);
75776 }
75777
75778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_preflight_1probe_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msat, int64_t channelmanager, int64_t liquidity_limit_multiplier) {
75779         LDKBolt11Invoice invoice_conv;
75780         invoice_conv.inner = untag_ptr(invoice);
75781         invoice_conv.is_owned = ptr_is_owned(invoice);
75782         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
75783         invoice_conv.is_owned = false;
75784         LDKChannelManager channelmanager_conv;
75785         channelmanager_conv.inner = untag_ptr(channelmanager);
75786         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
75787         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
75788         channelmanager_conv.is_owned = false;
75789         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
75790         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
75791         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
75792         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
75793         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ");
75794         *ret_conv = preflight_probe_zero_value_invoice(&invoice_conv, amount_msat, &channelmanager_conv, liquidity_limit_multiplier_conv);
75795         return tag_ptr(ret_conv, true);
75796 }
75797
75798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75799         if (!ptr_is_owned(this_ptr)) return;
75800         void* this_ptr_ptr = untag_ptr(this_ptr);
75801         CHECK_ACCESS(this_ptr_ptr);
75802         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
75803         FREE(untag_ptr(this_ptr));
75804         PaymentError_free(this_ptr_conv);
75805 }
75806
75807 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
75808         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75809         *ret_copy = PaymentError_clone(arg);
75810         int64_t ret_ref = tag_ptr(ret_copy, true);
75811         return ret_ref;
75812 }
75813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75814         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
75815         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
75816         return ret_conv;
75817 }
75818
75819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75820         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
75821         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75822         *ret_copy = PaymentError_clone(orig_conv);
75823         int64_t ret_ref = tag_ptr(ret_copy, true);
75824         return ret_ref;
75825 }
75826
75827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
75828         LDKStr a_conv = java_to_owned_str(env, a);
75829         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75830         *ret_copy = PaymentError_invoice(a_conv);
75831         int64_t ret_ref = tag_ptr(ret_copy, true);
75832         return ret_ref;
75833 }
75834
75835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) {
75836         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a);
75837         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
75838         *ret_copy = PaymentError_sending(a_conv);
75839         int64_t ret_ref = tag_ptr(ret_copy, true);
75840         return ret_ref;
75841 }
75842
75843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75844         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
75845         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
75846         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
75847         return ret_conv;
75848 }
75849
75850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbingError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75851         if (!ptr_is_owned(this_ptr)) return;
75852         void* this_ptr_ptr = untag_ptr(this_ptr);
75853         CHECK_ACCESS(this_ptr_ptr);
75854         LDKProbingError this_ptr_conv = *(LDKProbingError*)(this_ptr_ptr);
75855         FREE(untag_ptr(this_ptr));
75856         ProbingError_free(this_ptr_conv);
75857 }
75858
75859 static inline uint64_t ProbingError_clone_ptr(LDKProbingError *NONNULL_PTR arg) {
75860         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75861         *ret_copy = ProbingError_clone(arg);
75862         int64_t ret_ref = tag_ptr(ret_copy, true);
75863         return ret_ref;
75864 }
75865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75866         LDKProbingError* arg_conv = (LDKProbingError*)untag_ptr(arg);
75867         int64_t ret_conv = ProbingError_clone_ptr(arg_conv);
75868         return ret_conv;
75869 }
75870
75871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75872         LDKProbingError* orig_conv = (LDKProbingError*)untag_ptr(orig);
75873         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75874         *ret_copy = ProbingError_clone(orig_conv);
75875         int64_t ret_ref = tag_ptr(ret_copy, true);
75876         return ret_ref;
75877 }
75878
75879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1invoice(JNIEnv *env, jclass clz, jstring a) {
75880         LDKStr a_conv = java_to_owned_str(env, a);
75881         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75882         *ret_copy = ProbingError_invoice(a_conv);
75883         int64_t ret_ref = tag_ptr(ret_copy, true);
75884         return ret_ref;
75885 }
75886
75887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbingError_1sending(JNIEnv *env, jclass clz, int64_t a) {
75888         void* a_ptr = untag_ptr(a);
75889         CHECK_ACCESS(a_ptr);
75890         LDKProbeSendFailure a_conv = *(LDKProbeSendFailure*)(a_ptr);
75891         a_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(a));
75892         LDKProbingError *ret_copy = MALLOC(sizeof(LDKProbingError), "LDKProbingError");
75893         *ret_copy = ProbingError_sending(a_conv);
75894         int64_t ret_ref = tag_ptr(ret_copy, true);
75895         return ret_ref;
75896 }
75897
75898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbingError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75899         LDKProbingError* a_conv = (LDKProbingError*)untag_ptr(a);
75900         LDKProbingError* b_conv = (LDKProbingError*)untag_ptr(b);
75901         jboolean ret_conv = ProbingError_eq(a_conv, b_conv);
75902         return ret_conv;
75903 }
75904
75905 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) {
75906         void* amt_msat_ptr = untag_ptr(amt_msat);
75907         CHECK_ACCESS(amt_msat_ptr);
75908         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75909         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75910         void* payment_hash_ptr = untag_ptr(payment_hash);
75911         CHECK_ACCESS(payment_hash_ptr);
75912         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
75913         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
75914         LDKStr description_conv = java_to_owned_str(env, description);
75915         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
75916         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
75917         if (phantom_route_hints_constr.datalen > 0)
75918                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
75919         else
75920                 phantom_route_hints_constr.data = NULL;
75921         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
75922         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
75923                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
75924                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
75925                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
75926                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
75927                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
75928                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
75929                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
75930         }
75931         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
75932         void* entropy_source_ptr = untag_ptr(entropy_source);
75933         CHECK_ACCESS(entropy_source_ptr);
75934         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75935         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75936                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75937                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75938         }
75939         void* node_signer_ptr = untag_ptr(node_signer);
75940         CHECK_ACCESS(node_signer_ptr);
75941         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75942         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75943                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75944                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75945         }
75946         void* logger_ptr = untag_ptr(logger);
75947         CHECK_ACCESS(logger_ptr);
75948         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75949         if (logger_conv.free == LDKLogger_JCalls_free) {
75950                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75951                 LDKLogger_JCalls_cloned(&logger_conv);
75952         }
75953         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
75954         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
75955         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
75956         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
75957         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
75958         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
75959         *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);
75960         return tag_ptr(ret_conv, true);
75961 }
75962
75963 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) {
75964         void* amt_msat_ptr = untag_ptr(amt_msat);
75965         CHECK_ACCESS(amt_msat_ptr);
75966         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
75967         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
75968         void* payment_hash_ptr = untag_ptr(payment_hash);
75969         CHECK_ACCESS(payment_hash_ptr);
75970         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
75971         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
75972         LDKSha256 description_hash_conv;
75973         description_hash_conv.inner = untag_ptr(description_hash);
75974         description_hash_conv.is_owned = ptr_is_owned(description_hash);
75975         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
75976         description_hash_conv = Sha256_clone(&description_hash_conv);
75977         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
75978         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
75979         if (phantom_route_hints_constr.datalen > 0)
75980                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
75981         else
75982                 phantom_route_hints_constr.data = NULL;
75983         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
75984         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
75985                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
75986                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
75987                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
75988                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
75989                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
75990                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
75991                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
75992         }
75993         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
75994         void* entropy_source_ptr = untag_ptr(entropy_source);
75995         CHECK_ACCESS(entropy_source_ptr);
75996         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75997         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75999                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76000         }
76001         void* node_signer_ptr = untag_ptr(node_signer);
76002         CHECK_ACCESS(node_signer_ptr);
76003         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76004         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76005                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76006                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76007         }
76008         void* logger_ptr = untag_ptr(logger);
76009         CHECK_ACCESS(logger_ptr);
76010         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76011         if (logger_conv.free == LDKLogger_JCalls_free) {
76012                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76013                 LDKLogger_JCalls_cloned(&logger_conv);
76014         }
76015         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76016         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76017         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76018         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76019         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76020         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76021         *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);
76022         return tag_ptr(ret_conv, true);
76023 }
76024
76025 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) {
76026         LDKChannelManager channelmanager_conv;
76027         channelmanager_conv.inner = untag_ptr(channelmanager);
76028         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76029         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76030         channelmanager_conv.is_owned = false;
76031         void* node_signer_ptr = untag_ptr(node_signer);
76032         CHECK_ACCESS(node_signer_ptr);
76033         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76034         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76036                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76037         }
76038         void* logger_ptr = untag_ptr(logger);
76039         CHECK_ACCESS(logger_ptr);
76040         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76041         if (logger_conv.free == LDKLogger_JCalls_free) {
76042                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76043                 LDKLogger_JCalls_cloned(&logger_conv);
76044         }
76045         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76046         void* amt_msat_ptr = untag_ptr(amt_msat);
76047         CHECK_ACCESS(amt_msat_ptr);
76048         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76049         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76050         LDKStr description_conv = java_to_owned_str(env, description);
76051         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76052         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76053         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76054         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76055         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76056         *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);
76057         return tag_ptr(ret_conv, true);
76058 }
76059
76060 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) {
76061         LDKChannelManager channelmanager_conv;
76062         channelmanager_conv.inner = untag_ptr(channelmanager);
76063         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76064         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76065         channelmanager_conv.is_owned = false;
76066         void* node_signer_ptr = untag_ptr(node_signer);
76067         CHECK_ACCESS(node_signer_ptr);
76068         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76069         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76071                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76072         }
76073         void* logger_ptr = untag_ptr(logger);
76074         CHECK_ACCESS(logger_ptr);
76075         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76076         if (logger_conv.free == LDKLogger_JCalls_free) {
76077                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76078                 LDKLogger_JCalls_cloned(&logger_conv);
76079         }
76080         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76081         void* amt_msat_ptr = untag_ptr(amt_msat);
76082         CHECK_ACCESS(amt_msat_ptr);
76083         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76084         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76085         LDKSha256 description_hash_conv;
76086         description_hash_conv.inner = untag_ptr(description_hash);
76087         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76088         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76089         description_hash_conv = Sha256_clone(&description_hash_conv);
76090         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76091         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76092         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76093         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76094         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76095         *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);
76096         return tag_ptr(ret_conv, true);
76097 }
76098
76099 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) {
76100         LDKChannelManager channelmanager_conv;
76101         channelmanager_conv.inner = untag_ptr(channelmanager);
76102         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76103         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76104         channelmanager_conv.is_owned = false;
76105         void* node_signer_ptr = untag_ptr(node_signer);
76106         CHECK_ACCESS(node_signer_ptr);
76107         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76108         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76109                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76110                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76111         }
76112         void* logger_ptr = untag_ptr(logger);
76113         CHECK_ACCESS(logger_ptr);
76114         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76115         if (logger_conv.free == LDKLogger_JCalls_free) {
76116                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76117                 LDKLogger_JCalls_cloned(&logger_conv);
76118         }
76119         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76120         void* amt_msat_ptr = untag_ptr(amt_msat);
76121         CHECK_ACCESS(amt_msat_ptr);
76122         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76123         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76124         LDKSha256 description_hash_conv;
76125         description_hash_conv.inner = untag_ptr(description_hash);
76126         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76127         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76128         description_hash_conv = Sha256_clone(&description_hash_conv);
76129         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76130         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76131         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76132         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76133         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76134         *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);
76135         return tag_ptr(ret_conv, true);
76136 }
76137
76138 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) {
76139         LDKChannelManager channelmanager_conv;
76140         channelmanager_conv.inner = untag_ptr(channelmanager);
76141         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76142         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76143         channelmanager_conv.is_owned = false;
76144         void* node_signer_ptr = untag_ptr(node_signer);
76145         CHECK_ACCESS(node_signer_ptr);
76146         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76147         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76148                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76149                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76150         }
76151         void* logger_ptr = untag_ptr(logger);
76152         CHECK_ACCESS(logger_ptr);
76153         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76154         if (logger_conv.free == LDKLogger_JCalls_free) {
76155                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76156                 LDKLogger_JCalls_cloned(&logger_conv);
76157         }
76158         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76159         void* amt_msat_ptr = untag_ptr(amt_msat);
76160         CHECK_ACCESS(amt_msat_ptr);
76161         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76162         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76163         LDKStr description_conv = java_to_owned_str(env, description);
76164         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76165         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76166         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76167         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76168         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76169         *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);
76170         return tag_ptr(ret_conv, true);
76171 }
76172
76173 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) {
76174         LDKChannelManager channelmanager_conv;
76175         channelmanager_conv.inner = untag_ptr(channelmanager);
76176         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
76177         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
76178         channelmanager_conv.is_owned = false;
76179         void* node_signer_ptr = untag_ptr(node_signer);
76180         CHECK_ACCESS(node_signer_ptr);
76181         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76182         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76183                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76184                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76185         }
76186         void* logger_ptr = untag_ptr(logger);
76187         CHECK_ACCESS(logger_ptr);
76188         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76189         if (logger_conv.free == LDKLogger_JCalls_free) {
76190                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76191                 LDKLogger_JCalls_cloned(&logger_conv);
76192         }
76193         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
76194         void* amt_msat_ptr = untag_ptr(amt_msat);
76195         CHECK_ACCESS(amt_msat_ptr);
76196         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76197         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76198         LDKStr description_conv = java_to_owned_str(env, description);
76199         LDKThirtyTwoBytes payment_hash_ref;
76200         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
76201         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
76202         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76203         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76204         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76205         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76206         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76207         *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);
76208         return tag_ptr(ret_conv, true);
76209 }
76210
76211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
76212         LDKStr s_conv = java_to_owned_str(env, s);
76213         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
76214         *ret_conv = SiPrefix_from_str(s_conv);
76215         return tag_ptr(ret_conv, true);
76216 }
76217
76218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
76219         LDKStr s_conv = java_to_owned_str(env, s);
76220         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
76221         *ret_conv = Bolt11Invoice_from_str(s_conv);
76222         return tag_ptr(ret_conv, true);
76223 }
76224
76225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
76226         LDKStr s_conv = java_to_owned_str(env, s);
76227         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
76228         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
76229         return tag_ptr(ret_conv, true);
76230 }
76231
76232 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76233         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
76234         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
76235         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76236         Str_free(ret_str);
76237         return ret_conv;
76238 }
76239
76240 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76241         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
76242         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
76243         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76244         Str_free(ret_str);
76245         return ret_conv;
76246 }
76247
76248 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76249         LDKBolt11Invoice o_conv;
76250         o_conv.inner = untag_ptr(o);
76251         o_conv.is_owned = ptr_is_owned(o);
76252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76253         o_conv.is_owned = false;
76254         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
76255         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76256         Str_free(ret_str);
76257         return ret_conv;
76258 }
76259
76260 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76261         LDKSignedRawBolt11Invoice o_conv;
76262         o_conv.inner = untag_ptr(o);
76263         o_conv.is_owned = ptr_is_owned(o);
76264         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76265         o_conv.is_owned = false;
76266         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
76267         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76268         Str_free(ret_str);
76269         return ret_conv;
76270 }
76271
76272 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76273         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
76274         LDKStr ret_str = Currency_to_str(o_conv);
76275         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76276         Str_free(ret_str);
76277         return ret_conv;
76278 }
76279
76280 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
76281         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
76282         LDKStr ret_str = SiPrefix_to_str(o_conv);
76283         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
76284         Str_free(ret_str);
76285         return ret_conv;
76286 }
76287
76288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76289         LDKRapidGossipSync this_obj_conv;
76290         this_obj_conv.inner = untag_ptr(this_obj);
76291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76293         RapidGossipSync_free(this_obj_conv);
76294 }
76295
76296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
76297         LDKNetworkGraph network_graph_conv;
76298         network_graph_conv.inner = untag_ptr(network_graph);
76299         network_graph_conv.is_owned = ptr_is_owned(network_graph);
76300         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
76301         network_graph_conv.is_owned = false;
76302         void* logger_ptr = untag_ptr(logger);
76303         CHECK_ACCESS(logger_ptr);
76304         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76305         if (logger_conv.free == LDKLogger_JCalls_free) {
76306                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76307                 LDKLogger_JCalls_cloned(&logger_conv);
76308         }
76309         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
76310         int64_t ret_ref = 0;
76311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76313         return ret_ref;
76314 }
76315
76316 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) {
76317         LDKRapidGossipSync this_arg_conv;
76318         this_arg_conv.inner = untag_ptr(this_arg);
76319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76321         this_arg_conv.is_owned = false;
76322         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
76323         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
76324         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
76325         return tag_ptr(ret_conv, true);
76326 }
76327
76328 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) {
76329         LDKRapidGossipSync this_arg_conv;
76330         this_arg_conv.inner = untag_ptr(this_arg);
76331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76333         this_arg_conv.is_owned = false;
76334         LDKu8slice update_data_ref;
76335         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
76336         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
76337         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
76338         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
76339         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
76340         return tag_ptr(ret_conv, true);
76341 }
76342
76343 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) {
76344         LDKRapidGossipSync this_arg_conv;
76345         this_arg_conv.inner = untag_ptr(this_arg);
76346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76348         this_arg_conv.is_owned = false;
76349         LDKu8slice update_data_ref;
76350         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
76351         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
76352         void* current_time_unix_ptr = untag_ptr(current_time_unix);
76353         CHECK_ACCESS(current_time_unix_ptr);
76354         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
76355         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
76356         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
76357         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
76358         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
76359         return tag_ptr(ret_conv, true);
76360 }
76361
76362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
76363         LDKRapidGossipSync this_arg_conv;
76364         this_arg_conv.inner = untag_ptr(this_arg);
76365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76367         this_arg_conv.is_owned = false;
76368         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
76369         return ret_conv;
76370 }
76371
76372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
76373         if (!ptr_is_owned(this_ptr)) return;
76374         void* this_ptr_ptr = untag_ptr(this_ptr);
76375         CHECK_ACCESS(this_ptr_ptr);
76376         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
76377         FREE(untag_ptr(this_ptr));
76378         GraphSyncError_free(this_ptr_conv);
76379 }
76380
76381 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
76382         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
76383         *ret_copy = GraphSyncError_clone(arg);
76384         int64_t ret_ref = tag_ptr(ret_copy, true);
76385         return ret_ref;
76386 }
76387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76388         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
76389         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
76390         return ret_conv;
76391 }
76392
76393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76394         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
76395         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
76396         *ret_copy = GraphSyncError_clone(orig_conv);
76397         int64_t ret_ref = tag_ptr(ret_copy, true);
76398         return ret_ref;
76399 }
76400
76401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
76402         void* a_ptr = untag_ptr(a);
76403         CHECK_ACCESS(a_ptr);
76404         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
76405         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
76406         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
76407         *ret_copy = GraphSyncError_decode_error(a_conv);
76408         int64_t ret_ref = tag_ptr(ret_copy, true);
76409         return ret_ref;
76410 }
76411
76412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
76413         LDKLightningError a_conv;
76414         a_conv.inner = untag_ptr(a);
76415         a_conv.is_owned = ptr_is_owned(a);
76416         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76417         a_conv = LightningError_clone(&a_conv);
76418         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
76419         *ret_copy = GraphSyncError_lightning_error(a_conv);
76420         int64_t ret_ref = tag_ptr(ret_copy, true);
76421         return ret_ref;
76422 }
76423