d62c42c7fff502fd5223d72c63c88ea6a2790257
[ldk-java] / src / main / jni / bindings.c
1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include <jni.h>
4 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
5 #define int64_t jlong
6 #include "org_ldk_impl_bindings.h"
7 #include <lightning.h>
8 #include <string.h>
9 #include <stdatomic.h>
10 #include <stdlib.h>
11
12 #define LIKELY(v) __builtin_expect(!!(v), 1)
13 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
14
15 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
16 #define MALLOC(a, _) malloc(a)
17 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
18 #define CHECK_ACCESS(p)
19 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
20 #define DO_ASSERT(a) (void)(a)
21 #define CHECK(a)
22
23 static jmethodID ordinal_meth = NULL;
24 static jmethodID slicedef_meth = NULL;
25 static jclass slicedef_cls = NULL;
26 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
27         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
28         CHECK(ordinal_meth != NULL);
29         slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
30         CHECK(slicedef_meth != NULL);
31         slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
32         CHECK(slicedef_cls != NULL);
33 }
34
35 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
36         return *((bool*)ptr);
37 }
38 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
39         return *((long*)ptr);
40 }
41 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
42         FREE((void*)ptr);
43 }
44 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
45         jbyteArray ret_arr = (*env)->NewByteArray(env, len);
46         (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
47         return ret_arr;
48 }
49 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
50         LDKu8slice *slice = (LDKu8slice*)slice_ptr;
51         jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
52         (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
53         return ret_arr;
54 }
55 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
56         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
57         vec->datalen = (*env)->GetArrayLength(env, bytes);
58         vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
59         (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
60         return (uint64_t)vec;
61 }
62 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
63         LDKTransaction *txdata = (LDKTransaction*)ptr;
64         LDKu8slice slice;
65         slice.data = txdata->data;
66         slice.datalen = txdata->datalen;
67         return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
68 }
69 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
70         LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
71         txdata->datalen = (*env)->GetArrayLength(env, bytes);
72         txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
73         txdata->data_is_owned = false;
74         (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
75         return (uint64_t)txdata;
76 }
77 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
78         LDKTransaction *tx = (LDKTransaction*)ptr;
79         tx->data_is_owned = true;
80         Transaction_free(*tx);
81         FREE((void*)ptr);
82 }
83 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
84         // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
85         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
86         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
87         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
88         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
89         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
90         return (uint64_t)vec->datalen;
91 }
92 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
93         // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
94         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
95         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
96         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
97         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
98         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
99         vec->data = NULL;
100         vec->datalen = 0;
101         return (uint64_t)vec;
102 }
103
104 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
105 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
106 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
107 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
108
109 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
110 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
111 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
112
113 typedef jlongArray int64_tArray;
114 typedef jbyteArray int8_tArray;
115
116 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
117         // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
118         char* conv_buf = MALLOC(len + 1, "str conv buf");
119         memcpy(conv_buf, chars, len);
120         conv_buf[len] = 0;
121         jstring ret = (*env)->NewStringUTF(env, conv_buf);
122         FREE(conv_buf);
123         return ret;
124 }
125 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
126         uint64_t str_len = (*env)->GetStringUTFLength(env, str);
127         char* newchars = MALLOC(str_len + 1, "String chars");
128         const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
129         memcpy(newchars, jchars, str_len);
130         newchars[str_len] = 0;
131         (*env)->ReleaseStringUTFChars(env, str, jchars);
132         LDKStr res = {
133                 .chars = newchars,
134                 .len = str_len,
135                 .chars_is_owned = true
136         };
137         return res;
138 }
139
140 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
141         return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
142 }
143 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
144         return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
145 }
146 #include "version.c"
147 static jclass arr_of_B_clz = NULL;
148 static jclass arr_of_J_clz = NULL;
149 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
150         arr_of_B_clz = (*env)->FindClass(env, "[B");
151         CHECK(arr_of_B_clz != NULL);
152         arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
153         arr_of_J_clz = (*env)->FindClass(env, "[J");
154         CHECK(arr_of_J_clz != NULL);
155         arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
156 }
157 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
158
159 static inline void* untag_ptr(uint64_t ptr) {
160         if (ptr < 4096) return (void*)ptr;
161         if (sizeof(void*) == 4) {
162                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
163                 return (void*)(uintptr_t)ptr;
164         } else {
165                 // For 64-bit systems, assume the top byte is used for tagging, then
166                 // use bit 9 ^ bit 10.
167                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
168                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
169 #ifdef LDK_DEBUG_BUILD
170                 // On debug builds we also use the 11th bit as a debug flag
171                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
172                 CHECK(tenth_bit != eleventh_bit);
173                 p ^= 1ULL << 53;
174 #endif
175                 return (void*)p;
176         }
177 }
178 static inline bool ptr_is_owned(uint64_t ptr) {
179         if(ptr < 4096) return true;
180         if (sizeof(void*) == 4) {
181                 return ptr & (1ULL << 32);
182         } else {
183                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
184                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
185 #ifdef LDK_DEBUG_BUILD
186                 // On debug builds we also use the 11th bit as a debug flag
187                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
188                 CHECK(tenth_bit != eleventh_bit);
189 #endif
190                 return (ninth_bit ^ tenth_bit) ? true : false;
191         }
192 }
193 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
194         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
195         if (sizeof(void*) == 4) {
196                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
197         } else {
198                 CHECK(sizeof(uintptr_t) == 8);
199                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
200                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
201 #ifdef LDK_DEBUG_BUILD
202                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
203                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
204                 CHECK(ninth_bit == tenth_bit);
205                 CHECK(ninth_bit == eleventh_bit);
206                 t ^= 1ULL << 53;
207 #endif
208                 CHECK(ptr_is_owned(t) == is_owned);
209                 CHECK(untag_ptr(t) == ptr);
210                 return t;
211         }
212 }
213
214 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
215         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
216         if (UNLIKELY((*env)->ExceptionCheck(env))) {
217                 (*env)->ExceptionDescribe(env);
218                 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception.");
219         }
220         switch (ord) {
221                 case 0: return LDKAccessError_UnknownChain;
222                 case 1: return LDKAccessError_UnknownTx;
223         }
224         (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value.");
225         abort(); // Unreachable, but will let the compiler know we don't return here
226 }
227 static jclass AccessError_class = NULL;
228 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
229 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
230 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
231         AccessError_class = (*env)->NewGlobalRef(env, clz);
232         CHECK(AccessError_class != NULL);
233         AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
234         CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
235         AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
236         CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
237 }
238 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
239         switch (val) {
240                 case LDKAccessError_UnknownChain:
241                         return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
242                 case LDKAccessError_UnknownTx:
243                         return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
244                 default: abort();
245         }
246 }
247
248 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
249         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
250         if (UNLIKELY((*env)->ExceptionCheck(env))) {
251                 (*env)->ExceptionDescribe(env);
252                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
253         }
254         switch (ord) {
255                 case 0: return LDKCOption_NoneZ_Some;
256                 case 1: return LDKCOption_NoneZ_None;
257         }
258         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
259         abort(); // Unreachable, but will let the compiler know we don't return here
260 }
261 static jclass COption_NoneZ_class = NULL;
262 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
263 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
264 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
265         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
266         CHECK(COption_NoneZ_class != NULL);
267         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
268         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
269         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
270         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
271 }
272 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
273         switch (val) {
274                 case LDKCOption_NoneZ_Some:
275                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
276                 case LDKCOption_NoneZ_None:
277                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
278                 default: abort();
279         }
280 }
281
282 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
283         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
284         if (UNLIKELY((*env)->ExceptionCheck(env))) {
285                 (*env)->ExceptionDescribe(env);
286                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception.");
287         }
288         switch (ord) {
289                 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
290                 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
291         }
292         (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value.");
293         abort(); // Unreachable, but will let the compiler know we don't return here
294 }
295 static jclass ChannelMonitorUpdateErr_class = NULL;
296 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
297 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
298 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
299         ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
300         CHECK(ChannelMonitorUpdateErr_class != NULL);
301         ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
302         CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
303         ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
304         CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
305 }
306 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
307         switch (val) {
308                 case LDKChannelMonitorUpdateErr_TemporaryFailure:
309                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
310                 case LDKChannelMonitorUpdateErr_PermanentFailure:
311                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
312                 default: abort();
313         }
314 }
315
316 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
317         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
318         if (UNLIKELY((*env)->ExceptionCheck(env))) {
319                 (*env)->ExceptionDescribe(env);
320                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
321         }
322         switch (ord) {
323                 case 0: return LDKConfirmationTarget_Background;
324                 case 1: return LDKConfirmationTarget_Normal;
325                 case 2: return LDKConfirmationTarget_HighPriority;
326         }
327         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
328         abort(); // Unreachable, but will let the compiler know we don't return here
329 }
330 static jclass ConfirmationTarget_class = NULL;
331 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
332 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
333 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
334 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
335         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
336         CHECK(ConfirmationTarget_class != NULL);
337         ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
338         CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
339         ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
340         CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
341         ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
342         CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
343 }
344 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
345         switch (val) {
346                 case LDKConfirmationTarget_Background:
347                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
348                 case LDKConfirmationTarget_Normal:
349                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
350                 case LDKConfirmationTarget_HighPriority:
351                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
352                 default: abort();
353         }
354 }
355
356 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
357         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
358         if (UNLIKELY((*env)->ExceptionCheck(env))) {
359                 (*env)->ExceptionDescribe(env);
360                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
361         }
362         switch (ord) {
363                 case 0: return LDKCreationError_DescriptionTooLong;
364                 case 1: return LDKCreationError_RouteTooLong;
365                 case 2: return LDKCreationError_TimestampOutOfBounds;
366                 case 3: return LDKCreationError_InvalidAmount;
367                 case 4: return LDKCreationError_MissingRouteHints;
368         }
369         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
370         abort(); // Unreachable, but will let the compiler know we don't return here
371 }
372 static jclass CreationError_class = NULL;
373 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
374 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
375 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
376 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
377 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
378 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
379         CreationError_class = (*env)->NewGlobalRef(env, clz);
380         CHECK(CreationError_class != NULL);
381         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
382         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
383         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
384         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
385         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
386         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
387         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
388         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
389         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
390         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
391 }
392 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
393         switch (val) {
394                 case LDKCreationError_DescriptionTooLong:
395                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
396                 case LDKCreationError_RouteTooLong:
397                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
398                 case LDKCreationError_TimestampOutOfBounds:
399                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
400                 case LDKCreationError_InvalidAmount:
401                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
402                 case LDKCreationError_MissingRouteHints:
403                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
404                 default: abort();
405         }
406 }
407
408 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
409         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
410         if (UNLIKELY((*env)->ExceptionCheck(env))) {
411                 (*env)->ExceptionDescribe(env);
412                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
413         }
414         switch (ord) {
415                 case 0: return LDKCurrency_Bitcoin;
416                 case 1: return LDKCurrency_BitcoinTestnet;
417                 case 2: return LDKCurrency_Regtest;
418                 case 3: return LDKCurrency_Simnet;
419                 case 4: return LDKCurrency_Signet;
420         }
421         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
422         abort(); // Unreachable, but will let the compiler know we don't return here
423 }
424 static jclass Currency_class = NULL;
425 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
426 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
427 static jfieldID Currency_LDKCurrency_Regtest = NULL;
428 static jfieldID Currency_LDKCurrency_Simnet = NULL;
429 static jfieldID Currency_LDKCurrency_Signet = NULL;
430 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
431         Currency_class = (*env)->NewGlobalRef(env, clz);
432         CHECK(Currency_class != NULL);
433         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
434         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
435         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
436         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
437         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
438         CHECK(Currency_LDKCurrency_Regtest != NULL);
439         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
440         CHECK(Currency_LDKCurrency_Simnet != NULL);
441         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
442         CHECK(Currency_LDKCurrency_Signet != NULL);
443 }
444 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
445         switch (val) {
446                 case LDKCurrency_Bitcoin:
447                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
448                 case LDKCurrency_BitcoinTestnet:
449                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
450                 case LDKCurrency_Regtest:
451                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
452                 case LDKCurrency_Simnet:
453                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
454                 case LDKCurrency_Signet:
455                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
456                 default: abort();
457         }
458 }
459
460 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
461         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
462         if (UNLIKELY((*env)->ExceptionCheck(env))) {
463                 (*env)->ExceptionDescribe(env);
464                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
465         }
466         switch (ord) {
467                 case 0: return LDKIOError_NotFound;
468                 case 1: return LDKIOError_PermissionDenied;
469                 case 2: return LDKIOError_ConnectionRefused;
470                 case 3: return LDKIOError_ConnectionReset;
471                 case 4: return LDKIOError_ConnectionAborted;
472                 case 5: return LDKIOError_NotConnected;
473                 case 6: return LDKIOError_AddrInUse;
474                 case 7: return LDKIOError_AddrNotAvailable;
475                 case 8: return LDKIOError_BrokenPipe;
476                 case 9: return LDKIOError_AlreadyExists;
477                 case 10: return LDKIOError_WouldBlock;
478                 case 11: return LDKIOError_InvalidInput;
479                 case 12: return LDKIOError_InvalidData;
480                 case 13: return LDKIOError_TimedOut;
481                 case 14: return LDKIOError_WriteZero;
482                 case 15: return LDKIOError_Interrupted;
483                 case 16: return LDKIOError_Other;
484                 case 17: return LDKIOError_UnexpectedEof;
485         }
486         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
487         abort(); // Unreachable, but will let the compiler know we don't return here
488 }
489 static jclass IOError_class = NULL;
490 static jfieldID IOError_LDKIOError_NotFound = NULL;
491 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
492 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
493 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
494 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
495 static jfieldID IOError_LDKIOError_NotConnected = NULL;
496 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
497 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
498 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
499 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
500 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
501 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
502 static jfieldID IOError_LDKIOError_InvalidData = NULL;
503 static jfieldID IOError_LDKIOError_TimedOut = NULL;
504 static jfieldID IOError_LDKIOError_WriteZero = NULL;
505 static jfieldID IOError_LDKIOError_Interrupted = NULL;
506 static jfieldID IOError_LDKIOError_Other = NULL;
507 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
508 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
509         IOError_class = (*env)->NewGlobalRef(env, clz);
510         CHECK(IOError_class != NULL);
511         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
512         CHECK(IOError_LDKIOError_NotFound != NULL);
513         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
514         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
515         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
516         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
517         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
518         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
519         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
520         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
521         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
522         CHECK(IOError_LDKIOError_NotConnected != NULL);
523         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
524         CHECK(IOError_LDKIOError_AddrInUse != NULL);
525         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
526         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
527         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
528         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
529         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
530         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
531         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
532         CHECK(IOError_LDKIOError_WouldBlock != NULL);
533         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
534         CHECK(IOError_LDKIOError_InvalidInput != NULL);
535         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
536         CHECK(IOError_LDKIOError_InvalidData != NULL);
537         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
538         CHECK(IOError_LDKIOError_TimedOut != NULL);
539         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
540         CHECK(IOError_LDKIOError_WriteZero != NULL);
541         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
542         CHECK(IOError_LDKIOError_Interrupted != NULL);
543         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
544         CHECK(IOError_LDKIOError_Other != NULL);
545         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
546         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
547 }
548 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
549         switch (val) {
550                 case LDKIOError_NotFound:
551                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
552                 case LDKIOError_PermissionDenied:
553                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
554                 case LDKIOError_ConnectionRefused:
555                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
556                 case LDKIOError_ConnectionReset:
557                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
558                 case LDKIOError_ConnectionAborted:
559                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
560                 case LDKIOError_NotConnected:
561                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
562                 case LDKIOError_AddrInUse:
563                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
564                 case LDKIOError_AddrNotAvailable:
565                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
566                 case LDKIOError_BrokenPipe:
567                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
568                 case LDKIOError_AlreadyExists:
569                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
570                 case LDKIOError_WouldBlock:
571                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
572                 case LDKIOError_InvalidInput:
573                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
574                 case LDKIOError_InvalidData:
575                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
576                 case LDKIOError_TimedOut:
577                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
578                 case LDKIOError_WriteZero:
579                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
580                 case LDKIOError_Interrupted:
581                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
582                 case LDKIOError_Other:
583                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
584                 case LDKIOError_UnexpectedEof:
585                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
586                 default: abort();
587         }
588 }
589
590 static inline LDKLevel LDKLevel_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 Level.ordinal() from rust threw an exception.");
595         }
596         switch (ord) {
597                 case 0: return LDKLevel_Gossip;
598                 case 1: return LDKLevel_Trace;
599                 case 2: return LDKLevel_Debug;
600                 case 3: return LDKLevel_Info;
601                 case 4: return LDKLevel_Warn;
602                 case 5: return LDKLevel_Error;
603         }
604         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
605         abort(); // Unreachable, but will let the compiler know we don't return here
606 }
607 static jclass Level_class = NULL;
608 static jfieldID Level_LDKLevel_Gossip = NULL;
609 static jfieldID Level_LDKLevel_Trace = NULL;
610 static jfieldID Level_LDKLevel_Debug = NULL;
611 static jfieldID Level_LDKLevel_Info = NULL;
612 static jfieldID Level_LDKLevel_Warn = NULL;
613 static jfieldID Level_LDKLevel_Error = NULL;
614 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
615         Level_class = (*env)->NewGlobalRef(env, clz);
616         CHECK(Level_class != NULL);
617         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
618         CHECK(Level_LDKLevel_Gossip != NULL);
619         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
620         CHECK(Level_LDKLevel_Trace != NULL);
621         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
622         CHECK(Level_LDKLevel_Debug != NULL);
623         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
624         CHECK(Level_LDKLevel_Info != NULL);
625         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
626         CHECK(Level_LDKLevel_Warn != NULL);
627         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
628         CHECK(Level_LDKLevel_Error != NULL);
629 }
630 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
631         switch (val) {
632                 case LDKLevel_Gossip:
633                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
634                 case LDKLevel_Trace:
635                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
636                 case LDKLevel_Debug:
637                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
638                 case LDKLevel_Info:
639                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
640                 case LDKLevel_Warn:
641                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
642                 case LDKLevel_Error:
643                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
644                 default: abort();
645         }
646 }
647
648 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
649         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
650         if (UNLIKELY((*env)->ExceptionCheck(env))) {
651                 (*env)->ExceptionDescribe(env);
652                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
653         }
654         switch (ord) {
655                 case 0: return LDKNetwork_Bitcoin;
656                 case 1: return LDKNetwork_Testnet;
657                 case 2: return LDKNetwork_Regtest;
658                 case 3: return LDKNetwork_Signet;
659         }
660         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
661         abort(); // Unreachable, but will let the compiler know we don't return here
662 }
663 static jclass Network_class = NULL;
664 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
665 static jfieldID Network_LDKNetwork_Testnet = NULL;
666 static jfieldID Network_LDKNetwork_Regtest = NULL;
667 static jfieldID Network_LDKNetwork_Signet = NULL;
668 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
669         Network_class = (*env)->NewGlobalRef(env, clz);
670         CHECK(Network_class != NULL);
671         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
672         CHECK(Network_LDKNetwork_Bitcoin != NULL);
673         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
674         CHECK(Network_LDKNetwork_Testnet != NULL);
675         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
676         CHECK(Network_LDKNetwork_Regtest != NULL);
677         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
678         CHECK(Network_LDKNetwork_Signet != NULL);
679 }
680 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
681         switch (val) {
682                 case LDKNetwork_Bitcoin:
683                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
684                 case LDKNetwork_Testnet:
685                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
686                 case LDKNetwork_Regtest:
687                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
688                 case LDKNetwork_Signet:
689                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
690                 default: abort();
691         }
692 }
693
694 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
695         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
696         if (UNLIKELY((*env)->ExceptionCheck(env))) {
697                 (*env)->ExceptionDescribe(env);
698                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
699         }
700         switch (ord) {
701                 case 0: return LDKRecipient_Node;
702                 case 1: return LDKRecipient_PhantomNode;
703         }
704         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
705         abort(); // Unreachable, but will let the compiler know we don't return here
706 }
707 static jclass Recipient_class = NULL;
708 static jfieldID Recipient_LDKRecipient_Node = NULL;
709 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
710 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
711         Recipient_class = (*env)->NewGlobalRef(env, clz);
712         CHECK(Recipient_class != NULL);
713         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
714         CHECK(Recipient_LDKRecipient_Node != NULL);
715         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
716         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
717 }
718 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
719         switch (val) {
720                 case LDKRecipient_Node:
721                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
722                 case LDKRecipient_PhantomNode:
723                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
724                 default: abort();
725         }
726 }
727
728 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
729         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
730         if (UNLIKELY((*env)->ExceptionCheck(env))) {
731                 (*env)->ExceptionDescribe(env);
732                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
733         }
734         switch (ord) {
735                 case 0: return LDKSecp256k1Error_IncorrectSignature;
736                 case 1: return LDKSecp256k1Error_InvalidMessage;
737                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
738                 case 3: return LDKSecp256k1Error_InvalidSignature;
739                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
740                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
741                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
742                 case 7: return LDKSecp256k1Error_InvalidTweak;
743                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
744                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
745                 case 10: return LDKSecp256k1Error_InvalidParityValue;
746         }
747         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
748         abort(); // Unreachable, but will let the compiler know we don't return here
749 }
750 static jclass Secp256k1Error_class = NULL;
751 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
752 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
753 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
754 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
755 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
756 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
757 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
758 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
759 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
760 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
761 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
762 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
763         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
764         CHECK(Secp256k1Error_class != NULL);
765         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
766         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
767         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
768         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
769         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
770         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
771         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
772         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
773         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
774         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
775         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
776         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
777         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
778         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
779         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
780         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
781         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
782         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
783         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
784         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
785         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
786         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
787 }
788 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
789         switch (val) {
790                 case LDKSecp256k1Error_IncorrectSignature:
791                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
792                 case LDKSecp256k1Error_InvalidMessage:
793                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
794                 case LDKSecp256k1Error_InvalidPublicKey:
795                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
796                 case LDKSecp256k1Error_InvalidSignature:
797                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
798                 case LDKSecp256k1Error_InvalidSecretKey:
799                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
800                 case LDKSecp256k1Error_InvalidSharedSecret:
801                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
802                 case LDKSecp256k1Error_InvalidRecoveryId:
803                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
804                 case LDKSecp256k1Error_InvalidTweak:
805                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
806                 case LDKSecp256k1Error_NotEnoughMemory:
807                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
808                 case LDKSecp256k1Error_InvalidPublicKeySum:
809                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
810                 case LDKSecp256k1Error_InvalidParityValue:
811                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
812                 default: abort();
813         }
814 }
815
816 static inline LDKSemanticError LDKSemanticError_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 SemanticError.ordinal() from rust threw an exception.");
821         }
822         switch (ord) {
823                 case 0: return LDKSemanticError_NoPaymentHash;
824                 case 1: return LDKSemanticError_MultiplePaymentHashes;
825                 case 2: return LDKSemanticError_NoDescription;
826                 case 3: return LDKSemanticError_MultipleDescriptions;
827                 case 4: return LDKSemanticError_NoPaymentSecret;
828                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
829                 case 6: return LDKSemanticError_InvalidFeatures;
830                 case 7: return LDKSemanticError_InvalidRecoveryId;
831                 case 8: return LDKSemanticError_InvalidSignature;
832                 case 9: return LDKSemanticError_ImpreciseAmount;
833         }
834         (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
835         abort(); // Unreachable, but will let the compiler know we don't return here
836 }
837 static jclass SemanticError_class = NULL;
838 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
839 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
840 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
841 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
842 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
843 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
844 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
845 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
846 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
847 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
848 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
849         SemanticError_class = (*env)->NewGlobalRef(env, clz);
850         CHECK(SemanticError_class != NULL);
851         SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
852         CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
853         SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
854         CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
855         SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
856         CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
857         SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
858         CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
859         SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
860         CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
861         SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
862         CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
863         SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
864         CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
865         SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
866         CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
867         SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
868         CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
869         SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
870         CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
871 }
872 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
873         switch (val) {
874                 case LDKSemanticError_NoPaymentHash:
875                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
876                 case LDKSemanticError_MultiplePaymentHashes:
877                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
878                 case LDKSemanticError_NoDescription:
879                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
880                 case LDKSemanticError_MultipleDescriptions:
881                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
882                 case LDKSemanticError_NoPaymentSecret:
883                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
884                 case LDKSemanticError_MultiplePaymentSecrets:
885                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
886                 case LDKSemanticError_InvalidFeatures:
887                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
888                 case LDKSemanticError_InvalidRecoveryId:
889                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
890                 case LDKSemanticError_InvalidSignature:
891                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
892                 case LDKSemanticError_ImpreciseAmount:
893                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
894                 default: abort();
895         }
896 }
897
898 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
899         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
900         if (UNLIKELY((*env)->ExceptionCheck(env))) {
901                 (*env)->ExceptionDescribe(env);
902                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
903         }
904         switch (ord) {
905                 case 0: return LDKSiPrefix_Milli;
906                 case 1: return LDKSiPrefix_Micro;
907                 case 2: return LDKSiPrefix_Nano;
908                 case 3: return LDKSiPrefix_Pico;
909         }
910         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
911         abort(); // Unreachable, but will let the compiler know we don't return here
912 }
913 static jclass SiPrefix_class = NULL;
914 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
915 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
916 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
917 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
918 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
919         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
920         CHECK(SiPrefix_class != NULL);
921         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
922         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
923         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
924         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
925         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
926         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
927         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
928         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
929 }
930 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
931         switch (val) {
932                 case LDKSiPrefix_Milli:
933                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
934                 case LDKSiPrefix_Micro:
935                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
936                 case LDKSiPrefix_Nano:
937                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
938                 case LDKSiPrefix_Pico:
939                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
940                 default: abort();
941         }
942 }
943
944 static jclass LDKBech32Error_MissingSeparator_class = NULL;
945 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
946 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
947 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
948 static jclass LDKBech32Error_InvalidLength_class = NULL;
949 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
950 static jclass LDKBech32Error_InvalidChar_class = NULL;
951 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
952 static jclass LDKBech32Error_InvalidData_class = NULL;
953 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
954 static jclass LDKBech32Error_InvalidPadding_class = NULL;
955 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
956 static jclass LDKBech32Error_MixedCase_class = NULL;
957 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
959         LDKBech32Error_MissingSeparator_class =
960                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
961         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
962         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
963         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
964         LDKBech32Error_InvalidChecksum_class =
965                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
966         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
967         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
968         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
969         LDKBech32Error_InvalidLength_class =
970                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
971         CHECK(LDKBech32Error_InvalidLength_class != NULL);
972         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
973         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
974         LDKBech32Error_InvalidChar_class =
975                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
976         CHECK(LDKBech32Error_InvalidChar_class != NULL);
977         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
978         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
979         LDKBech32Error_InvalidData_class =
980                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
981         CHECK(LDKBech32Error_InvalidData_class != NULL);
982         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
983         CHECK(LDKBech32Error_InvalidData_meth != NULL);
984         LDKBech32Error_InvalidPadding_class =
985                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
986         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
987         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
988         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
989         LDKBech32Error_MixedCase_class =
990                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
991         CHECK(LDKBech32Error_MixedCase_class != NULL);
992         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
993         CHECK(LDKBech32Error_MixedCase_meth != NULL);
994 }
995 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
996         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
997         switch(obj->tag) {
998                 case LDKBech32Error_MissingSeparator: {
999                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1000                 }
1001                 case LDKBech32Error_InvalidChecksum: {
1002                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1003                 }
1004                 case LDKBech32Error_InvalidLength: {
1005                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1006                 }
1007                 case LDKBech32Error_InvalidChar: {
1008                         int32_t invalid_char_conv = obj->invalid_char;
1009                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1010                 }
1011                 case LDKBech32Error_InvalidData: {
1012                         int8_t invalid_data_conv = obj->invalid_data;
1013                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1014                 }
1015                 case LDKBech32Error_InvalidPadding: {
1016                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1017                 }
1018                 case LDKBech32Error_MixedCase: {
1019                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1020                 }
1021                 default: abort();
1022         }
1023 }
1024 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1025         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1026         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1027         return ret;
1028 }
1029 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) {
1030         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1031         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1032         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1033         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1034         CVec_u8Z_free(ret_var);
1035         return ret_arr;
1036 }
1037
1038 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) {
1039         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1040         int64_t ret_conv = TxOut_get_value(thing_conv);
1041         return ret_conv;
1042 }
1043
1044 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1045 CHECK(owner->result_ok);
1046         return *owner->contents.result;
1047 }
1048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1049         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1050         CResult_NoneNoneZ_get_ok(owner_conv);
1051 }
1052
1053 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1054 CHECK(!owner->result_ok);
1055         return *owner->contents.err;
1056 }
1057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1058         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1059         CResult_NoneNoneZ_get_err(owner_conv);
1060 }
1061
1062 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1063         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
1064         ret.is_owned = false;
1065         return ret;
1066 }
1067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1068         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1069         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1070         int64_t ret_ref = 0;
1071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1073         return ret_ref;
1074 }
1075
1076 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1077         LDKDecodeError ret = *owner->contents.err;
1078         ret.is_owned = false;
1079         return ret;
1080 }
1081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1082         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1083         LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1084         int64_t ret_ref = 0;
1085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1087         return ret_ref;
1088 }
1089
1090 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1091 CHECK(owner->result_ok);
1092         return *owner->contents.result;
1093 }
1094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1095         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
1096         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1097         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
1098         return ret_arr;
1099 }
1100
1101 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1102 CHECK(!owner->result_ok);
1103         return *owner->contents.err;
1104 }
1105 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1106         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
1107         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
1108         return ret_conv;
1109 }
1110
1111 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1112 CHECK(owner->result_ok);
1113         return *owner->contents.result;
1114 }
1115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1116         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
1117         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
1118         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
1119         return ret_arr;
1120 }
1121
1122 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1123 CHECK(!owner->result_ok);
1124         return *owner->contents.err;
1125 }
1126 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1127         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
1128         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
1129         return ret_conv;
1130 }
1131
1132 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1133         LDKTxCreationKeys ret = *owner->contents.result;
1134         ret.is_owned = false;
1135         return ret;
1136 }
1137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1138         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1139         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1140         int64_t ret_ref = 0;
1141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1143         return ret_ref;
1144 }
1145
1146 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1147         LDKDecodeError ret = *owner->contents.err;
1148         ret.is_owned = false;
1149         return ret;
1150 }
1151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1152         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1153         LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1154         int64_t ret_ref = 0;
1155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1157         return ret_ref;
1158 }
1159
1160 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1161         LDKChannelPublicKeys ret = *owner->contents.result;
1162         ret.is_owned = false;
1163         return ret;
1164 }
1165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1166         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1167         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1168         int64_t ret_ref = 0;
1169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1171         return ret_ref;
1172 }
1173
1174 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1175         LDKDecodeError ret = *owner->contents.err;
1176         ret.is_owned = false;
1177         return ret;
1178 }
1179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1180         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1181         LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1182         int64_t ret_ref = 0;
1183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1185         return ret_ref;
1186 }
1187
1188 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1189         LDKTxCreationKeys ret = *owner->contents.result;
1190         ret.is_owned = false;
1191         return ret;
1192 }
1193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1194         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
1195         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1196         int64_t ret_ref = 0;
1197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1199         return ret_ref;
1200 }
1201
1202 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1203 CHECK(!owner->result_ok);
1204         return *owner->contents.err;
1205 }
1206 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1207         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
1208         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1209         return ret_conv;
1210 }
1211
1212 static jclass LDKCOption_u32Z_Some_class = NULL;
1213 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1214 static jclass LDKCOption_u32Z_None_class = NULL;
1215 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1217         LDKCOption_u32Z_Some_class =
1218                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1219         CHECK(LDKCOption_u32Z_Some_class != NULL);
1220         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1221         CHECK(LDKCOption_u32Z_Some_meth != NULL);
1222         LDKCOption_u32Z_None_class =
1223                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1224         CHECK(LDKCOption_u32Z_None_class != NULL);
1225         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1226         CHECK(LDKCOption_u32Z_None_meth != NULL);
1227 }
1228 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1229         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1230         switch(obj->tag) {
1231                 case LDKCOption_u32Z_Some: {
1232                         int32_t some_conv = obj->some;
1233                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
1234                 }
1235                 case LDKCOption_u32Z_None: {
1236                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1237                 }
1238                 default: abort();
1239         }
1240 }
1241 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1242         LDKHTLCOutputInCommitment ret = *owner->contents.result;
1243         ret.is_owned = false;
1244         return ret;
1245 }
1246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1247         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1248         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1249         int64_t ret_ref = 0;
1250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1252         return ret_ref;
1253 }
1254
1255 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1256         LDKDecodeError ret = *owner->contents.err;
1257         ret.is_owned = false;
1258         return ret;
1259 }
1260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1261         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1262         LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1263         int64_t ret_ref = 0;
1264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1266         return ret_ref;
1267 }
1268
1269 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1270         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
1271         ret.is_owned = false;
1272         return ret;
1273 }
1274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1275         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1276         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1277         int64_t ret_ref = 0;
1278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1280         return ret_ref;
1281 }
1282
1283 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1284         LDKDecodeError ret = *owner->contents.err;
1285         ret.is_owned = false;
1286         return ret;
1287 }
1288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1289         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1290         LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1291         int64_t ret_ref = 0;
1292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1294         return ret_ref;
1295 }
1296
1297 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1298         LDKChannelTransactionParameters ret = *owner->contents.result;
1299         ret.is_owned = false;
1300         return ret;
1301 }
1302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1303         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1304         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1305         int64_t ret_ref = 0;
1306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1308         return ret_ref;
1309 }
1310
1311 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1312         LDKDecodeError ret = *owner->contents.err;
1313         ret.is_owned = false;
1314         return ret;
1315 }
1316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1317         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1318         LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1319         int64_t ret_ref = 0;
1320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1322         return ret_ref;
1323 }
1324
1325 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1326         LDKHolderCommitmentTransaction ret = *owner->contents.result;
1327         ret.is_owned = false;
1328         return ret;
1329 }
1330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1331         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1332         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1333         int64_t ret_ref = 0;
1334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1336         return ret_ref;
1337 }
1338
1339 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1340         LDKDecodeError ret = *owner->contents.err;
1341         ret.is_owned = false;
1342         return ret;
1343 }
1344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1345         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1346         LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1347         int64_t ret_ref = 0;
1348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1350         return ret_ref;
1351 }
1352
1353 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1354         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
1355         ret.is_owned = false;
1356         return ret;
1357 }
1358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1359         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1360         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1361         int64_t ret_ref = 0;
1362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1364         return ret_ref;
1365 }
1366
1367 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1368         LDKDecodeError ret = *owner->contents.err;
1369         ret.is_owned = false;
1370         return ret;
1371 }
1372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1373         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1374         LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1375         int64_t ret_ref = 0;
1376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1378         return ret_ref;
1379 }
1380
1381 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1382         LDKTrustedClosingTransaction ret = *owner->contents.result;
1383         ret.is_owned = false;
1384         return ret;
1385 }
1386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1387         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1388         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1389         int64_t ret_ref = 0;
1390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1392         return ret_ref;
1393 }
1394
1395 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1396 CHECK(!owner->result_ok);
1397         return *owner->contents.err;
1398 }
1399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1400         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1401         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1402 }
1403
1404 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1405         LDKCommitmentTransaction ret = *owner->contents.result;
1406         ret.is_owned = false;
1407         return ret;
1408 }
1409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1410         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1411         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1412         int64_t ret_ref = 0;
1413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1415         return ret_ref;
1416 }
1417
1418 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1419         LDKDecodeError ret = *owner->contents.err;
1420         ret.is_owned = false;
1421         return ret;
1422 }
1423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1424         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1425         LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1426         int64_t ret_ref = 0;
1427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1429         return ret_ref;
1430 }
1431
1432 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1433         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
1434         ret.is_owned = false;
1435         return ret;
1436 }
1437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1438         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1439         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1440         int64_t ret_ref = 0;
1441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1443         return ret_ref;
1444 }
1445
1446 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1447 CHECK(!owner->result_ok);
1448         return *owner->contents.err;
1449 }
1450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1451         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1452         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1453 }
1454
1455 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1456 CHECK(owner->result_ok);
1457         return *owner->contents.result;
1458 }
1459 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1460         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1461         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1462         jobjectArray ret_arr = NULL;
1463         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1464         ;
1465         for (size_t i = 0; i < ret_var.datalen; i++) {
1466                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1467                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1468                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1469         }
1470         
1471         return ret_arr;
1472 }
1473
1474 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1475 CHECK(!owner->result_ok);
1476         return *owner->contents.err;
1477 }
1478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1479         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1480         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1481 }
1482
1483 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1484         LDKShutdownScript ret = *owner->contents.result;
1485         ret.is_owned = false;
1486         return ret;
1487 }
1488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1489         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1490         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1491         int64_t ret_ref = 0;
1492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1494         return ret_ref;
1495 }
1496
1497 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1498         LDKDecodeError ret = *owner->contents.err;
1499         ret.is_owned = false;
1500         return ret;
1501 }
1502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1503         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1504         LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1505         int64_t ret_ref = 0;
1506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1508         return ret_ref;
1509 }
1510
1511 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1512         LDKShutdownScript ret = *owner->contents.result;
1513         ret.is_owned = false;
1514         return ret;
1515 }
1516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1517         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1518         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1519         int64_t ret_ref = 0;
1520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1522         return ret_ref;
1523 }
1524
1525 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1526         LDKInvalidShutdownScript ret = *owner->contents.err;
1527         ret.is_owned = false;
1528         return ret;
1529 }
1530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1531         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1532         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1533         int64_t ret_ref = 0;
1534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1536         return ret_ref;
1537 }
1538
1539 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1540 CHECK(owner->result_ok);
1541         return *owner->contents.result;
1542 }
1543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1544         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
1545         CResult_NoneErrorZ_get_ok(owner_conv);
1546 }
1547
1548 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1549 CHECK(!owner->result_ok);
1550         return *owner->contents.err;
1551 }
1552 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1553         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
1554         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1555         return ret_conv;
1556 }
1557
1558 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1559         LDKRouteHop ret = *owner->contents.result;
1560         ret.is_owned = false;
1561         return ret;
1562 }
1563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1564         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1565         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1566         int64_t ret_ref = 0;
1567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1569         return ret_ref;
1570 }
1571
1572 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1573         LDKDecodeError ret = *owner->contents.err;
1574         ret.is_owned = false;
1575         return ret;
1576 }
1577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1578         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1579         LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1580         int64_t ret_ref = 0;
1581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1583         return ret_ref;
1584 }
1585
1586 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1587         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1588         for (size_t i = 0; i < ret.datalen; i++) {
1589                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1590         }
1591         return ret;
1592 }
1593 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1594         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1595         for (size_t i = 0; i < ret.datalen; i++) {
1596                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1597         }
1598         return ret;
1599 }
1600 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1601         LDKRoute ret = *owner->contents.result;
1602         ret.is_owned = false;
1603         return ret;
1604 }
1605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1606         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1607         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1608         int64_t ret_ref = 0;
1609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1611         return ret_ref;
1612 }
1613
1614 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1615         LDKDecodeError ret = *owner->contents.err;
1616         ret.is_owned = false;
1617         return ret;
1618 }
1619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1620         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1621         LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1622         int64_t ret_ref = 0;
1623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1625         return ret_ref;
1626 }
1627
1628 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1629         LDKRouteParameters ret = *owner->contents.result;
1630         ret.is_owned = false;
1631         return ret;
1632 }
1633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1634         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1635         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1636         int64_t ret_ref = 0;
1637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1639         return ret_ref;
1640 }
1641
1642 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1643         LDKDecodeError ret = *owner->contents.err;
1644         ret.is_owned = false;
1645         return ret;
1646 }
1647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1648         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1649         LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(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 LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1657         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1658         for (size_t i = 0; i < ret.datalen; i++) {
1659                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1660         }
1661         return ret;
1662 }
1663 static jclass LDKCOption_u64Z_Some_class = NULL;
1664 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1665 static jclass LDKCOption_u64Z_None_class = NULL;
1666 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1668         LDKCOption_u64Z_Some_class =
1669                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1670         CHECK(LDKCOption_u64Z_Some_class != NULL);
1671         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1672         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1673         LDKCOption_u64Z_None_class =
1674                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1675         CHECK(LDKCOption_u64Z_None_class != NULL);
1676         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1677         CHECK(LDKCOption_u64Z_None_meth != NULL);
1678 }
1679 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1680         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1681         switch(obj->tag) {
1682                 case LDKCOption_u64Z_Some: {
1683                         int64_t some_conv = obj->some;
1684                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1685                 }
1686                 case LDKCOption_u64Z_None: {
1687                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1688                 }
1689                 default: abort();
1690         }
1691 }
1692 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1693         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1694         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1695         return ret;
1696 }
1697 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1698         LDKPaymentParameters ret = *owner->contents.result;
1699         ret.is_owned = false;
1700         return ret;
1701 }
1702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1703         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1704         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1705         int64_t ret_ref = 0;
1706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1708         return ret_ref;
1709 }
1710
1711 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1712         LDKDecodeError ret = *owner->contents.err;
1713         ret.is_owned = false;
1714         return ret;
1715 }
1716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1717         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1718         LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1719         int64_t ret_ref = 0;
1720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1722         return ret_ref;
1723 }
1724
1725 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1726         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1727         for (size_t i = 0; i < ret.datalen; i++) {
1728                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1729         }
1730         return ret;
1731 }
1732 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1733         LDKRouteHint ret = *owner->contents.result;
1734         ret.is_owned = false;
1735         return ret;
1736 }
1737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1738         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1739         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1740         int64_t ret_ref = 0;
1741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1743         return ret_ref;
1744 }
1745
1746 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1747         LDKDecodeError ret = *owner->contents.err;
1748         ret.is_owned = false;
1749         return ret;
1750 }
1751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1752         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1753         LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1754         int64_t ret_ref = 0;
1755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1757         return ret_ref;
1758 }
1759
1760 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1761         LDKRouteHintHop ret = *owner->contents.result;
1762         ret.is_owned = false;
1763         return ret;
1764 }
1765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1766         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1767         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1768         int64_t ret_ref = 0;
1769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1771         return ret_ref;
1772 }
1773
1774 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1775         LDKDecodeError ret = *owner->contents.err;
1776         ret.is_owned = false;
1777         return ret;
1778 }
1779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1780         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1781         LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1782         int64_t ret_ref = 0;
1783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1785         return ret_ref;
1786 }
1787
1788 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1789         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1790         for (size_t i = 0; i < ret.datalen; i++) {
1791                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1792         }
1793         return ret;
1794 }
1795 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1796         LDKRoute ret = *owner->contents.result;
1797         ret.is_owned = false;
1798         return ret;
1799 }
1800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1801         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1802         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1803         int64_t ret_ref = 0;
1804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1806         return ret_ref;
1807 }
1808
1809 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1810         LDKLightningError ret = *owner->contents.err;
1811         ret.is_owned = false;
1812         return ret;
1813 }
1814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1815         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1816         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1817         int64_t ret_ref = 0;
1818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1820         return ret_ref;
1821 }
1822
1823 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
1824 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
1825 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
1826 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
1827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
1828         LDKPaymentPurpose_InvoicePayment_class =
1829                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
1830         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
1831         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
1832         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
1833         LDKPaymentPurpose_SpontaneousPayment_class =
1834                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
1835         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
1836         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
1837         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
1838 }
1839 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1840         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1841         switch(obj->tag) {
1842                 case LDKPaymentPurpose_InvoicePayment: {
1843                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1844                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
1845                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1846                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
1847                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
1848                 }
1849                 case LDKPaymentPurpose_SpontaneousPayment: {
1850                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
1851                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
1852                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
1853                 }
1854                 default: abort();
1855         }
1856 }
1857 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1858 CHECK(owner->result_ok);
1859         return PaymentPurpose_clone(&*owner->contents.result);
1860 }
1861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1862         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1863         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1864         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1865         int64_t ret_ref = tag_ptr(ret_copy, true);
1866         return ret_ref;
1867 }
1868
1869 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1870         LDKDecodeError ret = *owner->contents.err;
1871         ret.is_owned = false;
1872         return ret;
1873 }
1874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1875         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1876         LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1877         int64_t ret_ref = 0;
1878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1880         return ret_ref;
1881 }
1882
1883 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
1884 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
1885 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
1886 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
1887 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
1888 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
1889 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
1890 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
1891 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
1892 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
1893 static jclass LDKClosureReason_ProcessingError_class = NULL;
1894 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
1895 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
1896 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
1897 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
1898 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
1899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
1900         LDKClosureReason_CounterpartyForceClosed_class =
1901                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
1902         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
1903         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
1904         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
1905         LDKClosureReason_HolderForceClosed_class =
1906                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
1907         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
1908         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
1909         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
1910         LDKClosureReason_CooperativeClosure_class =
1911                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
1912         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
1913         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
1914         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
1915         LDKClosureReason_CommitmentTxConfirmed_class =
1916                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
1917         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
1918         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
1919         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
1920         LDKClosureReason_FundingTimedOut_class =
1921                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
1922         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
1923         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
1924         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
1925         LDKClosureReason_ProcessingError_class =
1926                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
1927         CHECK(LDKClosureReason_ProcessingError_class != NULL);
1928         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
1929         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
1930         LDKClosureReason_DisconnectedPeer_class =
1931                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
1932         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
1933         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
1934         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
1935         LDKClosureReason_OutdatedChannelManager_class =
1936                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
1937         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
1938         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
1939         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
1940 }
1941 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1942         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1943         switch(obj->tag) {
1944                 case LDKClosureReason_CounterpartyForceClosed: {
1945                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1946                         jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
1947                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
1948                 }
1949                 case LDKClosureReason_HolderForceClosed: {
1950                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
1951                 }
1952                 case LDKClosureReason_CooperativeClosure: {
1953                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
1954                 }
1955                 case LDKClosureReason_CommitmentTxConfirmed: {
1956                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
1957                 }
1958                 case LDKClosureReason_FundingTimedOut: {
1959                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
1960                 }
1961                 case LDKClosureReason_ProcessingError: {
1962                         LDKStr err_str = obj->processing_error.err;
1963                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1964                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
1965                 }
1966                 case LDKClosureReason_DisconnectedPeer: {
1967                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
1968                 }
1969                 case LDKClosureReason_OutdatedChannelManager: {
1970                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
1971                 }
1972                 default: abort();
1973         }
1974 }
1975 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
1976 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
1977 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
1978 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
1979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
1980         LDKCOption_ClosureReasonZ_Some_class =
1981                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
1982         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
1983         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
1984         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
1985         LDKCOption_ClosureReasonZ_None_class =
1986                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
1987         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
1988         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
1989         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
1990 }
1991 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1992         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1993         switch(obj->tag) {
1994                 case LDKCOption_ClosureReasonZ_Some: {
1995                         int64_t some_ref = tag_ptr(&obj->some, false);
1996                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
1997                 }
1998                 case LDKCOption_ClosureReasonZ_None: {
1999                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2000                 }
2001                 default: abort();
2002         }
2003 }
2004 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2005 CHECK(owner->result_ok);
2006         return COption_ClosureReasonZ_clone(&*owner->contents.result);
2007 }
2008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2009         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2010         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2011         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2012         int64_t ret_ref = tag_ptr(ret_copy, true);
2013         return ret_ref;
2014 }
2015
2016 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2017         LDKDecodeError ret = *owner->contents.err;
2018         ret.is_owned = false;
2019         return ret;
2020 }
2021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2022         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2023         LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2024         int64_t ret_ref = 0;
2025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2027         return ret_ref;
2028 }
2029
2030 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
2031 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
2032 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
2033 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
2034 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
2035 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
2036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
2037         LDKHTLCDestination_NextHopChannel_class =
2038                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
2039         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
2040         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
2041         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
2042         LDKHTLCDestination_UnknownNextHop_class =
2043                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
2044         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
2045         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
2046         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
2047         LDKHTLCDestination_FailedPayment_class =
2048                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
2049         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
2050         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
2051         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
2052 }
2053 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2054         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2055         switch(obj->tag) {
2056                 case LDKHTLCDestination_NextHopChannel: {
2057                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2058                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
2059                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2060                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
2061                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
2062                 }
2063                 case LDKHTLCDestination_UnknownNextHop: {
2064                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
2065                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
2066                 }
2067                 case LDKHTLCDestination_FailedPayment: {
2068                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2069                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
2070                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
2071                 }
2072                 default: abort();
2073         }
2074 }
2075 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
2076 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
2077 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
2078 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
2079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
2080         LDKCOption_HTLCDestinationZ_Some_class =
2081                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
2082         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
2083         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
2084         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
2085         LDKCOption_HTLCDestinationZ_None_class =
2086                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
2087         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
2088         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
2089         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
2090 }
2091 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2092         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
2093         switch(obj->tag) {
2094                 case LDKCOption_HTLCDestinationZ_Some: {
2095                         int64_t some_ref = tag_ptr(&obj->some, false);
2096                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
2097                 }
2098                 case LDKCOption_HTLCDestinationZ_None: {
2099                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
2100                 }
2101                 default: abort();
2102         }
2103 }
2104 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2105 CHECK(owner->result_ok);
2106         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
2107 }
2108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2109         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2110         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
2111         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
2112         int64_t ret_ref = tag_ptr(ret_copy, true);
2113         return ret_ref;
2114 }
2115
2116 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2117         LDKDecodeError ret = *owner->contents.err;
2118         ret.is_owned = false;
2119         return ret;
2120 }
2121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2122         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2123         LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
2124         int64_t ret_ref = 0;
2125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2127         return ret_ref;
2128 }
2129
2130 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2131 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2132 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
2133 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
2134 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2135 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2137         LDKNetworkUpdate_ChannelUpdateMessage_class =
2138                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2139         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2140         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2141         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2142         LDKNetworkUpdate_ChannelFailure_class =
2143                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
2144         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
2145         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
2146         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
2147         LDKNetworkUpdate_NodeFailure_class =
2148                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2149         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2150         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2151         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2152 }
2153 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2154         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2155         switch(obj->tag) {
2156                 case LDKNetworkUpdate_ChannelUpdateMessage: {
2157                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2158                         int64_t msg_ref = 0;
2159                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2160                         msg_ref = tag_ptr(msg_var.inner, false);
2161                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2162                 }
2163                 case LDKNetworkUpdate_ChannelFailure: {
2164                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2165                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2166                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
2167                 }
2168                 case LDKNetworkUpdate_NodeFailure: {
2169                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2170                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2171                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
2172                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2173                 }
2174                 default: abort();
2175         }
2176 }
2177 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2178 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2179 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2180 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2182         LDKCOption_NetworkUpdateZ_Some_class =
2183                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2184         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2185         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2186         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2187         LDKCOption_NetworkUpdateZ_None_class =
2188                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2189         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2190         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2191         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2192 }
2193 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2194         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2195         switch(obj->tag) {
2196                 case LDKCOption_NetworkUpdateZ_Some: {
2197                         int64_t some_ref = tag_ptr(&obj->some, false);
2198                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2199                 }
2200                 case LDKCOption_NetworkUpdateZ_None: {
2201                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2202                 }
2203                 default: abort();
2204         }
2205 }
2206 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2207 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2208 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2209 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2210 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2211 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2213         LDKSpendableOutputDescriptor_StaticOutput_class =
2214                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2215         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2216         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2217         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2218         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2219                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2220         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2221         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2222         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2223         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2224                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2225         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2226         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2227         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2228 }
2229 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2230         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2231         switch(obj->tag) {
2232                 case LDKSpendableOutputDescriptor_StaticOutput: {
2233                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2234                         int64_t outpoint_ref = 0;
2235                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2236                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2237                         LDKTxOut* output_ref = &obj->static_output.output;
2238                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
2239                 }
2240                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2241                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2242                         int64_t delayed_payment_output_ref = 0;
2243                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2244                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2245                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2246                 }
2247                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2248                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2249                         int64_t static_payment_output_ref = 0;
2250                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2251                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2252                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2253                 }
2254                 default: abort();
2255         }
2256 }
2257 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2258         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2259         for (size_t i = 0; i < ret.datalen; i++) {
2260                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2261         }
2262         return ret;
2263 }
2264 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2265 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2266 static jclass LDKEvent_PaymentReceived_class = NULL;
2267 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2268 static jclass LDKEvent_PaymentClaimed_class = NULL;
2269 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
2270 static jclass LDKEvent_PaymentSent_class = NULL;
2271 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2272 static jclass LDKEvent_PaymentFailed_class = NULL;
2273 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2274 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2275 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2276 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2277 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2278 static jclass LDKEvent_ProbeSuccessful_class = NULL;
2279 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
2280 static jclass LDKEvent_ProbeFailed_class = NULL;
2281 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
2282 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2283 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2284 static jclass LDKEvent_SpendableOutputs_class = NULL;
2285 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2286 static jclass LDKEvent_PaymentForwarded_class = NULL;
2287 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2288 static jclass LDKEvent_ChannelClosed_class = NULL;
2289 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2290 static jclass LDKEvent_DiscardFunding_class = NULL;
2291 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2292 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2293 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2294 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
2295 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
2296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2297         LDKEvent_FundingGenerationReady_class =
2298                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2299         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2300         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[BJ)V");
2301         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2302         LDKEvent_PaymentReceived_class =
2303                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2304         CHECK(LDKEvent_PaymentReceived_class != NULL);
2305         LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2306         CHECK(LDKEvent_PaymentReceived_meth != NULL);
2307         LDKEvent_PaymentClaimed_class =
2308                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
2309         CHECK(LDKEvent_PaymentClaimed_class != NULL);
2310         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([BJJ)V");
2311         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
2312         LDKEvent_PaymentSent_class =
2313                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2314         CHECK(LDKEvent_PaymentSent_class != NULL);
2315         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2316         CHECK(LDKEvent_PaymentSent_meth != NULL);
2317         LDKEvent_PaymentFailed_class =
2318                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2319         CHECK(LDKEvent_PaymentFailed_class != NULL);
2320         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2321         CHECK(LDKEvent_PaymentFailed_meth != NULL);
2322         LDKEvent_PaymentPathSuccessful_class =
2323                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2324         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2325         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2326         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2327         LDKEvent_PaymentPathFailed_class =
2328                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2329         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2330         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2331         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2332         LDKEvent_ProbeSuccessful_class =
2333                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
2334         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
2335         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[B[J)V");
2336         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
2337         LDKEvent_ProbeFailed_class =
2338                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
2339         CHECK(LDKEvent_ProbeFailed_class != NULL);
2340         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[B[JJ)V");
2341         CHECK(LDKEvent_ProbeFailed_meth != NULL);
2342         LDKEvent_PendingHTLCsForwardable_class =
2343                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2344         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2345         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2346         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2347         LDKEvent_SpendableOutputs_class =
2348                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2349         CHECK(LDKEvent_SpendableOutputs_class != NULL);
2350         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2351         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2352         LDKEvent_PaymentForwarded_class =
2353                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2354         CHECK(LDKEvent_PaymentForwarded_class != NULL);
2355         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZ)V");
2356         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2357         LDKEvent_ChannelClosed_class =
2358                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2359         CHECK(LDKEvent_ChannelClosed_class != NULL);
2360         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2361         CHECK(LDKEvent_ChannelClosed_meth != NULL);
2362         LDKEvent_DiscardFunding_class =
2363                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2364         CHECK(LDKEvent_DiscardFunding_class != NULL);
2365         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2366         CHECK(LDKEvent_DiscardFunding_meth != NULL);
2367         LDKEvent_OpenChannelRequest_class =
2368                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2369         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2370         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
2371         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2372         LDKEvent_HTLCHandlingFailed_class =
2373                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
2374         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
2375         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
2376         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
2377 }
2378 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2379         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2380         switch(obj->tag) {
2381                 case LDKEvent_FundingGenerationReady: {
2382                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2383                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2384                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2385                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
2386                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2387                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2388                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2389                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2390                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
2391                         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_conv);
2392                 }
2393                 case LDKEvent_PaymentReceived: {
2394                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2395                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2396                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
2397                         int64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
2398                         return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2399                 }
2400                 case LDKEvent_PaymentClaimed: {
2401                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2402                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
2403                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
2404                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
2405                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2406                 }
2407                 case LDKEvent_PaymentSent: {
2408                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2409                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2410                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2411                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2412                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2413                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2414                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
2415                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2416                 }
2417                 case LDKEvent_PaymentFailed: {
2418                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2419                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2420                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2421                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2422                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2423                 }
2424                 case LDKEvent_PaymentPathSuccessful: {
2425                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2426                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2427                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2428                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2429                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2430                         int64_tArray path_arr = NULL;
2431                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2432                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2433                         for (size_t k = 0; k < path_var.datalen; k++) {
2434                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2435                                 int64_t path_conv_10_ref = 0;
2436                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2437                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2438                                 path_arr_ptr[k] = path_conv_10_ref;
2439                         }
2440                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2441                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2442                 }
2443                 case LDKEvent_PaymentPathFailed: {
2444                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2445                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2446                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2447                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2448                         jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
2449                         int64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
2450                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
2451                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2452                         int64_tArray path_arr = NULL;
2453                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2454                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2455                         for (size_t k = 0; k < path_var.datalen; k++) {
2456                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2457                                 int64_t path_conv_10_ref = 0;
2458                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2459                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2460                                 path_arr_ptr[k] = path_conv_10_ref;
2461                         }
2462                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2463                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
2464                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2465                         int64_t retry_ref = 0;
2466                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2467                         retry_ref = tag_ptr(retry_var.inner, false);
2468                         return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, rejected_by_dest_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref);
2469                 }
2470                 case LDKEvent_ProbeSuccessful: {
2471                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2472                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
2473                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2474                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
2475                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
2476                         int64_tArray path_arr = NULL;
2477                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2478                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2479                         for (size_t k = 0; k < path_var.datalen; k++) {
2480                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2481                                 int64_t path_conv_10_ref = 0;
2482                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2483                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2484                                 path_arr_ptr[k] = path_conv_10_ref;
2485                         }
2486                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2487                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2488                 }
2489                 case LDKEvent_ProbeFailed: {
2490                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2491                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
2492                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2493                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
2494                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
2495                         int64_tArray path_arr = NULL;
2496                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2497                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2498                         for (size_t k = 0; k < path_var.datalen; k++) {
2499                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2500                                 int64_t path_conv_10_ref = 0;
2501                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2502                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2503                                 path_arr_ptr[k] = path_conv_10_ref;
2504                         }
2505                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2506                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
2507                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref);
2508                 }
2509                 case LDKEvent_PendingHTLCsForwardable: {
2510                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2511                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
2512                 }
2513                 case LDKEvent_SpendableOutputs: {
2514                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2515                         int64_tArray outputs_arr = NULL;
2516                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2517                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2518                         for (size_t b = 0; b < outputs_var.datalen; b++) {
2519                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
2520                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
2521                         }
2522                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2523                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2524                 }
2525                 case LDKEvent_PaymentForwarded: {
2526                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2527                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
2528                         int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
2529                         (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
2530                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2531                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2532                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_arr, next_channel_id_arr, fee_earned_msat_ref, claim_from_onchain_tx_conv);
2533                 }
2534                 case LDKEvent_ChannelClosed: {
2535                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2536                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2537                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
2538                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2539                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_conv, reason_ref);
2540                 }
2541                 case LDKEvent_DiscardFunding: {
2542                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2543                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2544                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2545                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2546                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2547                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2548                 }
2549                 case LDKEvent_OpenChannelRequest: {
2550                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2551                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2552                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2553                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2554                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2555                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2556                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2557                         int64_t channel_type_ref = 0;
2558                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2559                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2560                         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);
2561                 }
2562                 case LDKEvent_HTLCHandlingFailed: {
2563                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2564                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
2565                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2566                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
2567                 }
2568                 default: abort();
2569         }
2570 }
2571 static jclass LDKCOption_EventZ_Some_class = NULL;
2572 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2573 static jclass LDKCOption_EventZ_None_class = NULL;
2574 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2576         LDKCOption_EventZ_Some_class =
2577                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2578         CHECK(LDKCOption_EventZ_Some_class != NULL);
2579         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2580         CHECK(LDKCOption_EventZ_Some_meth != NULL);
2581         LDKCOption_EventZ_None_class =
2582                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2583         CHECK(LDKCOption_EventZ_None_class != NULL);
2584         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2585         CHECK(LDKCOption_EventZ_None_meth != NULL);
2586 }
2587 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2588         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2589         switch(obj->tag) {
2590                 case LDKCOption_EventZ_Some: {
2591                         int64_t some_ref = tag_ptr(&obj->some, false);
2592                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2593                 }
2594                 case LDKCOption_EventZ_None: {
2595                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2596                 }
2597                 default: abort();
2598         }
2599 }
2600 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2601 CHECK(owner->result_ok);
2602         return COption_EventZ_clone(&*owner->contents.result);
2603 }
2604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2605         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2606         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2607         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2608         int64_t ret_ref = tag_ptr(ret_copy, true);
2609         return ret_ref;
2610 }
2611
2612 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2613         LDKDecodeError ret = *owner->contents.err;
2614         ret.is_owned = false;
2615         return ret;
2616 }
2617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2618         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2619         LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2620         int64_t ret_ref = 0;
2621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2623         return ret_ref;
2624 }
2625
2626 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2627 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2628 static jclass LDKErrorAction_IgnoreError_class = NULL;
2629 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2630 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2631 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2632 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2633 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2634 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2635 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2636 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2637 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2639         LDKErrorAction_DisconnectPeer_class =
2640                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2641         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2642         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2643         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2644         LDKErrorAction_IgnoreError_class =
2645                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2646         CHECK(LDKErrorAction_IgnoreError_class != NULL);
2647         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2648         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2649         LDKErrorAction_IgnoreAndLog_class =
2650                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2651         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2652         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2653         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2654         LDKErrorAction_IgnoreDuplicateGossip_class =
2655                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2656         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2657         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2658         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2659         LDKErrorAction_SendErrorMessage_class =
2660                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2661         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2662         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2663         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2664         LDKErrorAction_SendWarningMessage_class =
2665                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2666         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2667         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2668         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2669 }
2670 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2671         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2672         switch(obj->tag) {
2673                 case LDKErrorAction_DisconnectPeer: {
2674                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2675                         int64_t msg_ref = 0;
2676                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2677                         msg_ref = tag_ptr(msg_var.inner, false);
2678                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2679                 }
2680                 case LDKErrorAction_IgnoreError: {
2681                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2682                 }
2683                 case LDKErrorAction_IgnoreAndLog: {
2684                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2685                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2686                 }
2687                 case LDKErrorAction_IgnoreDuplicateGossip: {
2688                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2689                 }
2690                 case LDKErrorAction_SendErrorMessage: {
2691                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2692                         int64_t msg_ref = 0;
2693                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2694                         msg_ref = tag_ptr(msg_var.inner, false);
2695                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2696                 }
2697                 case LDKErrorAction_SendWarningMessage: {
2698                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2699                         int64_t msg_ref = 0;
2700                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2701                         msg_ref = tag_ptr(msg_var.inner, false);
2702                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2703                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2704                 }
2705                 default: abort();
2706         }
2707 }
2708 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2709 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2710 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2711 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2712 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2713 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2714 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2715 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2716 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
2717 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
2718 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2719 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2720 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2721 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2722 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2723 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2724 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2725 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2726 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2727 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2728 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2729 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2730 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2731 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2732 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2733 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2734 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2735 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2736 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2737 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2738 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2739 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2740 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2741 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2742 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2743 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2744 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2745 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2746 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
2747 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
2748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2749         LDKMessageSendEvent_SendAcceptChannel_class =
2750                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2751         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2752         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2753         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2754         LDKMessageSendEvent_SendOpenChannel_class =
2755                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2756         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2757         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2758         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2759         LDKMessageSendEvent_SendFundingCreated_class =
2760                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2761         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2762         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2763         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2764         LDKMessageSendEvent_SendFundingSigned_class =
2765                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2766         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2767         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2768         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2769         LDKMessageSendEvent_SendChannelReady_class =
2770                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
2771         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
2772         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
2773         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
2774         LDKMessageSendEvent_SendAnnouncementSignatures_class =
2775                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2776         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2777         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2778         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2779         LDKMessageSendEvent_UpdateHTLCs_class =
2780                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2781         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2782         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2783         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2784         LDKMessageSendEvent_SendRevokeAndACK_class =
2785                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2786         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2787         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2788         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2789         LDKMessageSendEvent_SendClosingSigned_class =
2790                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2791         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2792         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2793         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2794         LDKMessageSendEvent_SendShutdown_class =
2795                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2796         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2797         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2798         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2799         LDKMessageSendEvent_SendChannelReestablish_class =
2800                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2801         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2802         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2803         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2804         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2805                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2806         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2807         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2808         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2809         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2810                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2811         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2812         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2813         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2814         LDKMessageSendEvent_BroadcastChannelUpdate_class =
2815                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2816         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2817         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2818         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2819         LDKMessageSendEvent_SendChannelUpdate_class =
2820                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2821         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2822         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2823         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2824         LDKMessageSendEvent_HandleError_class =
2825                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2826         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2827         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2828         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2829         LDKMessageSendEvent_SendChannelRangeQuery_class =
2830                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2831         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2832         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2833         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2834         LDKMessageSendEvent_SendShortIdsQuery_class =
2835                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2836         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2837         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2838         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2839         LDKMessageSendEvent_SendReplyChannelRange_class =
2840                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2841         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2842         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2843         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2844         LDKMessageSendEvent_SendGossipTimestampFilter_class =
2845                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
2846         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
2847         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
2848         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
2849 }
2850 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2851         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2852         switch(obj->tag) {
2853                 case LDKMessageSendEvent_SendAcceptChannel: {
2854                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2855                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2856                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2857                         int64_t msg_ref = 0;
2858                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2859                         msg_ref = tag_ptr(msg_var.inner, false);
2860                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2861                 }
2862                 case LDKMessageSendEvent_SendOpenChannel: {
2863                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2864                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2865                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2866                         int64_t msg_ref = 0;
2867                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2868                         msg_ref = tag_ptr(msg_var.inner, false);
2869                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2870                 }
2871                 case LDKMessageSendEvent_SendFundingCreated: {
2872                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2873                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2874                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2875                         int64_t msg_ref = 0;
2876                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2877                         msg_ref = tag_ptr(msg_var.inner, false);
2878                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2879                 }
2880                 case LDKMessageSendEvent_SendFundingSigned: {
2881                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2882                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2883                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2884                         int64_t msg_ref = 0;
2885                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2886                         msg_ref = tag_ptr(msg_var.inner, false);
2887                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2888                 }
2889                 case LDKMessageSendEvent_SendChannelReady: {
2890                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2891                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
2892                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2893                         int64_t msg_ref = 0;
2894                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2895                         msg_ref = tag_ptr(msg_var.inner, false);
2896                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
2897                 }
2898                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2899                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2900                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2901                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2902                         int64_t msg_ref = 0;
2903                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2904                         msg_ref = tag_ptr(msg_var.inner, false);
2905                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2906                 }
2907                 case LDKMessageSendEvent_UpdateHTLCs: {
2908                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2909                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2910                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2911                         int64_t updates_ref = 0;
2912                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2913                         updates_ref = tag_ptr(updates_var.inner, false);
2914                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2915                 }
2916                 case LDKMessageSendEvent_SendRevokeAndACK: {
2917                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2918                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2919                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2920                         int64_t msg_ref = 0;
2921                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2922                         msg_ref = tag_ptr(msg_var.inner, false);
2923                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2924                 }
2925                 case LDKMessageSendEvent_SendClosingSigned: {
2926                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2927                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2928                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2929                         int64_t msg_ref = 0;
2930                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2931                         msg_ref = tag_ptr(msg_var.inner, false);
2932                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2933                 }
2934                 case LDKMessageSendEvent_SendShutdown: {
2935                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2936                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2937                         LDKShutdown msg_var = obj->send_shutdown.msg;
2938                         int64_t msg_ref = 0;
2939                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2940                         msg_ref = tag_ptr(msg_var.inner, false);
2941                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2942                 }
2943                 case LDKMessageSendEvent_SendChannelReestablish: {
2944                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2945                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2946                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2947                         int64_t msg_ref = 0;
2948                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2949                         msg_ref = tag_ptr(msg_var.inner, false);
2950                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2951                 }
2952                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2953                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2954                         int64_t msg_ref = 0;
2955                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2956                         msg_ref = tag_ptr(msg_var.inner, false);
2957                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2958                         int64_t update_msg_ref = 0;
2959                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2960                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2961                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2962                 }
2963                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2964                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2965                         int64_t msg_ref = 0;
2966                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2967                         msg_ref = tag_ptr(msg_var.inner, false);
2968                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2969                 }
2970                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2971                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2972                         int64_t msg_ref = 0;
2973                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2974                         msg_ref = tag_ptr(msg_var.inner, false);
2975                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2976                 }
2977                 case LDKMessageSendEvent_SendChannelUpdate: {
2978                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2979                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2980                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2981                         int64_t msg_ref = 0;
2982                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2983                         msg_ref = tag_ptr(msg_var.inner, false);
2984                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2985                 }
2986                 case LDKMessageSendEvent_HandleError: {
2987                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2988                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2989                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2990                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2991                 }
2992                 case LDKMessageSendEvent_SendChannelRangeQuery: {
2993                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2994                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
2995                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2996                         int64_t msg_ref = 0;
2997                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2998                         msg_ref = tag_ptr(msg_var.inner, false);
2999                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
3000                 }
3001                 case LDKMessageSendEvent_SendShortIdsQuery: {
3002                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3003                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3004                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3005                         int64_t msg_ref = 0;
3006                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3007                         msg_ref = tag_ptr(msg_var.inner, false);
3008                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3009                 }
3010                 case LDKMessageSendEvent_SendReplyChannelRange: {
3011                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3012                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3013                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3014                         int64_t msg_ref = 0;
3015                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3016                         msg_ref = tag_ptr(msg_var.inner, false);
3017                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3018                 }
3019                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
3020                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3021                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
3022                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3023                         int64_t msg_ref = 0;
3024                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3025                         msg_ref = tag_ptr(msg_var.inner, false);
3026                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
3027                 }
3028                 default: abort();
3029         }
3030 }
3031 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3032         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3033         for (size_t i = 0; i < ret.datalen; i++) {
3034                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3035         }
3036         return ret;
3037 }
3038 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3039 CHECK(owner->result_ok);
3040         return TxOut_clone(&*owner->contents.result);
3041 }
3042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3043         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
3044         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3045         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3046         return tag_ptr(ret_ref, true);
3047 }
3048
3049 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3050 CHECK(!owner->result_ok);
3051         return AccessError_clone(&*owner->contents.err);
3052 }
3053 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3054         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
3055         jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
3056         return ret_conv;
3057 }
3058
3059 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3060         return owner->a;
3061 }
3062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3063         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3064         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3065         return ret_conv;
3066 }
3067
3068 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3069         return owner->b;
3070 }
3071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3072         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3073         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3074         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3075         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3076         return ret_arr;
3077 }
3078
3079 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3080         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3081         for (size_t i = 0; i < ret.datalen; i++) {
3082                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3083         }
3084         return ret;
3085 }
3086 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
3087         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
3088         for (size_t i = 0; i < ret.datalen; i++) {
3089                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3090         }
3091         return ret;
3092 }
3093 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3094 CHECK(owner->result_ok);
3095         return *owner->contents.result;
3096 }
3097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3098         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
3099         CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3100 }
3101
3102 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3103 CHECK(!owner->result_ok);
3104         return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3105 }
3106 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3107         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
3108         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3109         return ret_conv;
3110 }
3111
3112 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
3113 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
3114 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
3115 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
3116 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
3117 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
3118 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
3119 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
3120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
3121         LDKMonitorEvent_HTLCEvent_class =
3122                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
3123         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
3124         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
3125         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
3126         LDKMonitorEvent_CommitmentTxConfirmed_class =
3127                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
3128         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
3129         LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
3130         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
3131         LDKMonitorEvent_UpdateCompleted_class =
3132                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
3133         CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
3134         LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
3135         CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
3136         LDKMonitorEvent_UpdateFailed_class =
3137                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
3138         CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
3139         LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
3140         CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
3141 }
3142 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3143         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3144         switch(obj->tag) {
3145                 case LDKMonitorEvent_HTLCEvent: {
3146                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3147                         int64_t htlc_event_ref = 0;
3148                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3149                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3150                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
3151                 }
3152                 case LDKMonitorEvent_CommitmentTxConfirmed: {
3153                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3154                         int64_t commitment_tx_confirmed_ref = 0;
3155                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3156                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
3157                         return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
3158                 }
3159                 case LDKMonitorEvent_UpdateCompleted: {
3160                         LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
3161                         int64_t funding_txo_ref = 0;
3162                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3163                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3164                         int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
3165                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, monitor_update_id_conv);
3166                 }
3167                 case LDKMonitorEvent_UpdateFailed: {
3168                         LDKOutPoint update_failed_var = obj->update_failed;
3169                         int64_t update_failed_ref = 0;
3170                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3171                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
3172                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
3173                 }
3174                 default: abort();
3175         }
3176 }
3177 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3178         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3179         for (size_t i = 0; i < ret.datalen; i++) {
3180                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3181         }
3182         return ret;
3183 }
3184 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3185         LDKOutPoint ret = owner->a;
3186         ret.is_owned = false;
3187         return ret;
3188 }
3189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3190         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3191         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3192         int64_t ret_ref = 0;
3193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3195         return ret_ref;
3196 }
3197
3198 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3199         return CVec_MonitorEventZ_clone(&owner->b);
3200 }
3201 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3202         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3203         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3204         int64_tArray ret_arr = NULL;
3205         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3206         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3207         for (size_t o = 0; o < ret_var.datalen; o++) {
3208                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3209                 *ret_conv_14_copy = ret_var.data[o];
3210                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3211                 ret_arr_ptr[o] = ret_conv_14_ref;
3212         }
3213         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3214         FREE(ret_var.data);
3215         return ret_arr;
3216 }
3217
3218 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3219         return owner->c;
3220 }
3221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3222         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3223         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3224         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
3225         return ret_arr;
3226 }
3227
3228 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3229         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3230         for (size_t i = 0; i < ret.datalen; i++) {
3231                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3232         }
3233         return ret;
3234 }
3235 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
3236 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
3237 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
3238 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
3239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
3240         LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
3241                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
3242         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
3243         LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
3244         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
3245         LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
3246                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
3247         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
3248         LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
3249         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
3250 }
3251 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3252         LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(ptr);
3253         switch(obj->tag) {
3254                 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
3255                         LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3256                         *some_conv = obj->some;
3257                         *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3258                         return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, tag_ptr(some_conv, true));
3259                 }
3260                 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
3261                         return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
3262                 }
3263                 default: abort();
3264         }
3265 }
3266 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3267         LDKFixedPenaltyScorer ret = *owner->contents.result;
3268         ret.is_owned = false;
3269         return ret;
3270 }
3271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3272         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3273         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3274         int64_t ret_ref = 0;
3275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3277         return ret_ref;
3278 }
3279
3280 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3281         LDKDecodeError ret = *owner->contents.err;
3282         ret.is_owned = false;
3283         return ret;
3284 }
3285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3286         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3287         LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3288         int64_t ret_ref = 0;
3289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3291         return ret_ref;
3292 }
3293
3294 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3295         return owner->a;
3296 }
3297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3298         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3299         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3300         return ret_conv;
3301 }
3302
3303 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3304         return owner->b;
3305 }
3306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3307         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3308         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3309         return ret_conv;
3310 }
3311
3312 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
3313 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
3314 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
3315 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
3316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
3317         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
3318                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
3319         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
3320         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
3321         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
3322         LDKCOption_C2Tuple_u64u64ZZ_None_class =
3323                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
3324         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
3325         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
3326         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
3327 }
3328 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3329         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3330         switch(obj->tag) {
3331                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
3332                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3333                         *some_conv = obj->some;
3334                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3335                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
3336                 }
3337                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
3338                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
3339                 }
3340                 default: abort();
3341         }
3342 }
3343 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3344         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3345         for (size_t i = 0; i < ret.datalen; i++) {
3346                 ret.data[i] = NodeId_clone(&orig->data[i]);
3347         }
3348         return ret;
3349 }
3350 typedef struct LDKLogger_JCalls {
3351         atomic_size_t refcnt;
3352         JavaVM *vm;
3353         jweak o;
3354         jmethodID log_meth;
3355 } LDKLogger_JCalls;
3356 static void LDKLogger_JCalls_free(void* this_arg) {
3357         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3358         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3359                 JNIEnv *env;
3360                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3361                 if (get_jenv_res == JNI_EDETACHED) {
3362                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3363                 } else {
3364                         DO_ASSERT(get_jenv_res == JNI_OK);
3365                 }
3366                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3367                 if (get_jenv_res == JNI_EDETACHED) {
3368                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3369                 }
3370                 FREE(j_calls);
3371         }
3372 }
3373 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3374         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3375         JNIEnv *env;
3376         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3377         if (get_jenv_res == JNI_EDETACHED) {
3378                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3379         } else {
3380                 DO_ASSERT(get_jenv_res == JNI_OK);
3381         }
3382         LDKRecord record_var = *record;
3383         int64_t record_ref = 0;
3384         record_var = Record_clone(&record_var);
3385         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3386         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3387         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3388         CHECK(obj != NULL);
3389         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
3390         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3391                 (*env)->ExceptionDescribe(env);
3392                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
3393         }
3394         if (get_jenv_res == JNI_EDETACHED) {
3395                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3396         }
3397 }
3398 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3399         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3400         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3401 }
3402 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3403         jclass c = (*env)->GetObjectClass(env, o);
3404         CHECK(c != NULL);
3405         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3406         atomic_init(&calls->refcnt, 1);
3407         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3408         calls->o = (*env)->NewWeakGlobalRef(env, o);
3409         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
3410         CHECK(calls->log_meth != NULL);
3411
3412         LDKLogger ret = {
3413                 .this_arg = (void*) calls,
3414                 .log = log_LDKLogger_jcall,
3415                 .free = LDKLogger_JCalls_free,
3416         };
3417         return ret;
3418 }
3419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3420         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3421         *res_ptr = LDKLogger_init(env, clz, o);
3422         return tag_ptr(res_ptr, true);
3423 }
3424 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3425         LDKProbabilisticScorer ret = *owner->contents.result;
3426         ret.is_owned = false;
3427         return ret;
3428 }
3429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3430         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3431         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3432         int64_t ret_ref = 0;
3433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3435         return ret_ref;
3436 }
3437
3438 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3439         LDKDecodeError ret = *owner->contents.err;
3440         ret.is_owned = false;
3441         return ret;
3442 }
3443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3444         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3445         LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3446         int64_t ret_ref = 0;
3447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3449         return ret_ref;
3450 }
3451
3452 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3453         LDKInitFeatures ret = *owner->contents.result;
3454         ret.is_owned = false;
3455         return ret;
3456 }
3457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3458         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3459         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3460         int64_t ret_ref = 0;
3461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3463         return ret_ref;
3464 }
3465
3466 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3467         LDKDecodeError ret = *owner->contents.err;
3468         ret.is_owned = false;
3469         return ret;
3470 }
3471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3472         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3473         LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3474         int64_t ret_ref = 0;
3475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3477         return ret_ref;
3478 }
3479
3480 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3481         LDKChannelFeatures ret = *owner->contents.result;
3482         ret.is_owned = false;
3483         return ret;
3484 }
3485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3486         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3487         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3488         int64_t ret_ref = 0;
3489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3491         return ret_ref;
3492 }
3493
3494 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3495         LDKDecodeError ret = *owner->contents.err;
3496         ret.is_owned = false;
3497         return ret;
3498 }
3499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3500         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3501         LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3502         int64_t ret_ref = 0;
3503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3505         return ret_ref;
3506 }
3507
3508 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3509         LDKNodeFeatures ret = *owner->contents.result;
3510         ret.is_owned = false;
3511         return ret;
3512 }
3513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3514         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3515         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3516         int64_t ret_ref = 0;
3517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3519         return ret_ref;
3520 }
3521
3522 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3523         LDKDecodeError ret = *owner->contents.err;
3524         ret.is_owned = false;
3525         return ret;
3526 }
3527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3528         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3529         LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3530         int64_t ret_ref = 0;
3531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3533         return ret_ref;
3534 }
3535
3536 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3537         LDKInvoiceFeatures ret = *owner->contents.result;
3538         ret.is_owned = false;
3539         return ret;
3540 }
3541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3542         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3543         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3544         int64_t ret_ref = 0;
3545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3547         return ret_ref;
3548 }
3549
3550 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3551         LDKDecodeError ret = *owner->contents.err;
3552         ret.is_owned = false;
3553         return ret;
3554 }
3555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3556         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3557         LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3558         int64_t ret_ref = 0;
3559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3561         return ret_ref;
3562 }
3563
3564 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3565         LDKChannelTypeFeatures ret = *owner->contents.result;
3566         ret.is_owned = false;
3567         return ret;
3568 }
3569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3570         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3571         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3572         int64_t ret_ref = 0;
3573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3575         return ret_ref;
3576 }
3577
3578 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3579         LDKDecodeError ret = *owner->contents.err;
3580         ret.is_owned = false;
3581         return ret;
3582 }
3583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3584         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3585         LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3586         int64_t ret_ref = 0;
3587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3589         return ret_ref;
3590 }
3591
3592 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3593         LDKNodeId ret = *owner->contents.result;
3594         ret.is_owned = false;
3595         return ret;
3596 }
3597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3598         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3599         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3600         int64_t ret_ref = 0;
3601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3603         return ret_ref;
3604 }
3605
3606 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3607         LDKDecodeError ret = *owner->contents.err;
3608         ret.is_owned = false;
3609         return ret;
3610 }
3611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3612         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3613         LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3614         int64_t ret_ref = 0;
3615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3617         return ret_ref;
3618 }
3619
3620 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3621 CHECK(owner->result_ok);
3622         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3623 }
3624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3625         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3626         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3627         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3628         int64_t ret_ref = tag_ptr(ret_copy, true);
3629         return ret_ref;
3630 }
3631
3632 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3633         LDKDecodeError ret = *owner->contents.err;
3634         ret.is_owned = false;
3635         return ret;
3636 }
3637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3638         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3639         LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3640         int64_t ret_ref = 0;
3641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3643         return ret_ref;
3644 }
3645
3646 typedef struct LDKAccess_JCalls {
3647         atomic_size_t refcnt;
3648         JavaVM *vm;
3649         jweak o;
3650         jmethodID get_utxo_meth;
3651 } LDKAccess_JCalls;
3652 static void LDKAccess_JCalls_free(void* this_arg) {
3653         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3654         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3655                 JNIEnv *env;
3656                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3657                 if (get_jenv_res == JNI_EDETACHED) {
3658                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3659                 } else {
3660                         DO_ASSERT(get_jenv_res == JNI_OK);
3661                 }
3662                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3663                 if (get_jenv_res == JNI_EDETACHED) {
3664                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3665                 }
3666                 FREE(j_calls);
3667         }
3668 }
3669 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3670         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3671         JNIEnv *env;
3672         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3673         if (get_jenv_res == JNI_EDETACHED) {
3674                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3675         } else {
3676                 DO_ASSERT(get_jenv_res == JNI_OK);
3677         }
3678         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3679         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3680         int64_t short_channel_id_conv = short_channel_id;
3681         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3682         CHECK(obj != NULL);
3683         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
3684         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3685                 (*env)->ExceptionDescribe(env);
3686                 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
3687         }
3688         void* ret_ptr = untag_ptr(ret);
3689         CHECK_ACCESS(ret_ptr);
3690         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3691         FREE(untag_ptr(ret));
3692         if (get_jenv_res == JNI_EDETACHED) {
3693                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3694         }
3695         return ret_conv;
3696 }
3697 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3698         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3699         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3700 }
3701 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3702         jclass c = (*env)->GetObjectClass(env, o);
3703         CHECK(c != NULL);
3704         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3705         atomic_init(&calls->refcnt, 1);
3706         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3707         calls->o = (*env)->NewWeakGlobalRef(env, o);
3708         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3709         CHECK(calls->get_utxo_meth != NULL);
3710
3711         LDKAccess ret = {
3712                 .this_arg = (void*) calls,
3713                 .get_utxo = get_utxo_LDKAccess_jcall,
3714                 .free = LDKAccess_JCalls_free,
3715         };
3716         return ret;
3717 }
3718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3719         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3720         *res_ptr = LDKAccess_init(env, clz, o);
3721         return tag_ptr(res_ptr, true);
3722 }
3723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3724         void* this_arg_ptr = untag_ptr(this_arg);
3725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3726         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3727         unsigned char genesis_hash_arr[32];
3728         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3729         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3730         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3731         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3732         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3733         return tag_ptr(ret_conv, true);
3734 }
3735
3736 static jclass LDKCOption_AccessZ_Some_class = NULL;
3737 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
3738 static jclass LDKCOption_AccessZ_None_class = NULL;
3739 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
3740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
3741         LDKCOption_AccessZ_Some_class =
3742                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
3743         CHECK(LDKCOption_AccessZ_Some_class != NULL);
3744         LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
3745         CHECK(LDKCOption_AccessZ_Some_meth != NULL);
3746         LDKCOption_AccessZ_None_class =
3747                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
3748         CHECK(LDKCOption_AccessZ_None_class != NULL);
3749         LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
3750         CHECK(LDKCOption_AccessZ_None_meth != NULL);
3751 }
3752 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3753         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3754         switch(obj->tag) {
3755                 case LDKCOption_AccessZ_Some: {
3756                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3757                         *some_ret = obj->some;
3758                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3759                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3760                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3761                                 LDKAccess_JCalls_cloned(&(*some_ret));
3762                         }
3763                         return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, tag_ptr(some_ret, true));
3764                 }
3765                 case LDKCOption_AccessZ_None: {
3766                         return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
3767                 }
3768                 default: abort();
3769         }
3770 }
3771 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3772 CHECK(owner->result_ok);
3773         return *owner->contents.result;
3774 }
3775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3776         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3777         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3778         return ret_conv;
3779 }
3780
3781 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3782         LDKLightningError ret = *owner->contents.err;
3783         ret.is_owned = false;
3784         return ret;
3785 }
3786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3787         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3788         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3789         int64_t ret_ref = 0;
3790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3792         return ret_ref;
3793 }
3794
3795 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3796         LDKChannelAnnouncement ret = owner->a;
3797         ret.is_owned = false;
3798         return ret;
3799 }
3800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3801         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3802         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3803         int64_t ret_ref = 0;
3804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3806         return ret_ref;
3807 }
3808
3809 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3810         LDKChannelUpdate ret = owner->b;
3811         ret.is_owned = false;
3812         return ret;
3813 }
3814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3815         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3816         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3817         int64_t ret_ref = 0;
3818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3820         return ret_ref;
3821 }
3822
3823 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3824         LDKChannelUpdate ret = owner->c;
3825         ret.is_owned = false;
3826         return ret;
3827 }
3828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3829         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3830         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3831         int64_t ret_ref = 0;
3832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3834         return ret_ref;
3835 }
3836
3837 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3838         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3839         for (size_t i = 0; i < ret.datalen; i++) {
3840                 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3841         }
3842         return ret;
3843 }
3844 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3845         LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3846         for (size_t i = 0; i < ret.datalen; i++) {
3847                 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3848         }
3849         return ret;
3850 }
3851 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3852 CHECK(owner->result_ok);
3853         return *owner->contents.result;
3854 }
3855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3856         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3857         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3858 }
3859
3860 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3861         LDKLightningError ret = *owner->contents.err;
3862         ret.is_owned = false;
3863         return ret;
3864 }
3865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3866         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3867         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3868         int64_t ret_ref = 0;
3869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3871         return ret_ref;
3872 }
3873
3874 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3875         LDKChannelUpdateInfo ret = *owner->contents.result;
3876         ret.is_owned = false;
3877         return ret;
3878 }
3879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3880         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3881         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3882         int64_t ret_ref = 0;
3883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3885         return ret_ref;
3886 }
3887
3888 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3889         LDKDecodeError ret = *owner->contents.err;
3890         ret.is_owned = false;
3891         return ret;
3892 }
3893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3894         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3895         LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3896         int64_t ret_ref = 0;
3897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3899         return ret_ref;
3900 }
3901
3902 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3903         LDKChannelInfo ret = *owner->contents.result;
3904         ret.is_owned = false;
3905         return ret;
3906 }
3907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3908         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3909         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3910         int64_t ret_ref = 0;
3911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3913         return ret_ref;
3914 }
3915
3916 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3917         LDKDecodeError ret = *owner->contents.err;
3918         ret.is_owned = false;
3919         return ret;
3920 }
3921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3922         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3923         LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3924         int64_t ret_ref = 0;
3925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3927         return ret_ref;
3928 }
3929
3930 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3931         LDKRoutingFees ret = *owner->contents.result;
3932         ret.is_owned = false;
3933         return ret;
3934 }
3935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3936         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3937         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3938         int64_t ret_ref = 0;
3939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3941         return ret_ref;
3942 }
3943
3944 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3945         LDKDecodeError ret = *owner->contents.err;
3946         ret.is_owned = false;
3947         return ret;
3948 }
3949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3950         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3951         LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3952         int64_t ret_ref = 0;
3953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3955         return ret_ref;
3956 }
3957
3958 static jclass LDKNetAddress_IPv4_class = NULL;
3959 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3960 static jclass LDKNetAddress_IPv6_class = NULL;
3961 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3962 static jclass LDKNetAddress_OnionV2_class = NULL;
3963 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3964 static jclass LDKNetAddress_OnionV3_class = NULL;
3965 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3966 static jclass LDKNetAddress_Hostname_class = NULL;
3967 static jmethodID LDKNetAddress_Hostname_meth = NULL;
3968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3969         LDKNetAddress_IPv4_class =
3970                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
3971         CHECK(LDKNetAddress_IPv4_class != NULL);
3972         LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3973         CHECK(LDKNetAddress_IPv4_meth != NULL);
3974         LDKNetAddress_IPv6_class =
3975                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
3976         CHECK(LDKNetAddress_IPv6_class != NULL);
3977         LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3978         CHECK(LDKNetAddress_IPv6_meth != NULL);
3979         LDKNetAddress_OnionV2_class =
3980                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
3981         CHECK(LDKNetAddress_OnionV2_class != NULL);
3982         LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
3983         CHECK(LDKNetAddress_OnionV2_meth != NULL);
3984         LDKNetAddress_OnionV3_class =
3985                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
3986         CHECK(LDKNetAddress_OnionV3_class != NULL);
3987         LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3988         CHECK(LDKNetAddress_OnionV3_meth != NULL);
3989         LDKNetAddress_Hostname_class =
3990                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
3991         CHECK(LDKNetAddress_Hostname_class != NULL);
3992         LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
3993         CHECK(LDKNetAddress_Hostname_meth != NULL);
3994 }
3995 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3996         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3997         switch(obj->tag) {
3998                 case LDKNetAddress_IPv4: {
3999                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
4000                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
4001                         int16_t port_conv = obj->i_pv4.port;
4002                         return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
4003                 }
4004                 case LDKNetAddress_IPv6: {
4005                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4006                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4007                         int16_t port_conv = obj->i_pv6.port;
4008                         return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
4009                 }
4010                 case LDKNetAddress_OnionV2: {
4011                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4012                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4013                         return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4014                 }
4015                 case LDKNetAddress_OnionV3: {
4016                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4017                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4018                         int16_t checksum_conv = obj->onion_v3.checksum;
4019                         int8_t version_conv = obj->onion_v3.version;
4020                         int16_t port_conv = obj->onion_v3.port;
4021                         return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
4022                 }
4023                 case LDKNetAddress_Hostname: {
4024                         LDKHostname hostname_var = obj->hostname.hostname;
4025                         int64_t hostname_ref = 0;
4026                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4027                         hostname_ref = tag_ptr(hostname_var.inner, false);
4028                         int16_t port_conv = obj->hostname.port;
4029                         return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
4030                 }
4031                 default: abort();
4032         }
4033 }
4034 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4035         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4036         for (size_t i = 0; i < ret.datalen; i++) {
4037                 ret.data[i] = NetAddress_clone(&orig->data[i]);
4038         }
4039         return ret;
4040 }
4041 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4042         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4043         ret.is_owned = false;
4044         return ret;
4045 }
4046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4047         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4048         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4049         int64_t ret_ref = 0;
4050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4052         return ret_ref;
4053 }
4054
4055 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4056         LDKDecodeError ret = *owner->contents.err;
4057         ret.is_owned = false;
4058         return ret;
4059 }
4060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4061         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4062         LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4063         int64_t ret_ref = 0;
4064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4066         return ret_ref;
4067 }
4068
4069 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4070         LDKNodeAlias ret = *owner->contents.result;
4071         ret.is_owned = false;
4072         return ret;
4073 }
4074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4075         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4076         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4077         int64_t ret_ref = 0;
4078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4080         return ret_ref;
4081 }
4082
4083 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4084         LDKDecodeError ret = *owner->contents.err;
4085         ret.is_owned = false;
4086         return ret;
4087 }
4088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4089         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4090         LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4091         int64_t ret_ref = 0;
4092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4094         return ret_ref;
4095 }
4096
4097 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4098         LDKNodeInfo ret = *owner->contents.result;
4099         ret.is_owned = false;
4100         return ret;
4101 }
4102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4103         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4104         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4105         int64_t ret_ref = 0;
4106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4108         return ret_ref;
4109 }
4110
4111 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4112         LDKDecodeError ret = *owner->contents.err;
4113         ret.is_owned = false;
4114         return ret;
4115 }
4116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4117         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4118         LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4119         int64_t ret_ref = 0;
4120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4122         return ret_ref;
4123 }
4124
4125 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4126         LDKNetworkGraph ret = *owner->contents.result;
4127         ret.is_owned = false;
4128         return ret;
4129 }
4130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4131         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4132         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4133         int64_t ret_ref = 0;
4134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4136         return ret_ref;
4137 }
4138
4139 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4140         LDKDecodeError ret = *owner->contents.err;
4141         ret.is_owned = false;
4142         return ret;
4143 }
4144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4145         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4146         LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4147         int64_t ret_ref = 0;
4148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4150         return ret_ref;
4151 }
4152
4153 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
4154 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
4155 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
4156 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
4157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
4158         LDKCOption_CVec_NetAddressZZ_Some_class =
4159                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
4160         CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
4161         LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
4162         CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
4163         LDKCOption_CVec_NetAddressZZ_None_class =
4164                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
4165         CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
4166         LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
4167         CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
4168 }
4169 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4170         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
4171         switch(obj->tag) {
4172                 case LDKCOption_CVec_NetAddressZZ_Some: {
4173                         LDKCVec_NetAddressZ some_var = obj->some;
4174                         int64_tArray some_arr = NULL;
4175                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
4176                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
4177                         for (size_t m = 0; m < some_var.datalen; m++) {
4178                                 int64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
4179                                 some_arr_ptr[m] = some_conv_12_ref;
4180                         }
4181                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
4182                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
4183                 }
4184                 case LDKCOption_CVec_NetAddressZZ_None: {
4185                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
4186                 }
4187                 default: abort();
4188         }
4189 }
4190 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4191         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
4192         ret.is_owned = false;
4193         return ret;
4194 }
4195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4196         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4197         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4198         int64_t ret_ref = 0;
4199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4201         return ret_ref;
4202 }
4203
4204 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4205         LDKDecodeError ret = *owner->contents.err;
4206         ret.is_owned = false;
4207         return ret;
4208 }
4209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4210         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4211         LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4212         int64_t ret_ref = 0;
4213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4215         return ret_ref;
4216 }
4217
4218 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4219         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
4220         ret.is_owned = false;
4221         return ret;
4222 }
4223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4224         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4225         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4226         int64_t ret_ref = 0;
4227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4229         return ret_ref;
4230 }
4231
4232 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4233         LDKDecodeError ret = *owner->contents.err;
4234         ret.is_owned = false;
4235         return ret;
4236 }
4237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4238         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4239         LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4240         int64_t ret_ref = 0;
4241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4243         return ret_ref;
4244 }
4245
4246 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4247 CHECK(owner->result_ok);
4248         return SpendableOutputDescriptor_clone(&*owner->contents.result);
4249 }
4250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4251         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4252         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4253         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4254         int64_t ret_ref = tag_ptr(ret_copy, true);
4255         return ret_ref;
4256 }
4257
4258 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4259         LDKDecodeError ret = *owner->contents.err;
4260         ret.is_owned = false;
4261         return ret;
4262 }
4263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4264         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4265         LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4266         int64_t ret_ref = 0;
4267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4269         return ret_ref;
4270 }
4271
4272 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4273         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4274         for (size_t i = 0; i < ret.datalen; i++) {
4275                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4276         }
4277         return ret;
4278 }
4279 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4280         return owner->a;
4281 }
4282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4283         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4284         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4285         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
4286         return ret_arr;
4287 }
4288
4289 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4290         return owner->b;
4291 }
4292 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4293         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4294         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4295         jobjectArray ret_arr = NULL;
4296         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4297         ;
4298         for (size_t i = 0; i < ret_var.datalen; i++) {
4299                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
4300                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
4301                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4302         }
4303         
4304         return ret_arr;
4305 }
4306
4307 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4308 CHECK(owner->result_ok);
4309         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4310 }
4311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4312         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4313         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4314         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4315         return tag_ptr(ret_conv, true);
4316 }
4317
4318 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4319 CHECK(!owner->result_ok);
4320         return *owner->contents.err;
4321 }
4322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4323         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4324         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4325 }
4326
4327 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4328 CHECK(owner->result_ok);
4329         return *owner->contents.result;
4330 }
4331 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4332         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4333         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4334         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
4335         return ret_arr;
4336 }
4337
4338 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4339 CHECK(!owner->result_ok);
4340         return *owner->contents.err;
4341 }
4342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4343         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4344         CResult_SignatureNoneZ_get_err(owner_conv);
4345 }
4346
4347 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4348         return owner->a;
4349 }
4350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4351         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
4352         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4353         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
4354         return ret_arr;
4355 }
4356
4357 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4358         return owner->b;
4359 }
4360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4361         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
4362         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4363         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
4364         return ret_arr;
4365 }
4366
4367 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4368 CHECK(owner->result_ok);
4369         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
4370 }
4371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4372         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
4373         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
4374         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
4375         return tag_ptr(ret_conv, true);
4376 }
4377
4378 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4379 CHECK(!owner->result_ok);
4380         return *owner->contents.err;
4381 }
4382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4383         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
4384         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
4385 }
4386
4387 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4388 CHECK(owner->result_ok);
4389         return *owner->contents.result;
4390 }
4391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4392         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
4393         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4394         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
4395         return ret_arr;
4396 }
4397
4398 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4399 CHECK(!owner->result_ok);
4400         return *owner->contents.err;
4401 }
4402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4403         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
4404         CResult_SecretKeyNoneZ_get_err(owner_conv);
4405 }
4406
4407 typedef struct LDKBaseSign_JCalls {
4408         atomic_size_t refcnt;
4409         JavaVM *vm;
4410         jweak o;
4411         jmethodID get_per_commitment_point_meth;
4412         jmethodID release_commitment_secret_meth;
4413         jmethodID validate_holder_commitment_meth;
4414         jmethodID channel_keys_id_meth;
4415         jmethodID sign_counterparty_commitment_meth;
4416         jmethodID validate_counterparty_revocation_meth;
4417         jmethodID sign_holder_commitment_and_htlcs_meth;
4418         jmethodID sign_justice_revoked_output_meth;
4419         jmethodID sign_justice_revoked_htlc_meth;
4420         jmethodID sign_counterparty_htlc_transaction_meth;
4421         jmethodID sign_closing_transaction_meth;
4422         jmethodID sign_channel_announcement_meth;
4423         jmethodID ready_channel_meth;
4424 } LDKBaseSign_JCalls;
4425 static void LDKBaseSign_JCalls_free(void* this_arg) {
4426         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4427         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4428                 JNIEnv *env;
4429                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4430                 if (get_jenv_res == JNI_EDETACHED) {
4431                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4432                 } else {
4433                         DO_ASSERT(get_jenv_res == JNI_OK);
4434                 }
4435                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4436                 if (get_jenv_res == JNI_EDETACHED) {
4437                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4438                 }
4439                 FREE(j_calls);
4440         }
4441 }
4442 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4443         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4444         JNIEnv *env;
4445         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4446         if (get_jenv_res == JNI_EDETACHED) {
4447                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4448         } else {
4449                 DO_ASSERT(get_jenv_res == JNI_OK);
4450         }
4451         int64_t idx_conv = idx;
4452         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4453         CHECK(obj != NULL);
4454         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
4455         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4456                 (*env)->ExceptionDescribe(env);
4457                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
4458         }
4459         LDKPublicKey ret_ref;
4460         CHECK((*env)->GetArrayLength(env, ret) == 33);
4461         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
4462         if (get_jenv_res == JNI_EDETACHED) {
4463                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4464         }
4465         return ret_ref;
4466 }
4467 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4468         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4469         JNIEnv *env;
4470         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4471         if (get_jenv_res == JNI_EDETACHED) {
4472                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4473         } else {
4474                 DO_ASSERT(get_jenv_res == JNI_OK);
4475         }
4476         int64_t idx_conv = idx;
4477         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4478         CHECK(obj != NULL);
4479         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
4480         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4481                 (*env)->ExceptionDescribe(env);
4482                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
4483         }
4484         LDKThirtyTwoBytes ret_ref;
4485         CHECK((*env)->GetArrayLength(env, ret) == 32);
4486         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4487         if (get_jenv_res == JNI_EDETACHED) {
4488                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4489         }
4490         return ret_ref;
4491 }
4492 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4493         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4494         JNIEnv *env;
4495         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4496         if (get_jenv_res == JNI_EDETACHED) {
4497                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4498         } else {
4499                 DO_ASSERT(get_jenv_res == JNI_OK);
4500         }
4501         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4502         int64_t holder_tx_ref = 0;
4503         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4504         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4505         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
4506         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4507         jobjectArray preimages_arr = NULL;
4508         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4509         ;
4510         for (size_t i = 0; i < preimages_var.datalen; i++) {
4511                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4512                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4513                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4514         }
4515         
4516         FREE(preimages_var.data);
4517         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4518         CHECK(obj != NULL);
4519         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
4520         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4521                 (*env)->ExceptionDescribe(env);
4522                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
4523         }
4524         void* ret_ptr = untag_ptr(ret);
4525         CHECK_ACCESS(ret_ptr);
4526         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4527         FREE(untag_ptr(ret));
4528         if (get_jenv_res == JNI_EDETACHED) {
4529                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4530         }
4531         return ret_conv;
4532 }
4533 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
4534         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4535         JNIEnv *env;
4536         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4537         if (get_jenv_res == JNI_EDETACHED) {
4538                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4539         } else {
4540                 DO_ASSERT(get_jenv_res == JNI_OK);
4541         }
4542         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4543         CHECK(obj != NULL);
4544         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
4545         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4546                 (*env)->ExceptionDescribe(env);
4547                 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
4548         }
4549         LDKThirtyTwoBytes ret_ref;
4550         CHECK((*env)->GetArrayLength(env, ret) == 32);
4551         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4552         if (get_jenv_res == JNI_EDETACHED) {
4553                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4554         }
4555         return ret_ref;
4556 }
4557 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4558         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4559         JNIEnv *env;
4560         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4561         if (get_jenv_res == JNI_EDETACHED) {
4562                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4563         } else {
4564                 DO_ASSERT(get_jenv_res == JNI_OK);
4565         }
4566         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4567         int64_t commitment_tx_ref = 0;
4568         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4569         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4570         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4571         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4572         jobjectArray preimages_arr = NULL;
4573         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4574         ;
4575         for (size_t i = 0; i < preimages_var.datalen; i++) {
4576                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4577                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4578                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4579         }
4580         
4581         FREE(preimages_var.data);
4582         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4583         CHECK(obj != NULL);
4584         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
4585         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4586                 (*env)->ExceptionDescribe(env);
4587                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
4588         }
4589         void* ret_ptr = untag_ptr(ret);
4590         CHECK_ACCESS(ret_ptr);
4591         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4592         FREE(untag_ptr(ret));
4593         if (get_jenv_res == JNI_EDETACHED) {
4594                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4595         }
4596         return ret_conv;
4597 }
4598 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4599         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4600         JNIEnv *env;
4601         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4602         if (get_jenv_res == JNI_EDETACHED) {
4603                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4604         } else {
4605                 DO_ASSERT(get_jenv_res == JNI_OK);
4606         }
4607         int64_t idx_conv = idx;
4608         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
4609         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
4610         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4611         CHECK(obj != NULL);
4612         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
4613         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4614                 (*env)->ExceptionDescribe(env);
4615                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
4616         }
4617         void* ret_ptr = untag_ptr(ret);
4618         CHECK_ACCESS(ret_ptr);
4619         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4620         FREE(untag_ptr(ret));
4621         if (get_jenv_res == JNI_EDETACHED) {
4622                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4623         }
4624         return ret_conv;
4625 }
4626 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4627         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4628         JNIEnv *env;
4629         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4630         if (get_jenv_res == JNI_EDETACHED) {
4631                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4632         } else {
4633                 DO_ASSERT(get_jenv_res == JNI_OK);
4634         }
4635         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4636         int64_t commitment_tx_ref = 0;
4637         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4638         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4639         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4640         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4641         CHECK(obj != NULL);
4642         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
4643         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4644                 (*env)->ExceptionDescribe(env);
4645                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
4646         }
4647         void* ret_ptr = untag_ptr(ret);
4648         CHECK_ACCESS(ret_ptr);
4649         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4650         FREE(untag_ptr(ret));
4651         if (get_jenv_res == JNI_EDETACHED) {
4652                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4653         }
4654         return ret_conv;
4655 }
4656 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
4657         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4658         JNIEnv *env;
4659         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4660         if (get_jenv_res == JNI_EDETACHED) {
4661                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4662         } else {
4663                 DO_ASSERT(get_jenv_res == JNI_OK);
4664         }
4665         LDKTransaction justice_tx_var = justice_tx;
4666         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4667         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4668         Transaction_free(justice_tx_var);
4669         int64_t input_conv = input;
4670         int64_t amount_conv = amount;
4671         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4672         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4673         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4674         CHECK(obj != NULL);
4675         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);
4676         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4677                 (*env)->ExceptionDescribe(env);
4678                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
4679         }
4680         void* ret_ptr = untag_ptr(ret);
4681         CHECK_ACCESS(ret_ptr);
4682         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4683         FREE(untag_ptr(ret));
4684         if (get_jenv_res == JNI_EDETACHED) {
4685                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4686         }
4687         return ret_conv;
4688 }
4689 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
4690         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4691         JNIEnv *env;
4692         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4693         if (get_jenv_res == JNI_EDETACHED) {
4694                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4695         } else {
4696                 DO_ASSERT(get_jenv_res == JNI_OK);
4697         }
4698         LDKTransaction justice_tx_var = justice_tx;
4699         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4700         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4701         Transaction_free(justice_tx_var);
4702         int64_t input_conv = input;
4703         int64_t amount_conv = amount;
4704         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4705         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4706         LDKHTLCOutputInCommitment htlc_var = *htlc;
4707         int64_t htlc_ref = 0;
4708         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4709         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4710         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4711         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4712         CHECK(obj != NULL);
4713         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);
4714         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4715                 (*env)->ExceptionDescribe(env);
4716                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
4717         }
4718         void* ret_ptr = untag_ptr(ret);
4719         CHECK_ACCESS(ret_ptr);
4720         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4721         FREE(untag_ptr(ret));
4722         if (get_jenv_res == JNI_EDETACHED) {
4723                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4724         }
4725         return ret_conv;
4726 }
4727 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
4728         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4729         JNIEnv *env;
4730         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4731         if (get_jenv_res == JNI_EDETACHED) {
4732                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4733         } else {
4734                 DO_ASSERT(get_jenv_res == JNI_OK);
4735         }
4736         LDKTransaction htlc_tx_var = htlc_tx;
4737         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
4738         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
4739         Transaction_free(htlc_tx_var);
4740         int64_t input_conv = input;
4741         int64_t amount_conv = amount;
4742         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
4743         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
4744         LDKHTLCOutputInCommitment htlc_var = *htlc;
4745         int64_t htlc_ref = 0;
4746         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4747         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4748         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4749         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4750         CHECK(obj != NULL);
4751         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);
4752         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4753                 (*env)->ExceptionDescribe(env);
4754                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
4755         }
4756         void* ret_ptr = untag_ptr(ret);
4757         CHECK_ACCESS(ret_ptr);
4758         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4759         FREE(untag_ptr(ret));
4760         if (get_jenv_res == JNI_EDETACHED) {
4761                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4762         }
4763         return ret_conv;
4764 }
4765 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4766         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4767         JNIEnv *env;
4768         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4769         if (get_jenv_res == JNI_EDETACHED) {
4770                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4771         } else {
4772                 DO_ASSERT(get_jenv_res == JNI_OK);
4773         }
4774         LDKClosingTransaction closing_tx_var = *closing_tx;
4775         int64_t closing_tx_ref = 0;
4776         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4777         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4778         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4779         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4780         CHECK(obj != NULL);
4781         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
4782         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4783                 (*env)->ExceptionDescribe(env);
4784                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
4785         }
4786         void* ret_ptr = untag_ptr(ret);
4787         CHECK_ACCESS(ret_ptr);
4788         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4789         FREE(untag_ptr(ret));
4790         if (get_jenv_res == JNI_EDETACHED) {
4791                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4792         }
4793         return ret_conv;
4794 }
4795 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4796         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4797         JNIEnv *env;
4798         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4799         if (get_jenv_res == JNI_EDETACHED) {
4800                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4801         } else {
4802                 DO_ASSERT(get_jenv_res == JNI_OK);
4803         }
4804         LDKUnsignedChannelAnnouncement msg_var = *msg;
4805         int64_t msg_ref = 0;
4806         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4807         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4808         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4809         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4810         CHECK(obj != NULL);
4811         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4812         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4813                 (*env)->ExceptionDescribe(env);
4814                 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
4815         }
4816         void* ret_ptr = untag_ptr(ret);
4817         CHECK_ACCESS(ret_ptr);
4818         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4819         FREE(untag_ptr(ret));
4820         if (get_jenv_res == JNI_EDETACHED) {
4821                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4822         }
4823         return ret_conv;
4824 }
4825 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4826         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4827         JNIEnv *env;
4828         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4829         if (get_jenv_res == JNI_EDETACHED) {
4830                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4831         } else {
4832                 DO_ASSERT(get_jenv_res == JNI_OK);
4833         }
4834         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4835         int64_t channel_parameters_ref = 0;
4836         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4837         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4838         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4839         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4840         CHECK(obj != NULL);
4841         (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
4842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4843                 (*env)->ExceptionDescribe(env);
4844                 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
4845         }
4846         if (get_jenv_res == JNI_EDETACHED) {
4847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4848         }
4849 }
4850 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4851         jclass c = (*env)->GetObjectClass(env, o);
4852         CHECK(c != NULL);
4853         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4854         atomic_init(&calls->refcnt, 1);
4855         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4856         calls->o = (*env)->NewWeakGlobalRef(env, o);
4857         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
4858         CHECK(calls->get_per_commitment_point_meth != NULL);
4859         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
4860         CHECK(calls->release_commitment_secret_meth != NULL);
4861         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
4862         CHECK(calls->validate_holder_commitment_meth != NULL);
4863         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
4864         CHECK(calls->channel_keys_id_meth != NULL);
4865         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
4866         CHECK(calls->sign_counterparty_commitment_meth != NULL);
4867         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
4868         CHECK(calls->validate_counterparty_revocation_meth != NULL);
4869         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
4870         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
4871         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
4872         CHECK(calls->sign_justice_revoked_output_meth != NULL);
4873         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
4874         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
4875         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
4876         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
4877         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
4878         CHECK(calls->sign_closing_transaction_meth != NULL);
4879         calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
4880         CHECK(calls->sign_channel_announcement_meth != NULL);
4881         calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
4882         CHECK(calls->ready_channel_meth != NULL);
4883
4884         LDKChannelPublicKeys pubkeys_conv;
4885         pubkeys_conv.inner = untag_ptr(pubkeys);
4886         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4887         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4888
4889         LDKBaseSign ret = {
4890                 .this_arg = (void*) calls,
4891                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4892                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4893                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4894                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4895                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4896                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4897                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4898                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4899                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4900                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4901                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4902                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4903                 .ready_channel = ready_channel_LDKBaseSign_jcall,
4904                 .free = LDKBaseSign_JCalls_free,
4905                 .pubkeys = pubkeys_conv,
4906                 .set_pubkeys = NULL,
4907         };
4908         return ret;
4909 }
4910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4911         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4912         *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
4913         return tag_ptr(res_ptr, true);
4914 }
4915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
4916         void* this_arg_ptr = untag_ptr(this_arg);
4917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4918         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4919         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4920         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
4921         return ret_arr;
4922 }
4923
4924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
4925         void* this_arg_ptr = untag_ptr(this_arg);
4926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4927         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4928         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4929         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
4930         return ret_arr;
4931 }
4932
4933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray preimages) {
4934         void* this_arg_ptr = untag_ptr(this_arg);
4935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4936         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4937         LDKHolderCommitmentTransaction holder_tx_conv;
4938         holder_tx_conv.inner = untag_ptr(holder_tx);
4939         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4940         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4941         holder_tx_conv.is_owned = false;
4942         LDKCVec_PaymentPreimageZ preimages_constr;
4943         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4944         if (preimages_constr.datalen > 0)
4945                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4946         else
4947                 preimages_constr.data = NULL;
4948         for (size_t i = 0; i < preimages_constr.datalen; i++) {
4949                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4950                 LDKThirtyTwoBytes preimages_conv_8_ref;
4951                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4952                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4953                 preimages_constr.data[i] = preimages_conv_8_ref;
4954         }
4955         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4956         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4957         return tag_ptr(ret_conv, true);
4958 }
4959
4960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4961         void* this_arg_ptr = untag_ptr(this_arg);
4962         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4963         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4964         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4965         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
4966         return ret_arr;
4967 }
4968
4969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray preimages) {
4970         void* this_arg_ptr = untag_ptr(this_arg);
4971         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4972         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4973         LDKCommitmentTransaction commitment_tx_conv;
4974         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4975         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4976         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4977         commitment_tx_conv.is_owned = false;
4978         LDKCVec_PaymentPreimageZ preimages_constr;
4979         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4980         if (preimages_constr.datalen > 0)
4981                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4982         else
4983                 preimages_constr.data = NULL;
4984         for (size_t i = 0; i < preimages_constr.datalen; i++) {
4985                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4986                 LDKThirtyTwoBytes preimages_conv_8_ref;
4987                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4988                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4989                 preimages_constr.data[i] = preimages_conv_8_ref;
4990         }
4991         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4992         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4993         return tag_ptr(ret_conv, true);
4994 }
4995
4996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
4997         void* this_arg_ptr = untag_ptr(this_arg);
4998         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4999         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5000         unsigned char secret_arr[32];
5001         CHECK((*env)->GetArrayLength(env, secret) == 32);
5002         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
5003         unsigned char (*secret_ref)[32] = &secret_arr;
5004         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5005         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
5006         return tag_ptr(ret_conv, true);
5007 }
5008
5009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
5010         void* this_arg_ptr = untag_ptr(this_arg);
5011         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5012         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5013         LDKHolderCommitmentTransaction commitment_tx_conv;
5014         commitment_tx_conv.inner = untag_ptr(commitment_tx);
5015         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
5016         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5017         commitment_tx_conv.is_owned = false;
5018         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5019         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
5020         return tag_ptr(ret_conv, true);
5021 }
5022
5023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_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) {
5024         void* this_arg_ptr = untag_ptr(this_arg);
5025         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5026         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5027         LDKTransaction justice_tx_ref;
5028         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5029         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5030         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5031         justice_tx_ref.data_is_owned = true;
5032         unsigned char per_commitment_key_arr[32];
5033         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5034         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5035         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5036         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5037         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
5038         return tag_ptr(ret_conv, true);
5039 }
5040
5041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_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) {
5042         void* this_arg_ptr = untag_ptr(this_arg);
5043         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5044         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5045         LDKTransaction justice_tx_ref;
5046         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5047         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5048         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5049         justice_tx_ref.data_is_owned = true;
5050         unsigned char per_commitment_key_arr[32];
5051         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5052         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5053         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5054         LDKHTLCOutputInCommitment htlc_conv;
5055         htlc_conv.inner = untag_ptr(htlc);
5056         htlc_conv.is_owned = ptr_is_owned(htlc);
5057         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5058         htlc_conv.is_owned = false;
5059         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5060         *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);
5061         return tag_ptr(ret_conv, true);
5062 }
5063
5064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_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) {
5065         void* this_arg_ptr = untag_ptr(this_arg);
5066         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5067         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5068         LDKTransaction htlc_tx_ref;
5069         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
5070         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
5071         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
5072         htlc_tx_ref.data_is_owned = true;
5073         LDKPublicKey per_commitment_point_ref;
5074         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
5075         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
5076         LDKHTLCOutputInCommitment htlc_conv;
5077         htlc_conv.inner = untag_ptr(htlc);
5078         htlc_conv.is_owned = ptr_is_owned(htlc);
5079         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5080         htlc_conv.is_owned = false;
5081         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5082         *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);
5083         return tag_ptr(ret_conv, true);
5084 }
5085
5086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
5087         void* this_arg_ptr = untag_ptr(this_arg);
5088         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5089         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5090         LDKClosingTransaction closing_tx_conv;
5091         closing_tx_conv.inner = untag_ptr(closing_tx);
5092         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
5093         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
5094         closing_tx_conv.is_owned = false;
5095         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5096         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
5097         return tag_ptr(ret_conv, true);
5098 }
5099
5100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5101         void* this_arg_ptr = untag_ptr(this_arg);
5102         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5103         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5104         LDKUnsignedChannelAnnouncement msg_conv;
5105         msg_conv.inner = untag_ptr(msg);
5106         msg_conv.is_owned = ptr_is_owned(msg);
5107         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
5108         msg_conv.is_owned = false;
5109         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
5110         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5111         return tag_ptr(ret_conv, true);
5112 }
5113
5114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5115         void* this_arg_ptr = untag_ptr(this_arg);
5116         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5117         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5118         LDKChannelTransactionParameters channel_parameters_conv;
5119         channel_parameters_conv.inner = untag_ptr(channel_parameters);
5120         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
5121         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5122         channel_parameters_conv.is_owned = false;
5123         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
5124 }
5125
5126 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
5127         if (this_arg->set_pubkeys != NULL)
5128                 this_arg->set_pubkeys(this_arg);
5129         return this_arg->pubkeys;
5130 }
5131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
5132         void* this_arg_ptr = untag_ptr(this_arg);
5133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5134         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5135         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
5136         int64_t ret_ref = 0;
5137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5139         return ret_ref;
5140 }
5141
5142 typedef struct LDKSign_JCalls {
5143         atomic_size_t refcnt;
5144         JavaVM *vm;
5145         jweak o;
5146         LDKBaseSign_JCalls* BaseSign;
5147         jmethodID write_meth;
5148 } LDKSign_JCalls;
5149 static void LDKSign_JCalls_free(void* this_arg) {
5150         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5151         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5152                 JNIEnv *env;
5153                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5154                 if (get_jenv_res == JNI_EDETACHED) {
5155                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5156                 } else {
5157                         DO_ASSERT(get_jenv_res == JNI_OK);
5158                 }
5159                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5160                 if (get_jenv_res == JNI_EDETACHED) {
5161                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5162                 }
5163                 FREE(j_calls);
5164         }
5165 }
5166 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
5167         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5168         JNIEnv *env;
5169         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5170         if (get_jenv_res == JNI_EDETACHED) {
5171                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5172         } else {
5173                 DO_ASSERT(get_jenv_res == JNI_OK);
5174         }
5175         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5176         CHECK(obj != NULL);
5177         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5178         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5179                 (*env)->ExceptionDescribe(env);
5180                 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
5181         }
5182         LDKCVec_u8Z ret_ref;
5183         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5184         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5185         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5186         if (get_jenv_res == JNI_EDETACHED) {
5187                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5188         }
5189         return ret_ref;
5190 }
5191 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
5192         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
5193         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5194         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
5195 }
5196 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5197         jclass c = (*env)->GetObjectClass(env, o);
5198         CHECK(c != NULL);
5199         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
5200         atomic_init(&calls->refcnt, 1);
5201         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5202         calls->o = (*env)->NewWeakGlobalRef(env, o);
5203         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5204         CHECK(calls->write_meth != NULL);
5205
5206         LDKChannelPublicKeys pubkeys_conv;
5207         pubkeys_conv.inner = untag_ptr(pubkeys);
5208         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
5209         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5210
5211         LDKSign ret = {
5212                 .this_arg = (void*) calls,
5213                 .write = write_LDKSign_jcall,
5214                 .cloned = LDKSign_JCalls_cloned,
5215                 .free = LDKSign_JCalls_free,
5216                 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
5217         };
5218         calls->BaseSign = ret.BaseSign.this_arg;
5219         return ret;
5220 }
5221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5222         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
5223         *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
5224         return tag_ptr(res_ptr, true);
5225 }
5226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
5227         LDKSign *inp = (LDKSign *)untag_ptr(arg);
5228         return tag_ptr(&inp->BaseSign, false);
5229 }
5230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5231         void* this_arg_ptr = untag_ptr(this_arg);
5232         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5233         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
5234         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5235         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5236         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5237         CVec_u8Z_free(ret_var);
5238         return ret_arr;
5239 }
5240
5241 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5242 CHECK(owner->result_ok);
5243         return Sign_clone(&*owner->contents.result);
5244 }
5245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5246         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
5247         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5248         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5249         return tag_ptr(ret_ret, true);
5250 }
5251
5252 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5253         LDKDecodeError ret = *owner->contents.err;
5254         ret.is_owned = false;
5255         return ret;
5256 }
5257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5258         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
5259         LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5260         int64_t ret_ref = 0;
5261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5263         return ret_ref;
5264 }
5265
5266 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5267 CHECK(owner->result_ok);
5268         return *owner->contents.result;
5269 }
5270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5271         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
5272         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
5273         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
5274         return ret_arr;
5275 }
5276
5277 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5278 CHECK(!owner->result_ok);
5279         return *owner->contents.err;
5280 }
5281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5282         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
5283         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5284 }
5285
5286 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5287         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5288         for (size_t i = 0; i < ret.datalen; i++) {
5289                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5290         }
5291         return ret;
5292 }
5293 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5294 CHECK(owner->result_ok);
5295         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5296 }
5297 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5298         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
5299         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5300         jobjectArray ret_arr = NULL;
5301         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5302         ;
5303         for (size_t i = 0; i < ret_var.datalen; i++) {
5304                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
5305                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
5306                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
5307                 CVec_u8Z_free(ret_conv_8_var);
5308                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5309         }
5310         
5311         FREE(ret_var.data);
5312         return ret_arr;
5313 }
5314
5315 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5316 CHECK(!owner->result_ok);
5317         return *owner->contents.err;
5318 }
5319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5320         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
5321         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5322 }
5323
5324 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5325         LDKInMemorySigner ret = *owner->contents.result;
5326         ret.is_owned = false;
5327         return ret;
5328 }
5329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5330         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
5331         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5332         int64_t ret_ref = 0;
5333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5335         return ret_ref;
5336 }
5337
5338 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5339         LDKDecodeError ret = *owner->contents.err;
5340         ret.is_owned = false;
5341         return ret;
5342 }
5343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5344         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
5345         LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5346         int64_t ret_ref = 0;
5347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5349         return ret_ref;
5350 }
5351
5352 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5353         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5354         for (size_t i = 0; i < ret.datalen; i++) {
5355                 ret.data[i] = TxOut_clone(&orig->data[i]);
5356         }
5357         return ret;
5358 }
5359 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5360 CHECK(owner->result_ok);
5361         return *owner->contents.result;
5362 }
5363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5364         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
5365         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5366         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5367         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5368         return ret_arr;
5369 }
5370
5371 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5372 CHECK(!owner->result_ok);
5373         return *owner->contents.err;
5374 }
5375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5376         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
5377         CResult_TransactionNoneZ_get_err(owner_conv);
5378 }
5379
5380 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5381         return ThirtyTwoBytes_clone(&owner->a);
5382 }
5383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5384         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
5385         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5386         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
5387         return ret_arr;
5388 }
5389
5390 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5391         LDKChannelMonitor ret = owner->b;
5392         ret.is_owned = false;
5393         return ret;
5394 }
5395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5396         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
5397         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5398         int64_t ret_ref = 0;
5399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5401         return ret_ref;
5402 }
5403
5404 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
5405         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
5406         for (size_t i = 0; i < ret.datalen; i++) {
5407                 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
5408         }
5409         return ret;
5410 }
5411 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5412 CHECK(owner->result_ok);
5413         return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
5414 }
5415 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5416         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
5417         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
5418         int64_tArray ret_arr = NULL;
5419         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5420         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5421         for (size_t j = 0; j < ret_var.datalen; j++) {
5422                 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5423                 *ret_conv_35_conv = ret_var.data[j];
5424                 ret_arr_ptr[j] = tag_ptr(ret_conv_35_conv, true);
5425         }
5426         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5427         FREE(ret_var.data);
5428         return ret_arr;
5429 }
5430
5431 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5432 CHECK(!owner->result_ok);
5433         return *owner->contents.err;
5434 }
5435 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5436         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
5437         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
5438         return ret_conv;
5439 }
5440
5441 static jclass LDKCOption_u16Z_Some_class = NULL;
5442 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
5443 static jclass LDKCOption_u16Z_None_class = NULL;
5444 static jmethodID LDKCOption_u16Z_None_meth = NULL;
5445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
5446         LDKCOption_u16Z_Some_class =
5447                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
5448         CHECK(LDKCOption_u16Z_Some_class != NULL);
5449         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
5450         CHECK(LDKCOption_u16Z_Some_meth != NULL);
5451         LDKCOption_u16Z_None_class =
5452                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
5453         CHECK(LDKCOption_u16Z_None_class != NULL);
5454         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
5455         CHECK(LDKCOption_u16Z_None_meth != NULL);
5456 }
5457 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5458         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
5459         switch(obj->tag) {
5460                 case LDKCOption_u16Z_Some: {
5461                         int16_t some_conv = obj->some;
5462                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
5463                 }
5464                 case LDKCOption_u16Z_None: {
5465                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
5466                 }
5467                 default: abort();
5468         }
5469 }
5470 static jclass LDKAPIError_APIMisuseError_class = NULL;
5471 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
5472 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
5473 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
5474 static jclass LDKAPIError_RouteError_class = NULL;
5475 static jmethodID LDKAPIError_RouteError_meth = NULL;
5476 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
5477 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
5478 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
5479 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
5480 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
5481 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
5482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
5483         LDKAPIError_APIMisuseError_class =
5484                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
5485         CHECK(LDKAPIError_APIMisuseError_class != NULL);
5486         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
5487         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
5488         LDKAPIError_FeeRateTooHigh_class =
5489                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
5490         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
5491         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
5492         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
5493         LDKAPIError_RouteError_class =
5494                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
5495         CHECK(LDKAPIError_RouteError_class != NULL);
5496         LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
5497         CHECK(LDKAPIError_RouteError_meth != NULL);
5498         LDKAPIError_ChannelUnavailable_class =
5499                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
5500         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
5501         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
5502         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
5503         LDKAPIError_MonitorUpdateFailed_class =
5504                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
5505         CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
5506         LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
5507         CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
5508         LDKAPIError_IncompatibleShutdownScript_class =
5509                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
5510         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
5511         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
5512         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
5513 }
5514 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5515         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
5516         switch(obj->tag) {
5517                 case LDKAPIError_APIMisuseError: {
5518                         LDKStr err_str = obj->api_misuse_error.err;
5519                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5520                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
5521                 }
5522                 case LDKAPIError_FeeRateTooHigh: {
5523                         LDKStr err_str = obj->fee_rate_too_high.err;
5524                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5525                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
5526                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
5527                 }
5528                 case LDKAPIError_RouteError: {
5529                         LDKStr err_str = obj->route_error.err;
5530                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5531                         return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
5532                 }
5533                 case LDKAPIError_ChannelUnavailable: {
5534                         LDKStr err_str = obj->channel_unavailable.err;
5535                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5536                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
5537                 }
5538                 case LDKAPIError_MonitorUpdateFailed: {
5539                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
5540                 }
5541                 case LDKAPIError_IncompatibleShutdownScript: {
5542                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5543                         int64_t script_ref = 0;
5544                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5545                         script_ref = tag_ptr(script_var.inner, false);
5546                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
5547                 }
5548                 default: abort();
5549         }
5550 }
5551 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5552 CHECK(owner->result_ok);
5553         return *owner->contents.result;
5554 }
5555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5556         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
5557         CResult_NoneAPIErrorZ_get_ok(owner_conv);
5558 }
5559
5560 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5561 CHECK(!owner->result_ok);
5562         return APIError_clone(&*owner->contents.err);
5563 }
5564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5565         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
5566         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5567         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5568         int64_t ret_ref = tag_ptr(ret_copy, true);
5569         return ret_ref;
5570 }
5571
5572 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5573         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5574         for (size_t i = 0; i < ret.datalen; i++) {
5575                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5576         }
5577         return ret;
5578 }
5579 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5580         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5581         for (size_t i = 0; i < ret.datalen; i++) {
5582                 ret.data[i] = APIError_clone(&orig->data[i]);
5583         }
5584         return ret;
5585 }
5586 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5587 CHECK(owner->result_ok);
5588         return ThirtyTwoBytes_clone(&*owner->contents.result);
5589 }
5590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5591         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5592         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5593         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
5594         return ret_arr;
5595 }
5596
5597 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5598 CHECK(!owner->result_ok);
5599         return APIError_clone(&*owner->contents.err);
5600 }
5601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5602         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5603         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5604         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5605         int64_t ret_ref = tag_ptr(ret_copy, true);
5606         return ret_ref;
5607 }
5608
5609 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
5610 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
5611 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
5612 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
5613 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
5614 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
5615 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
5616 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
5617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
5618         LDKPaymentSendFailure_ParameterError_class =
5619                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
5620         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
5621         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
5622         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
5623         LDKPaymentSendFailure_PathParameterError_class =
5624                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
5625         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
5626         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
5627         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
5628         LDKPaymentSendFailure_AllFailedRetrySafe_class =
5629                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
5630         CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
5631         LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
5632         CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
5633         LDKPaymentSendFailure_PartialFailure_class =
5634                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
5635         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
5636         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
5637         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
5638 }
5639 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5640         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5641         switch(obj->tag) {
5642                 case LDKPaymentSendFailure_ParameterError: {
5643                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5644                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
5645                 }
5646                 case LDKPaymentSendFailure_PathParameterError: {
5647                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5648                         int64_tArray path_parameter_error_arr = NULL;
5649                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
5650                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
5651                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5652                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5653                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5654                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5655                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5656                         }
5657                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
5658                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
5659                 }
5660                 case LDKPaymentSendFailure_AllFailedRetrySafe: {
5661                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5662                         int64_tArray all_failed_retry_safe_arr = NULL;
5663                         all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
5664                         int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
5665                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5666                                 int64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
5667                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5668                         }
5669                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
5670                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
5671                 }
5672                 case LDKPaymentSendFailure_PartialFailure: {
5673                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5674                         int64_tArray results_arr = NULL;
5675                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
5676                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
5677                         for (size_t w = 0; w < results_var.datalen; w++) {
5678                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5679                                 *results_conv_22_conv = results_var.data[w];
5680                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5681                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5682                         }
5683                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
5684                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5685                         int64_t failed_paths_retry_ref = 0;
5686                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5687                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5688                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5689                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
5690                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
5691                 }
5692                 default: abort();
5693         }
5694 }
5695 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5696 CHECK(owner->result_ok);
5697         return ThirtyTwoBytes_clone(&*owner->contents.result);
5698 }
5699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5700         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
5701         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5702         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
5703         return ret_arr;
5704 }
5705
5706 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5707 CHECK(!owner->result_ok);
5708         return PaymentSendFailure_clone(&*owner->contents.err);
5709 }
5710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5711         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
5712         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5713         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5714         int64_t ret_ref = tag_ptr(ret_copy, true);
5715         return ret_ref;
5716 }
5717
5718 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5719 CHECK(owner->result_ok);
5720         return *owner->contents.result;
5721 }
5722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5723         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5724         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5725 }
5726
5727 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5728 CHECK(!owner->result_ok);
5729         return PaymentSendFailure_clone(&*owner->contents.err);
5730 }
5731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5732         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5733         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5734         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5735         int64_t ret_ref = tag_ptr(ret_copy, true);
5736         return ret_ref;
5737 }
5738
5739 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5740         return ThirtyTwoBytes_clone(&owner->a);
5741 }
5742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5743         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5744         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5745         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
5746         return ret_arr;
5747 }
5748
5749 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5750         return ThirtyTwoBytes_clone(&owner->b);
5751 }
5752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5753         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5754         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5755         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
5756         return ret_arr;
5757 }
5758
5759 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5760 CHECK(owner->result_ok);
5761         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5762 }
5763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5764         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5765         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5766         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5767         return tag_ptr(ret_conv, true);
5768 }
5769
5770 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5771 CHECK(!owner->result_ok);
5772         return PaymentSendFailure_clone(&*owner->contents.err);
5773 }
5774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5775         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5776         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5777         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5778         int64_t ret_ref = tag_ptr(ret_copy, true);
5779         return ret_ref;
5780 }
5781
5782 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
5783         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
5784         for (size_t i = 0; i < ret.datalen; i++) {
5785                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5786         }
5787         return ret;
5788 }
5789 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5790         return ThirtyTwoBytes_clone(&owner->a);
5791 }
5792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5793         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5794         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5795         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
5796         return ret_arr;
5797 }
5798
5799 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5800         return ThirtyTwoBytes_clone(&owner->b);
5801 }
5802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5803         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5804         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5805         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
5806         return ret_arr;
5807 }
5808
5809 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5810 CHECK(owner->result_ok);
5811         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5812 }
5813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5814         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5815         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5816         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5817         return tag_ptr(ret_conv, true);
5818 }
5819
5820 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5821 CHECK(!owner->result_ok);
5822         return *owner->contents.err;
5823 }
5824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5825         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5826         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5827 }
5828
5829 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5830 CHECK(owner->result_ok);
5831         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5832 }
5833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5834         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5835         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5836         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5837         return tag_ptr(ret_conv, true);
5838 }
5839
5840 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5841 CHECK(!owner->result_ok);
5842         return APIError_clone(&*owner->contents.err);
5843 }
5844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5845         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5846         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5847         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5848         int64_t ret_ref = tag_ptr(ret_copy, true);
5849         return ret_ref;
5850 }
5851
5852 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5853 CHECK(owner->result_ok);
5854         return ThirtyTwoBytes_clone(&*owner->contents.result);
5855 }
5856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5857         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5858         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5859         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
5860         return ret_arr;
5861 }
5862
5863 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5864 CHECK(!owner->result_ok);
5865         return *owner->contents.err;
5866 }
5867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5868         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5869         CResult_PaymentSecretNoneZ_get_err(owner_conv);
5870 }
5871
5872 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5873 CHECK(owner->result_ok);
5874         return ThirtyTwoBytes_clone(&*owner->contents.result);
5875 }
5876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5877         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5878         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5879         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
5880         return ret_arr;
5881 }
5882
5883 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5884 CHECK(!owner->result_ok);
5885         return APIError_clone(&*owner->contents.err);
5886 }
5887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5888         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5889         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5890         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5891         int64_t ret_ref = tag_ptr(ret_copy, true);
5892         return ret_ref;
5893 }
5894
5895 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5896 CHECK(owner->result_ok);
5897         return ThirtyTwoBytes_clone(&*owner->contents.result);
5898 }
5899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5900         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5901         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5902         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
5903         return ret_arr;
5904 }
5905
5906 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5907 CHECK(!owner->result_ok);
5908         return APIError_clone(&*owner->contents.err);
5909 }
5910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5911         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5912         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5913         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5914         int64_t ret_ref = tag_ptr(ret_copy, true);
5915         return ret_ref;
5916 }
5917
5918 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5919         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5920         ret.is_owned = false;
5921         return ret;
5922 }
5923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5924         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5925         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5926         int64_t ret_ref = 0;
5927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5929         return ret_ref;
5930 }
5931
5932 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5933         LDKDecodeError ret = *owner->contents.err;
5934         ret.is_owned = false;
5935         return ret;
5936 }
5937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5938         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5939         LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5940         int64_t ret_ref = 0;
5941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5943         return ret_ref;
5944 }
5945
5946 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5947         LDKChannelCounterparty ret = *owner->contents.result;
5948         ret.is_owned = false;
5949         return ret;
5950 }
5951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5952         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5953         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5954         int64_t ret_ref = 0;
5955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5957         return ret_ref;
5958 }
5959
5960 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5961         LDKDecodeError ret = *owner->contents.err;
5962         ret.is_owned = false;
5963         return ret;
5964 }
5965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5966         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5967         LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5968         int64_t ret_ref = 0;
5969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5971         return ret_ref;
5972 }
5973
5974 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5975         LDKChannelDetails ret = *owner->contents.result;
5976         ret.is_owned = false;
5977         return ret;
5978 }
5979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5980         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5981         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5982         int64_t ret_ref = 0;
5983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5985         return ret_ref;
5986 }
5987
5988 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5989         LDKDecodeError ret = *owner->contents.err;
5990         ret.is_owned = false;
5991         return ret;
5992 }
5993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5994         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5995         LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5996         int64_t ret_ref = 0;
5997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5999         return ret_ref;
6000 }
6001
6002 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6003         LDKPhantomRouteHints ret = *owner->contents.result;
6004         ret.is_owned = false;
6005         return ret;
6006 }
6007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6008         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6009         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6010         int64_t ret_ref = 0;
6011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6013         return ret_ref;
6014 }
6015
6016 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6017         LDKDecodeError ret = *owner->contents.err;
6018         ret.is_owned = false;
6019         return ret;
6020 }
6021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6022         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6023         LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6024         int64_t ret_ref = 0;
6025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6027         return ret_ref;
6028 }
6029
6030 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6031         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6032         for (size_t i = 0; i < ret.datalen; i++) {
6033                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6034         }
6035         return ret;
6036 }
6037 typedef struct LDKWatch_JCalls {
6038         atomic_size_t refcnt;
6039         JavaVM *vm;
6040         jweak o;
6041         jmethodID watch_channel_meth;
6042         jmethodID update_channel_meth;
6043         jmethodID release_pending_monitor_events_meth;
6044 } LDKWatch_JCalls;
6045 static void LDKWatch_JCalls_free(void* this_arg) {
6046         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6047         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6048                 JNIEnv *env;
6049                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6050                 if (get_jenv_res == JNI_EDETACHED) {
6051                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6052                 } else {
6053                         DO_ASSERT(get_jenv_res == JNI_OK);
6054                 }
6055                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6056                 if (get_jenv_res == JNI_EDETACHED) {
6057                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6058                 }
6059                 FREE(j_calls);
6060         }
6061 }
6062 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6063         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6064         JNIEnv *env;
6065         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6066         if (get_jenv_res == JNI_EDETACHED) {
6067                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6068         } else {
6069                 DO_ASSERT(get_jenv_res == JNI_OK);
6070         }
6071         LDKOutPoint funding_txo_var = funding_txo;
6072         int64_t funding_txo_ref = 0;
6073         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6074         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6075         LDKChannelMonitor monitor_var = monitor;
6076         int64_t monitor_ref = 0;
6077         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6078         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6079         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6080         CHECK(obj != NULL);
6081         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
6082         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6083                 (*env)->ExceptionDescribe(env);
6084                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
6085         }
6086         void* ret_ptr = untag_ptr(ret);
6087         CHECK_ACCESS(ret_ptr);
6088         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6089         FREE(untag_ptr(ret));
6090         if (get_jenv_res == JNI_EDETACHED) {
6091                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6092         }
6093         return ret_conv;
6094 }
6095 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6096         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6097         JNIEnv *env;
6098         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6099         if (get_jenv_res == JNI_EDETACHED) {
6100                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6101         } else {
6102                 DO_ASSERT(get_jenv_res == JNI_OK);
6103         }
6104         LDKOutPoint funding_txo_var = funding_txo;
6105         int64_t funding_txo_ref = 0;
6106         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6107         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6108         LDKChannelMonitorUpdate update_var = update;
6109         int64_t update_ref = 0;
6110         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6111         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6112         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6113         CHECK(obj != NULL);
6114         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
6115         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6116                 (*env)->ExceptionDescribe(env);
6117                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
6118         }
6119         void* ret_ptr = untag_ptr(ret);
6120         CHECK_ACCESS(ret_ptr);
6121         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6122         FREE(untag_ptr(ret));
6123         if (get_jenv_res == JNI_EDETACHED) {
6124                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6125         }
6126         return ret_conv;
6127 }
6128 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6129         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6130         JNIEnv *env;
6131         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6132         if (get_jenv_res == JNI_EDETACHED) {
6133                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6134         } else {
6135                 DO_ASSERT(get_jenv_res == JNI_OK);
6136         }
6137         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6138         CHECK(obj != NULL);
6139         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
6140         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6141                 (*env)->ExceptionDescribe(env);
6142                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
6143         }
6144         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6145         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6146         if (ret_constr.datalen > 0)
6147                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6148         else
6149                 ret_constr.data = NULL;
6150         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6151         for (size_t x = 0; x < ret_constr.datalen; x++) {
6152                 int64_t ret_conv_49 = ret_vals[x];
6153                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
6154                 CHECK_ACCESS(ret_conv_49_ptr);
6155                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6156                 FREE(untag_ptr(ret_conv_49));
6157                 ret_constr.data[x] = ret_conv_49_conv;
6158         }
6159         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6160         if (get_jenv_res == JNI_EDETACHED) {
6161                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6162         }
6163         return ret_constr;
6164 }
6165 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6166         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6167         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6168 }
6169 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
6170         jclass c = (*env)->GetObjectClass(env, o);
6171         CHECK(c != NULL);
6172         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6173         atomic_init(&calls->refcnt, 1);
6174         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6175         calls->o = (*env)->NewWeakGlobalRef(env, o);
6176         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
6177         CHECK(calls->watch_channel_meth != NULL);
6178         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
6179         CHECK(calls->update_channel_meth != NULL);
6180         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
6181         CHECK(calls->release_pending_monitor_events_meth != NULL);
6182
6183         LDKWatch ret = {
6184                 .this_arg = (void*) calls,
6185                 .watch_channel = watch_channel_LDKWatch_jcall,
6186                 .update_channel = update_channel_LDKWatch_jcall,
6187                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6188                 .free = LDKWatch_JCalls_free,
6189         };
6190         return ret;
6191 }
6192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
6193         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6194         *res_ptr = LDKWatch_init(env, clz, o);
6195         return tag_ptr(res_ptr, true);
6196 }
6197 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) {
6198         void* this_arg_ptr = untag_ptr(this_arg);
6199         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6200         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6201         LDKOutPoint funding_txo_conv;
6202         funding_txo_conv.inner = untag_ptr(funding_txo);
6203         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6204         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6205         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6206         LDKChannelMonitor monitor_conv;
6207         monitor_conv.inner = untag_ptr(monitor);
6208         monitor_conv.is_owned = ptr_is_owned(monitor);
6209         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6210         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6211         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6212         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6213         return tag_ptr(ret_conv, true);
6214 }
6215
6216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t update) {
6217         void* this_arg_ptr = untag_ptr(this_arg);
6218         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6219         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6220         LDKOutPoint funding_txo_conv;
6221         funding_txo_conv.inner = untag_ptr(funding_txo);
6222         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6223         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6224         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6225         LDKChannelMonitorUpdate update_conv;
6226         update_conv.inner = untag_ptr(update);
6227         update_conv.is_owned = ptr_is_owned(update);
6228         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6229         update_conv = ChannelMonitorUpdate_clone(&update_conv);
6230         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6231         *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6232         return tag_ptr(ret_conv, true);
6233 }
6234
6235 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6236         void* this_arg_ptr = untag_ptr(this_arg);
6237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6238         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6239         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6240         int64_tArray ret_arr = NULL;
6241         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6242         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6243         for (size_t x = 0; x < ret_var.datalen; x++) {
6244                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6245                 *ret_conv_49_conv = ret_var.data[x];
6246                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
6247         }
6248         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6249         FREE(ret_var.data);
6250         return ret_arr;
6251 }
6252
6253 typedef struct LDKBroadcasterInterface_JCalls {
6254         atomic_size_t refcnt;
6255         JavaVM *vm;
6256         jweak o;
6257         jmethodID broadcast_transaction_meth;
6258 } LDKBroadcasterInterface_JCalls;
6259 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6260         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6261         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6262                 JNIEnv *env;
6263                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6264                 if (get_jenv_res == JNI_EDETACHED) {
6265                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6266                 } else {
6267                         DO_ASSERT(get_jenv_res == JNI_OK);
6268                 }
6269                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6270                 if (get_jenv_res == JNI_EDETACHED) {
6271                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6272                 }
6273                 FREE(j_calls);
6274         }
6275 }
6276 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6277         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6278         JNIEnv *env;
6279         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6280         if (get_jenv_res == JNI_EDETACHED) {
6281                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6282         } else {
6283                 DO_ASSERT(get_jenv_res == JNI_OK);
6284         }
6285         LDKTransaction tx_var = tx;
6286         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
6287         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
6288         Transaction_free(tx_var);
6289         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6290         CHECK(obj != NULL);
6291         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
6292         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6293                 (*env)->ExceptionDescribe(env);
6294                 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
6295         }
6296         if (get_jenv_res == JNI_EDETACHED) {
6297                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6298         }
6299 }
6300 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6301         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6302         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6303 }
6304 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
6305         jclass c = (*env)->GetObjectClass(env, o);
6306         CHECK(c != NULL);
6307         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6308         atomic_init(&calls->refcnt, 1);
6309         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6310         calls->o = (*env)->NewWeakGlobalRef(env, o);
6311         calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
6312         CHECK(calls->broadcast_transaction_meth != NULL);
6313
6314         LDKBroadcasterInterface ret = {
6315                 .this_arg = (void*) calls,
6316                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6317                 .free = LDKBroadcasterInterface_JCalls_free,
6318         };
6319         return ret;
6320 }
6321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6322         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6323         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
6324         return tag_ptr(res_ptr, true);
6325 }
6326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
6327         void* this_arg_ptr = untag_ptr(this_arg);
6328         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6329         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6330         LDKTransaction tx_ref;
6331         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
6332         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6333         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
6334         tx_ref.data_is_owned = true;
6335         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6336 }
6337
6338 typedef struct LDKKeysInterface_JCalls {
6339         atomic_size_t refcnt;
6340         JavaVM *vm;
6341         jweak o;
6342         jmethodID get_node_secret_meth;
6343         jmethodID get_destination_script_meth;
6344         jmethodID get_shutdown_scriptpubkey_meth;
6345         jmethodID get_channel_signer_meth;
6346         jmethodID get_secure_random_bytes_meth;
6347         jmethodID read_chan_signer_meth;
6348         jmethodID sign_invoice_meth;
6349         jmethodID get_inbound_payment_key_material_meth;
6350 } LDKKeysInterface_JCalls;
6351 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6352         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6353         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6354                 JNIEnv *env;
6355                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6356                 if (get_jenv_res == JNI_EDETACHED) {
6357                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6358                 } else {
6359                         DO_ASSERT(get_jenv_res == JNI_OK);
6360                 }
6361                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6362                 if (get_jenv_res == JNI_EDETACHED) {
6363                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6364                 }
6365                 FREE(j_calls);
6366         }
6367 }
6368 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
6369         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6370         JNIEnv *env;
6371         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6372         if (get_jenv_res == JNI_EDETACHED) {
6373                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6374         } else {
6375                 DO_ASSERT(get_jenv_res == JNI_OK);
6376         }
6377         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
6378         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6379         CHECK(obj != NULL);
6380         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
6381         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6382                 (*env)->ExceptionDescribe(env);
6383                 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
6384         }
6385         void* ret_ptr = untag_ptr(ret);
6386         CHECK_ACCESS(ret_ptr);
6387         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
6388         FREE(untag_ptr(ret));
6389         if (get_jenv_res == JNI_EDETACHED) {
6390                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6391         }
6392         return ret_conv;
6393 }
6394 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6395         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6396         JNIEnv *env;
6397         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6398         if (get_jenv_res == JNI_EDETACHED) {
6399                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6400         } else {
6401                 DO_ASSERT(get_jenv_res == JNI_OK);
6402         }
6403         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6404         CHECK(obj != NULL);
6405         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
6406         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6407                 (*env)->ExceptionDescribe(env);
6408                 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
6409         }
6410         LDKCVec_u8Z ret_ref;
6411         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6412         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6413         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6414         if (get_jenv_res == JNI_EDETACHED) {
6415                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6416         }
6417         return ret_ref;
6418 }
6419 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6420         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6421         JNIEnv *env;
6422         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6423         if (get_jenv_res == JNI_EDETACHED) {
6424                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6425         } else {
6426                 DO_ASSERT(get_jenv_res == JNI_OK);
6427         }
6428         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6429         CHECK(obj != NULL);
6430         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
6431         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6432                 (*env)->ExceptionDescribe(env);
6433                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
6434         }
6435         LDKShutdownScript ret_conv;
6436         ret_conv.inner = untag_ptr(ret);
6437         ret_conv.is_owned = ptr_is_owned(ret);
6438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6439         if (get_jenv_res == JNI_EDETACHED) {
6440                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6441         }
6442         return ret_conv;
6443 }
6444 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6445         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6446         JNIEnv *env;
6447         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6448         if (get_jenv_res == JNI_EDETACHED) {
6449                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6450         } else {
6451                 DO_ASSERT(get_jenv_res == JNI_OK);
6452         }
6453         jboolean inbound_conv = inbound;
6454         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6455         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6456         CHECK(obj != NULL);
6457         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
6458         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6459                 (*env)->ExceptionDescribe(env);
6460                 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
6461         }
6462         void* ret_ptr = untag_ptr(ret);
6463         CHECK_ACCESS(ret_ptr);
6464         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6465         FREE(untag_ptr(ret));
6466         if (get_jenv_res == JNI_EDETACHED) {
6467                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6468         }
6469         return ret_conv;
6470 }
6471 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6472         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6473         JNIEnv *env;
6474         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6475         if (get_jenv_res == JNI_EDETACHED) {
6476                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6477         } else {
6478                 DO_ASSERT(get_jenv_res == JNI_OK);
6479         }
6480         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6481         CHECK(obj != NULL);
6482         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
6483         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6484                 (*env)->ExceptionDescribe(env);
6485                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
6486         }
6487         LDKThirtyTwoBytes ret_ref;
6488         CHECK((*env)->GetArrayLength(env, ret) == 32);
6489         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6490         if (get_jenv_res == JNI_EDETACHED) {
6491                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6492         }
6493         return ret_ref;
6494 }
6495 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6496         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6497         JNIEnv *env;
6498         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6499         if (get_jenv_res == JNI_EDETACHED) {
6500                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6501         } else {
6502                 DO_ASSERT(get_jenv_res == JNI_OK);
6503         }
6504         LDKu8slice reader_var = reader;
6505         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
6506         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
6507         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6508         CHECK(obj != NULL);
6509         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
6510         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6511                 (*env)->ExceptionDescribe(env);
6512                 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
6513         }
6514         void* ret_ptr = untag_ptr(ret);
6515         CHECK_ACCESS(ret_ptr);
6516         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6517         FREE(untag_ptr(ret));
6518         if (get_jenv_res == JNI_EDETACHED) {
6519                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6520         }
6521         return ret_conv;
6522 }
6523 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
6524         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6525         JNIEnv *env;
6526         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6527         if (get_jenv_res == JNI_EDETACHED) {
6528                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6529         } else {
6530                 DO_ASSERT(get_jenv_res == JNI_OK);
6531         }
6532         LDKu8slice hrp_bytes_var = hrp_bytes;
6533         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
6534         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
6535         LDKCVec_u5Z invoice_data_var = invoice_data;
6536         jobjectArray invoice_data_arr = NULL;
6537         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
6538         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
6539         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6540                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6541                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6542         }
6543         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
6544         FREE(invoice_data_var.data);
6545         jclass receipient_conv = LDKRecipient_to_java(env, receipient);
6546         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6547         CHECK(obj != NULL);
6548         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
6549         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6550                 (*env)->ExceptionDescribe(env);
6551                 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
6552         }
6553         void* ret_ptr = untag_ptr(ret);
6554         CHECK_ACCESS(ret_ptr);
6555         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6556         FREE(untag_ptr(ret));
6557         if (get_jenv_res == JNI_EDETACHED) {
6558                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6559         }
6560         return ret_conv;
6561 }
6562 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6563         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6564         JNIEnv *env;
6565         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6566         if (get_jenv_res == JNI_EDETACHED) {
6567                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6568         } else {
6569                 DO_ASSERT(get_jenv_res == JNI_OK);
6570         }
6571         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6572         CHECK(obj != NULL);
6573         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
6574         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6575                 (*env)->ExceptionDescribe(env);
6576                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
6577         }
6578         LDKThirtyTwoBytes ret_ref;
6579         CHECK((*env)->GetArrayLength(env, ret) == 32);
6580         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6581         if (get_jenv_res == JNI_EDETACHED) {
6582                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6583         }
6584         return ret_ref;
6585 }
6586 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6587         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6588         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6589 }
6590 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
6591         jclass c = (*env)->GetObjectClass(env, o);
6592         CHECK(c != NULL);
6593         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6594         atomic_init(&calls->refcnt, 1);
6595         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6596         calls->o = (*env)->NewWeakGlobalRef(env, o);
6597         calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
6598         CHECK(calls->get_node_secret_meth != NULL);
6599         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
6600         CHECK(calls->get_destination_script_meth != NULL);
6601         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
6602         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
6603         calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
6604         CHECK(calls->get_channel_signer_meth != NULL);
6605         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
6606         CHECK(calls->get_secure_random_bytes_meth != NULL);
6607         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
6608         CHECK(calls->read_chan_signer_meth != NULL);
6609         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
6610         CHECK(calls->sign_invoice_meth != NULL);
6611         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
6612         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
6613
6614         LDKKeysInterface ret = {
6615                 .this_arg = (void*) calls,
6616                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6617                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6618                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6619                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6620                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6621                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6622                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6623                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6624                 .free = LDKKeysInterface_JCalls_free,
6625         };
6626         return ret;
6627 }
6628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6629         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6630         *res_ptr = LDKKeysInterface_init(env, clz, o);
6631         return tag_ptr(res_ptr, true);
6632 }
6633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
6634         void* this_arg_ptr = untag_ptr(this_arg);
6635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6636         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6637         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
6638         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
6639         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
6640         return tag_ptr(ret_conv, true);
6641 }
6642
6643 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
6644         void* this_arg_ptr = untag_ptr(this_arg);
6645         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6646         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6647         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6648         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6649         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6650         CVec_u8Z_free(ret_var);
6651         return ret_arr;
6652 }
6653
6654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6655         void* this_arg_ptr = untag_ptr(this_arg);
6656         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6657         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6658         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6659         int64_t ret_ref = 0;
6660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6662         return ret_ref;
6663 }
6664
6665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
6666         void* this_arg_ptr = untag_ptr(this_arg);
6667         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6668         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6669         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6670         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6671         return tag_ptr(ret_ret, true);
6672 }
6673
6674 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6675         void* this_arg_ptr = untag_ptr(this_arg);
6676         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6677         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6678         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6679         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6680         return ret_arr;
6681 }
6682
6683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6684         void* this_arg_ptr = untag_ptr(this_arg);
6685         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6686         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6687         LDKu8slice reader_ref;
6688         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6689         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6690         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6691         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6692         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6693         return tag_ptr(ret_conv, true);
6694 }
6695
6696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass receipient) {
6697         void* this_arg_ptr = untag_ptr(this_arg);
6698         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6699         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6700         LDKu8slice hrp_bytes_ref;
6701         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6702         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6703         LDKCVec_u5Z invoice_data_constr;
6704         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6705         if (invoice_data_constr.datalen > 0)
6706                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6707         else
6708                 invoice_data_constr.data = NULL;
6709         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6710         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6711                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6712                 
6713                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6714         }
6715         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6716         LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6717         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6718         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6719         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6720         return tag_ptr(ret_conv, true);
6721 }
6722
6723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6724         void* this_arg_ptr = untag_ptr(this_arg);
6725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6726         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6727         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6728         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
6729         return ret_arr;
6730 }
6731
6732 typedef struct LDKFeeEstimator_JCalls {
6733         atomic_size_t refcnt;
6734         JavaVM *vm;
6735         jweak o;
6736         jmethodID get_est_sat_per_1000_weight_meth;
6737 } LDKFeeEstimator_JCalls;
6738 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6739         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6740         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6741                 JNIEnv *env;
6742                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6743                 if (get_jenv_res == JNI_EDETACHED) {
6744                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6745                 } else {
6746                         DO_ASSERT(get_jenv_res == JNI_OK);
6747                 }
6748                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6749                 if (get_jenv_res == JNI_EDETACHED) {
6750                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6751                 }
6752                 FREE(j_calls);
6753         }
6754 }
6755 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6756         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6757         JNIEnv *env;
6758         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6759         if (get_jenv_res == JNI_EDETACHED) {
6760                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6761         } else {
6762                 DO_ASSERT(get_jenv_res == JNI_OK);
6763         }
6764         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
6765         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6766         CHECK(obj != NULL);
6767         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
6768         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6769                 (*env)->ExceptionDescribe(env);
6770                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
6771         }
6772         if (get_jenv_res == JNI_EDETACHED) {
6773                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6774         }
6775         return ret;
6776 }
6777 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6778         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6779         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6780 }
6781 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
6782         jclass c = (*env)->GetObjectClass(env, o);
6783         CHECK(c != NULL);
6784         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6785         atomic_init(&calls->refcnt, 1);
6786         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6787         calls->o = (*env)->NewWeakGlobalRef(env, o);
6788         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
6789         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
6790
6791         LDKFeeEstimator ret = {
6792                 .this_arg = (void*) calls,
6793                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6794                 .free = LDKFeeEstimator_JCalls_free,
6795         };
6796         return ret;
6797 }
6798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
6799         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6800         *res_ptr = LDKFeeEstimator_init(env, clz, o);
6801         return tag_ptr(res_ptr, true);
6802 }
6803 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) {
6804         void* this_arg_ptr = untag_ptr(this_arg);
6805         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6806         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6807         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
6808         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6809         return ret_conv;
6810 }
6811
6812 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6813         return ThirtyTwoBytes_clone(&owner->a);
6814 }
6815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6816         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6817         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6818         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
6819         return ret_arr;
6820 }
6821
6822 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6823         LDKChannelManager ret = owner->b;
6824         ret.is_owned = false;
6825         return ret;
6826 }
6827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6828         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6829         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6830         int64_t ret_ref = 0;
6831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6833         return ret_ref;
6834 }
6835
6836 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6837 CHECK(owner->result_ok);
6838         return &*owner->contents.result;
6839 }
6840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6841         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6842         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6843         return ret_ret;
6844 }
6845
6846 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6847         LDKDecodeError ret = *owner->contents.err;
6848         ret.is_owned = false;
6849         return ret;
6850 }
6851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6852         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6853         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6854         int64_t ret_ref = 0;
6855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6857         return ret_ref;
6858 }
6859
6860 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6861         LDKChannelConfig ret = *owner->contents.result;
6862         ret.is_owned = false;
6863         return ret;
6864 }
6865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6866         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6867         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6868         int64_t ret_ref = 0;
6869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6871         return ret_ref;
6872 }
6873
6874 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6875         LDKDecodeError ret = *owner->contents.err;
6876         ret.is_owned = false;
6877         return ret;
6878 }
6879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6880         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6881         LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6882         int64_t ret_ref = 0;
6883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6885         return ret_ref;
6886 }
6887
6888 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6889         LDKOutPoint ret = *owner->contents.result;
6890         ret.is_owned = false;
6891         return ret;
6892 }
6893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6894         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6895         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6896         int64_t ret_ref = 0;
6897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6899         return ret_ref;
6900 }
6901
6902 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6903         LDKDecodeError ret = *owner->contents.err;
6904         ret.is_owned = false;
6905         return ret;
6906 }
6907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6908         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6909         LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6910         int64_t ret_ref = 0;
6911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6913         return ret_ref;
6914 }
6915
6916 typedef struct LDKType_JCalls {
6917         atomic_size_t refcnt;
6918         JavaVM *vm;
6919         jweak o;
6920         jmethodID type_id_meth;
6921         jmethodID debug_str_meth;
6922         jmethodID write_meth;
6923 } LDKType_JCalls;
6924 static void LDKType_JCalls_free(void* this_arg) {
6925         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6926         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6927                 JNIEnv *env;
6928                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6929                 if (get_jenv_res == JNI_EDETACHED) {
6930                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6931                 } else {
6932                         DO_ASSERT(get_jenv_res == JNI_OK);
6933                 }
6934                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6935                 if (get_jenv_res == JNI_EDETACHED) {
6936                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6937                 }
6938                 FREE(j_calls);
6939         }
6940 }
6941 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6942         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6943         JNIEnv *env;
6944         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6945         if (get_jenv_res == JNI_EDETACHED) {
6946                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6947         } else {
6948                 DO_ASSERT(get_jenv_res == JNI_OK);
6949         }
6950         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6951         CHECK(obj != NULL);
6952         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
6953         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6954                 (*env)->ExceptionDescribe(env);
6955                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
6956         }
6957         if (get_jenv_res == JNI_EDETACHED) {
6958                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6959         }
6960         return ret;
6961 }
6962 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6963         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6964         JNIEnv *env;
6965         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6966         if (get_jenv_res == JNI_EDETACHED) {
6967                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6968         } else {
6969                 DO_ASSERT(get_jenv_res == JNI_OK);
6970         }
6971         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6972         CHECK(obj != NULL);
6973         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
6974         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6975                 (*env)->ExceptionDescribe(env);
6976                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
6977         }
6978         LDKStr ret_conv = java_to_owned_str(env, ret);
6979         if (get_jenv_res == JNI_EDETACHED) {
6980                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6981         }
6982         return ret_conv;
6983 }
6984 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6985         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6986         JNIEnv *env;
6987         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6988         if (get_jenv_res == JNI_EDETACHED) {
6989                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6990         } else {
6991                 DO_ASSERT(get_jenv_res == JNI_OK);
6992         }
6993         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6994         CHECK(obj != NULL);
6995         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
6996         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6997                 (*env)->ExceptionDescribe(env);
6998                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
6999         }
7000         LDKCVec_u8Z ret_ref;
7001         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
7002         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7003         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
7004         if (get_jenv_res == JNI_EDETACHED) {
7005                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7006         }
7007         return ret_ref;
7008 }
7009 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7010         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7011         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7012 }
7013 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
7014         jclass c = (*env)->GetObjectClass(env, o);
7015         CHECK(c != NULL);
7016         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7017         atomic_init(&calls->refcnt, 1);
7018         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7019         calls->o = (*env)->NewWeakGlobalRef(env, o);
7020         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
7021         CHECK(calls->type_id_meth != NULL);
7022         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
7023         CHECK(calls->debug_str_meth != NULL);
7024         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
7025         CHECK(calls->write_meth != NULL);
7026
7027         LDKType ret = {
7028                 .this_arg = (void*) calls,
7029                 .type_id = type_id_LDKType_jcall,
7030                 .debug_str = debug_str_LDKType_jcall,
7031                 .write = write_LDKType_jcall,
7032                 .cloned = LDKType_JCalls_cloned,
7033                 .free = LDKType_JCalls_free,
7034         };
7035         return ret;
7036 }
7037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
7038         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7039         *res_ptr = LDKType_init(env, clz, o);
7040         return tag_ptr(res_ptr, true);
7041 }
7042 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
7043         void* this_arg_ptr = untag_ptr(this_arg);
7044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7045         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7046         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7047         return ret_conv;
7048 }
7049
7050 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
7051         void* this_arg_ptr = untag_ptr(this_arg);
7052         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7053         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7054         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7055         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7056         Str_free(ret_str);
7057         return ret_conv;
7058 }
7059
7060 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
7061         void* this_arg_ptr = untag_ptr(this_arg);
7062         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7063         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7064         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7065         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7066         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7067         CVec_u8Z_free(ret_var);
7068         return ret_arr;
7069 }
7070
7071 static jclass LDKCOption_TypeZ_Some_class = NULL;
7072 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
7073 static jclass LDKCOption_TypeZ_None_class = NULL;
7074 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
7075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
7076         LDKCOption_TypeZ_Some_class =
7077                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
7078         CHECK(LDKCOption_TypeZ_Some_class != NULL);
7079         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
7080         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
7081         LDKCOption_TypeZ_None_class =
7082                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
7083         CHECK(LDKCOption_TypeZ_None_class != NULL);
7084         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
7085         CHECK(LDKCOption_TypeZ_None_meth != NULL);
7086 }
7087 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7088         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7089         switch(obj->tag) {
7090                 case LDKCOption_TypeZ_Some: {
7091                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7092                         *some_ret = Type_clone(&obj->some);
7093                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
7094                 }
7095                 case LDKCOption_TypeZ_None: {
7096                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
7097                 }
7098                 default: abort();
7099         }
7100 }
7101 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7102 CHECK(owner->result_ok);
7103         return COption_TypeZ_clone(&*owner->contents.result);
7104 }
7105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7106         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7107         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7108         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7109         int64_t ret_ref = tag_ptr(ret_copy, true);
7110         return ret_ref;
7111 }
7112
7113 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7114         LDKDecodeError ret = *owner->contents.err;
7115         ret.is_owned = false;
7116         return ret;
7117 }
7118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7119         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7120         LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7121         int64_t ret_ref = 0;
7122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7124         return ret_ref;
7125 }
7126
7127 static jclass LDKPaymentError_Invoice_class = NULL;
7128 static jmethodID LDKPaymentError_Invoice_meth = NULL;
7129 static jclass LDKPaymentError_Routing_class = NULL;
7130 static jmethodID LDKPaymentError_Routing_meth = NULL;
7131 static jclass LDKPaymentError_Sending_class = NULL;
7132 static jmethodID LDKPaymentError_Sending_meth = NULL;
7133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
7134         LDKPaymentError_Invoice_class =
7135                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
7136         CHECK(LDKPaymentError_Invoice_class != NULL);
7137         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
7138         CHECK(LDKPaymentError_Invoice_meth != NULL);
7139         LDKPaymentError_Routing_class =
7140                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
7141         CHECK(LDKPaymentError_Routing_class != NULL);
7142         LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
7143         CHECK(LDKPaymentError_Routing_meth != NULL);
7144         LDKPaymentError_Sending_class =
7145                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
7146         CHECK(LDKPaymentError_Sending_class != NULL);
7147         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
7148         CHECK(LDKPaymentError_Sending_meth != NULL);
7149 }
7150 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7151         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7152         switch(obj->tag) {
7153                 case LDKPaymentError_Invoice: {
7154                         LDKStr invoice_str = obj->invoice;
7155                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
7156                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
7157                 }
7158                 case LDKPaymentError_Routing: {
7159                         LDKLightningError routing_var = obj->routing;
7160                         int64_t routing_ref = 0;
7161                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
7162                         routing_ref = tag_ptr(routing_var.inner, false);
7163                         return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
7164                 }
7165                 case LDKPaymentError_Sending: {
7166                         int64_t sending_ref = tag_ptr(&obj->sending, false);
7167                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
7168                 }
7169                 default: abort();
7170         }
7171 }
7172 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7173 CHECK(owner->result_ok);
7174         return ThirtyTwoBytes_clone(&*owner->contents.result);
7175 }
7176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7177         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7178         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7179         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
7180         return ret_arr;
7181 }
7182
7183 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7184 CHECK(!owner->result_ok);
7185         return PaymentError_clone(&*owner->contents.err);
7186 }
7187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7188         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7189         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7190         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7191         int64_t ret_ref = tag_ptr(ret_copy, true);
7192         return ret_ref;
7193 }
7194
7195 static jclass LDKParseError_Bech32Error_class = NULL;
7196 static jmethodID LDKParseError_Bech32Error_meth = NULL;
7197 static jclass LDKParseError_ParseAmountError_class = NULL;
7198 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
7199 static jclass LDKParseError_MalformedSignature_class = NULL;
7200 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
7201 static jclass LDKParseError_BadPrefix_class = NULL;
7202 static jmethodID LDKParseError_BadPrefix_meth = NULL;
7203 static jclass LDKParseError_UnknownCurrency_class = NULL;
7204 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
7205 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
7206 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
7207 static jclass LDKParseError_MalformedHRP_class = NULL;
7208 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
7209 static jclass LDKParseError_TooShortDataPart_class = NULL;
7210 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
7211 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
7212 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
7213 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
7214 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
7215 static jclass LDKParseError_PaddingError_class = NULL;
7216 static jmethodID LDKParseError_PaddingError_meth = NULL;
7217 static jclass LDKParseError_IntegerOverflowError_class = NULL;
7218 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
7219 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
7220 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
7221 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
7222 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
7223 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
7224 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
7225 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
7226 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
7227 static jclass LDKParseError_InvalidSliceLength_class = NULL;
7228 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
7229 static jclass LDKParseError_Skip_class = NULL;
7230 static jmethodID LDKParseError_Skip_meth = NULL;
7231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
7232         LDKParseError_Bech32Error_class =
7233                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
7234         CHECK(LDKParseError_Bech32Error_class != NULL);
7235         LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
7236         CHECK(LDKParseError_Bech32Error_meth != NULL);
7237         LDKParseError_ParseAmountError_class =
7238                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
7239         CHECK(LDKParseError_ParseAmountError_class != NULL);
7240         LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
7241         CHECK(LDKParseError_ParseAmountError_meth != NULL);
7242         LDKParseError_MalformedSignature_class =
7243                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
7244         CHECK(LDKParseError_MalformedSignature_class != NULL);
7245         LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
7246         CHECK(LDKParseError_MalformedSignature_meth != NULL);
7247         LDKParseError_BadPrefix_class =
7248                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
7249         CHECK(LDKParseError_BadPrefix_class != NULL);
7250         LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
7251         CHECK(LDKParseError_BadPrefix_meth != NULL);
7252         LDKParseError_UnknownCurrency_class =
7253                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
7254         CHECK(LDKParseError_UnknownCurrency_class != NULL);
7255         LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
7256         CHECK(LDKParseError_UnknownCurrency_meth != NULL);
7257         LDKParseError_UnknownSiPrefix_class =
7258                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
7259         CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
7260         LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
7261         CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
7262         LDKParseError_MalformedHRP_class =
7263                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
7264         CHECK(LDKParseError_MalformedHRP_class != NULL);
7265         LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
7266         CHECK(LDKParseError_MalformedHRP_meth != NULL);
7267         LDKParseError_TooShortDataPart_class =
7268                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
7269         CHECK(LDKParseError_TooShortDataPart_class != NULL);
7270         LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
7271         CHECK(LDKParseError_TooShortDataPart_meth != NULL);
7272         LDKParseError_UnexpectedEndOfTaggedFields_class =
7273                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
7274         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
7275         LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
7276         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
7277         LDKParseError_DescriptionDecodeError_class =
7278                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
7279         CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
7280         LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
7281         CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
7282         LDKParseError_PaddingError_class =
7283                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
7284         CHECK(LDKParseError_PaddingError_class != NULL);
7285         LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
7286         CHECK(LDKParseError_PaddingError_meth != NULL);
7287         LDKParseError_IntegerOverflowError_class =
7288                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
7289         CHECK(LDKParseError_IntegerOverflowError_class != NULL);
7290         LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
7291         CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
7292         LDKParseError_InvalidSegWitProgramLength_class =
7293                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
7294         CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
7295         LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
7296         CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
7297         LDKParseError_InvalidPubKeyHashLength_class =
7298                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
7299         CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
7300         LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
7301         CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
7302         LDKParseError_InvalidScriptHashLength_class =
7303                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
7304         CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
7305         LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
7306         CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
7307         LDKParseError_InvalidRecoveryId_class =
7308                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
7309         CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
7310         LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
7311         CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
7312         LDKParseError_InvalidSliceLength_class =
7313                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
7314         CHECK(LDKParseError_InvalidSliceLength_class != NULL);
7315         LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
7316         CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
7317         LDKParseError_Skip_class =
7318                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
7319         CHECK(LDKParseError_Skip_class != NULL);
7320         LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
7321         CHECK(LDKParseError_Skip_meth != NULL);
7322 }
7323 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7324         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7325         switch(obj->tag) {
7326                 case LDKParseError_Bech32Error: {
7327                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
7328                         return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
7329                 }
7330                 case LDKParseError_ParseAmountError: {
7331                         /*obj->parse_amount_error*/
7332                         return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
7333                 }
7334                 case LDKParseError_MalformedSignature: {
7335                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
7336                         return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
7337                 }
7338                 case LDKParseError_BadPrefix: {
7339                         return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
7340                 }
7341                 case LDKParseError_UnknownCurrency: {
7342                         return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
7343                 }
7344                 case LDKParseError_UnknownSiPrefix: {
7345                         return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
7346                 }
7347                 case LDKParseError_MalformedHRP: {
7348                         return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
7349                 }
7350                 case LDKParseError_TooShortDataPart: {
7351                         return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
7352                 }
7353                 case LDKParseError_UnexpectedEndOfTaggedFields: {
7354                         return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
7355                 }
7356                 case LDKParseError_DescriptionDecodeError: {
7357                         /*obj->description_decode_error*/
7358                         return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
7359                 }
7360                 case LDKParseError_PaddingError: {
7361                         return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
7362                 }
7363                 case LDKParseError_IntegerOverflowError: {
7364                         return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
7365                 }
7366                 case LDKParseError_InvalidSegWitProgramLength: {
7367                         return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
7368                 }
7369                 case LDKParseError_InvalidPubKeyHashLength: {
7370                         return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
7371                 }
7372                 case LDKParseError_InvalidScriptHashLength: {
7373                         return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
7374                 }
7375                 case LDKParseError_InvalidRecoveryId: {
7376                         return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
7377                 }
7378                 case LDKParseError_InvalidSliceLength: {
7379                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7380                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
7381                         return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
7382                 }
7383                 case LDKParseError_Skip: {
7384                         return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
7385                 }
7386                 default: abort();
7387         }
7388 }
7389 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7390 CHECK(owner->result_ok);
7391         return SiPrefix_clone(&*owner->contents.result);
7392 }
7393 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7394         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7395         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7396         return ret_conv;
7397 }
7398
7399 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7400 CHECK(!owner->result_ok);
7401         return ParseError_clone(&*owner->contents.err);
7402 }
7403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7404         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7405         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7406         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7407         int64_t ret_ref = tag_ptr(ret_copy, true);
7408         return ret_ref;
7409 }
7410
7411 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
7412 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
7413 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
7414 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
7415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
7416         LDKParseOrSemanticError_ParseError_class =
7417                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
7418         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
7419         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
7420         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
7421         LDKParseOrSemanticError_SemanticError_class =
7422                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
7423         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
7424         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
7425         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
7426 }
7427 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7428         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7429         switch(obj->tag) {
7430                 case LDKParseOrSemanticError_ParseError: {
7431                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
7432                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
7433                 }
7434                 case LDKParseOrSemanticError_SemanticError: {
7435                         jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
7436                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
7437                 }
7438                 default: abort();
7439         }
7440 }
7441 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7442         LDKInvoice ret = *owner->contents.result;
7443         ret.is_owned = false;
7444         return ret;
7445 }
7446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7447         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7448         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7449         int64_t ret_ref = 0;
7450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7452         return ret_ref;
7453 }
7454
7455 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7456 CHECK(!owner->result_ok);
7457         return ParseOrSemanticError_clone(&*owner->contents.err);
7458 }
7459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7460         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7461         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7462         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7463         int64_t ret_ref = tag_ptr(ret_copy, true);
7464         return ret_ref;
7465 }
7466
7467 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7468         LDKSignedRawInvoice ret = *owner->contents.result;
7469         ret.is_owned = false;
7470         return ret;
7471 }
7472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7473         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7474         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7475         int64_t ret_ref = 0;
7476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7478         return ret_ref;
7479 }
7480
7481 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7482 CHECK(!owner->result_ok);
7483         return ParseError_clone(&*owner->contents.err);
7484 }
7485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7486         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7487         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7488         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7489         int64_t ret_ref = tag_ptr(ret_copy, true);
7490         return ret_ref;
7491 }
7492
7493 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7494         LDKRawInvoice ret = owner->a;
7495         ret.is_owned = false;
7496         return ret;
7497 }
7498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7499         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7500         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7501         int64_t ret_ref = 0;
7502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7504         return ret_ref;
7505 }
7506
7507 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7508         return ThirtyTwoBytes_clone(&owner->b);
7509 }
7510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7511         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7512         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7513         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
7514         return ret_arr;
7515 }
7516
7517 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7518         LDKInvoiceSignature ret = owner->c;
7519         ret.is_owned = false;
7520         return ret;
7521 }
7522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7523         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7524         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7525         int64_t ret_ref = 0;
7526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7528         return ret_ref;
7529 }
7530
7531 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7532         LDKPayeePubKey ret = *owner->contents.result;
7533         ret.is_owned = false;
7534         return ret;
7535 }
7536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7537         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7538         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7539         int64_t ret_ref = 0;
7540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7542         return ret_ref;
7543 }
7544
7545 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7546 CHECK(!owner->result_ok);
7547         return *owner->contents.err;
7548 }
7549 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7550         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7551         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7552         return ret_conv;
7553 }
7554
7555 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7556         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7557         for (size_t i = 0; i < ret.datalen; i++) {
7558                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7559         }
7560         return ret;
7561 }
7562 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7563         LDKPositiveTimestamp ret = *owner->contents.result;
7564         ret.is_owned = false;
7565         return ret;
7566 }
7567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7568         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7569         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
7570         int64_t ret_ref = 0;
7571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7573         return ret_ref;
7574 }
7575
7576 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7577 CHECK(!owner->result_ok);
7578         return CreationError_clone(&*owner->contents.err);
7579 }
7580 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7581         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7582         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7583         return ret_conv;
7584 }
7585
7586 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7587 CHECK(owner->result_ok);
7588         return *owner->contents.result;
7589 }
7590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7591         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7592         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7593 }
7594
7595 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7596 CHECK(!owner->result_ok);
7597         return SemanticError_clone(&*owner->contents.err);
7598 }
7599 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7600         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7601         jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
7602         return ret_conv;
7603 }
7604
7605 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7606         LDKInvoice ret = *owner->contents.result;
7607         ret.is_owned = false;
7608         return ret;
7609 }
7610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7611         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7612         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7613         int64_t ret_ref = 0;
7614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7616         return ret_ref;
7617 }
7618
7619 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7620 CHECK(!owner->result_ok);
7621         return SemanticError_clone(&*owner->contents.err);
7622 }
7623 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7624         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7625         jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7626         return ret_conv;
7627 }
7628
7629 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7630         LDKDescription ret = *owner->contents.result;
7631         ret.is_owned = false;
7632         return ret;
7633 }
7634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7635         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7636         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7637         int64_t ret_ref = 0;
7638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7640         return ret_ref;
7641 }
7642
7643 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7644 CHECK(!owner->result_ok);
7645         return CreationError_clone(&*owner->contents.err);
7646 }
7647 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7648         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7649         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7650         return ret_conv;
7651 }
7652
7653 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7654         LDKPrivateRoute ret = *owner->contents.result;
7655         ret.is_owned = false;
7656         return ret;
7657 }
7658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7659         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7660         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7661         int64_t ret_ref = 0;
7662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7664         return ret_ref;
7665 }
7666
7667 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7668 CHECK(!owner->result_ok);
7669         return CreationError_clone(&*owner->contents.err);
7670 }
7671 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7672         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7673         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7674         return ret_conv;
7675 }
7676
7677 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7678 CHECK(owner->result_ok);
7679         return *owner->contents.result;
7680 }
7681 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7682         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7683         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7684         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7685         return ret_conv;
7686 }
7687
7688 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7689 CHECK(!owner->result_ok);
7690         return *owner->contents.err;
7691 }
7692 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7693         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7694         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
7695         return ret_conv;
7696 }
7697
7698 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7699         LDKChannelMonitorUpdate ret = *owner->contents.result;
7700         ret.is_owned = false;
7701         return ret;
7702 }
7703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7704         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7705         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7706         int64_t ret_ref = 0;
7707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7709         return ret_ref;
7710 }
7711
7712 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7713         LDKDecodeError ret = *owner->contents.err;
7714         ret.is_owned = false;
7715         return ret;
7716 }
7717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7718         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7719         LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7720         int64_t ret_ref = 0;
7721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7723         return ret_ref;
7724 }
7725
7726 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
7727 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
7728 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
7729 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
7730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
7731         LDKCOption_MonitorEventZ_Some_class =
7732                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
7733         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
7734         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
7735         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
7736         LDKCOption_MonitorEventZ_None_class =
7737                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
7738         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
7739         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
7740         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
7741 }
7742 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7743         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7744         switch(obj->tag) {
7745                 case LDKCOption_MonitorEventZ_Some: {
7746                         int64_t some_ref = tag_ptr(&obj->some, false);
7747                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
7748                 }
7749                 case LDKCOption_MonitorEventZ_None: {
7750                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
7751                 }
7752                 default: abort();
7753         }
7754 }
7755 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7756 CHECK(owner->result_ok);
7757         return COption_MonitorEventZ_clone(&*owner->contents.result);
7758 }
7759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7760         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7761         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7762         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7763         int64_t ret_ref = tag_ptr(ret_copy, true);
7764         return ret_ref;
7765 }
7766
7767 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7768         LDKDecodeError ret = *owner->contents.err;
7769         ret.is_owned = false;
7770         return ret;
7771 }
7772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7773         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7774         LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7775         int64_t ret_ref = 0;
7776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7778         return ret_ref;
7779 }
7780
7781 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7782         LDKHTLCUpdate ret = *owner->contents.result;
7783         ret.is_owned = false;
7784         return ret;
7785 }
7786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7787         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7788         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7789         int64_t ret_ref = 0;
7790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7792         return ret_ref;
7793 }
7794
7795 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7796         LDKDecodeError ret = *owner->contents.err;
7797         ret.is_owned = false;
7798         return ret;
7799 }
7800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7801         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7802         LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7803         int64_t ret_ref = 0;
7804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7806         return ret_ref;
7807 }
7808
7809 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7810         LDKOutPoint ret = owner->a;
7811         ret.is_owned = false;
7812         return ret;
7813 }
7814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7815         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7816         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7817         int64_t ret_ref = 0;
7818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7820         return ret_ref;
7821 }
7822
7823 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7824         return CVec_u8Z_clone(&owner->b);
7825 }
7826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7827         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7828         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7829         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7830         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7831         CVec_u8Z_free(ret_var);
7832         return ret_arr;
7833 }
7834
7835 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7836         return owner->a;
7837 }
7838 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7839         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7840         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
7841         return ret_conv;
7842 }
7843
7844 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7845         return CVec_u8Z_clone(&owner->b);
7846 }
7847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7848         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7849         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7850         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7851         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7852         CVec_u8Z_free(ret_var);
7853         return ret_arr;
7854 }
7855
7856 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7857         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7858         for (size_t i = 0; i < ret.datalen; i++) {
7859                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7860         }
7861         return ret;
7862 }
7863 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7864         return ThirtyTwoBytes_clone(&owner->a);
7865 }
7866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7867         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7868         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7869         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
7870         return ret_arr;
7871 }
7872
7873 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7874         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7875 }
7876 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7877         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7878         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7879         int64_tArray ret_arr = NULL;
7880         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7881         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7882         for (size_t v = 0; v < ret_var.datalen; v++) {
7883                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7884                 *ret_conv_21_conv = ret_var.data[v];
7885                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
7886         }
7887         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7888         FREE(ret_var.data);
7889         return ret_arr;
7890 }
7891
7892 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
7893         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
7894         for (size_t i = 0; i < ret.datalen; i++) {
7895                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
7896         }
7897         return ret;
7898 }
7899 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
7900         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
7901         for (size_t i = 0; i < ret.datalen; i++) {
7902                 ret.data[i] = Event_clone(&orig->data[i]);
7903         }
7904         return ret;
7905 }
7906 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7907         return owner->a;
7908 }
7909 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7910         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7911         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7912         return ret_conv;
7913 }
7914
7915 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7916         return TxOut_clone(&owner->b);
7917 }
7918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7919         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7920         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7921         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7922         return tag_ptr(ret_ref, true);
7923 }
7924
7925 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7926         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7927         for (size_t i = 0; i < ret.datalen; i++) {
7928                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7929         }
7930         return ret;
7931 }
7932 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7933         return ThirtyTwoBytes_clone(&owner->a);
7934 }
7935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7936         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7937         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7938         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
7939         return ret_arr;
7940 }
7941
7942 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7943         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7944 }
7945 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7946         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7947         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7948         int64_tArray ret_arr = NULL;
7949         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7950         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7951         for (size_t u = 0; u < ret_var.datalen; u++) {
7952                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7953                 *ret_conv_20_conv = ret_var.data[u];
7954                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7955         }
7956         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7957         FREE(ret_var.data);
7958         return ret_arr;
7959 }
7960
7961 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
7962         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
7963         for (size_t i = 0; i < ret.datalen; i++) {
7964                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7965         }
7966         return ret;
7967 }
7968 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
7969 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
7970 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
7971 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
7972 static jclass LDKBalance_ContentiousClaimable_class = NULL;
7973 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
7974 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
7975 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
7976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
7977         LDKBalance_ClaimableOnChannelClose_class =
7978                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
7979         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
7980         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
7981         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
7982         LDKBalance_ClaimableAwaitingConfirmations_class =
7983                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
7984         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
7985         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
7986         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
7987         LDKBalance_ContentiousClaimable_class =
7988                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
7989         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
7990         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
7991         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
7992         LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
7993                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
7994         CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
7995         LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
7996         CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
7997 }
7998 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7999         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8000         switch(obj->tag) {
8001                 case LDKBalance_ClaimableOnChannelClose: {
8002                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
8003                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
8004                 }
8005                 case LDKBalance_ClaimableAwaitingConfirmations: {
8006                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
8007                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8008                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
8009                 }
8010                 case LDKBalance_ContentiousClaimable: {
8011                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
8012                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8013                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
8014                 }
8015                 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
8016                         int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
8017                         int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
8018                         return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, claimable_amount_satoshis_conv, claimable_height_conv);
8019                 }
8020                 default: abort();
8021         }
8022 }
8023 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8024         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8025         for (size_t i = 0; i < ret.datalen; i++) {
8026                 ret.data[i] = Balance_clone(&orig->data[i]);
8027         }
8028         return ret;
8029 }
8030 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8031 CHECK(owner->result_ok);
8032         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8033 }
8034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8035         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8036         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8037         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8038         return tag_ptr(ret_conv, true);
8039 }
8040
8041 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8042         LDKDecodeError ret = *owner->contents.err;
8043         ret.is_owned = false;
8044         return ret;
8045 }
8046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8047         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8048         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8049         int64_t ret_ref = 0;
8050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8052         return ret_ref;
8053 }
8054
8055 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8056         return owner->a;
8057 }
8058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8059         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8060         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8061         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
8062         return ret_arr;
8063 }
8064
8065 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8066         return Type_clone(&owner->b);
8067 }
8068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8069         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8070         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8071         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8072         return tag_ptr(ret_ret, true);
8073 }
8074
8075 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8076         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8077         for (size_t i = 0; i < ret.datalen; i++) {
8078                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8079         }
8080         return ret;
8081 }
8082 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
8083 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
8084 static jclass LDKCOption_NetAddressZ_None_class = NULL;
8085 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
8086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
8087         LDKCOption_NetAddressZ_Some_class =
8088                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
8089         CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
8090         LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
8091         CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
8092         LDKCOption_NetAddressZ_None_class =
8093                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
8094         CHECK(LDKCOption_NetAddressZ_None_class != NULL);
8095         LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
8096         CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
8097 }
8098 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8099         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
8100         switch(obj->tag) {
8101                 case LDKCOption_NetAddressZ_Some: {
8102                         int64_t some_ref = tag_ptr(&obj->some, false);
8103                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
8104                 }
8105                 case LDKCOption_NetAddressZ_None: {
8106                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
8107                 }
8108                 default: abort();
8109         }
8110 }
8111 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8112 CHECK(owner->result_ok);
8113         return CVec_u8Z_clone(&*owner->contents.result);
8114 }
8115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8116         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8117         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8118         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8119         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8120         CVec_u8Z_free(ret_var);
8121         return ret_arr;
8122 }
8123
8124 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8125         LDKPeerHandleError ret = *owner->contents.err;
8126         ret.is_owned = false;
8127         return ret;
8128 }
8129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8130         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8131         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8132         int64_t ret_ref = 0;
8133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8135         return ret_ref;
8136 }
8137
8138 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8139 CHECK(owner->result_ok);
8140         return *owner->contents.result;
8141 }
8142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8143         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8144         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8145 }
8146
8147 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8148         LDKPeerHandleError ret = *owner->contents.err;
8149         ret.is_owned = false;
8150         return ret;
8151 }
8152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8153         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8154         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8155         int64_t ret_ref = 0;
8156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8158         return ret_ref;
8159 }
8160
8161 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8162 CHECK(owner->result_ok);
8163         return *owner->contents.result;
8164 }
8165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8166         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8167         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8168         return ret_conv;
8169 }
8170
8171 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8172         LDKPeerHandleError ret = *owner->contents.err;
8173         ret.is_owned = false;
8174         return ret;
8175 }
8176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8177         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8178         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8179         int64_t ret_ref = 0;
8180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8182         return ret_ref;
8183 }
8184
8185 static jclass LDKGraphSyncError_DecodeError_class = NULL;
8186 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
8187 static jclass LDKGraphSyncError_LightningError_class = NULL;
8188 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
8189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
8190         LDKGraphSyncError_DecodeError_class =
8191                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
8192         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
8193         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
8194         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
8195         LDKGraphSyncError_LightningError_class =
8196                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
8197         CHECK(LDKGraphSyncError_LightningError_class != NULL);
8198         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
8199         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
8200 }
8201 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8202         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8203         switch(obj->tag) {
8204                 case LDKGraphSyncError_DecodeError: {
8205                         LDKDecodeError decode_error_var = obj->decode_error;
8206                         int64_t decode_error_ref = 0;
8207                         CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
8208                         decode_error_ref = tag_ptr(decode_error_var.inner, false);
8209                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
8210                 }
8211                 case LDKGraphSyncError_LightningError: {
8212                         LDKLightningError lightning_error_var = obj->lightning_error;
8213                         int64_t lightning_error_ref = 0;
8214                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8215                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8216                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
8217                 }
8218                 default: abort();
8219         }
8220 }
8221 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8222 CHECK(owner->result_ok);
8223         return *owner->contents.result;
8224 }
8225 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8226         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8227         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8228         return ret_conv;
8229 }
8230
8231 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8232 CHECK(!owner->result_ok);
8233         return GraphSyncError_clone(&*owner->contents.err);
8234 }
8235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8236         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8237         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8238         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8239         int64_t ret_ref = tag_ptr(ret_copy, true);
8240         return ret_ref;
8241 }
8242
8243 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8244 CHECK(owner->result_ok);
8245         return NetAddress_clone(&*owner->contents.result);
8246 }
8247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8248         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8249         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8250         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8251         int64_t ret_ref = tag_ptr(ret_copy, true);
8252         return ret_ref;
8253 }
8254
8255 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8256         LDKDecodeError ret = *owner->contents.err;
8257         ret.is_owned = false;
8258         return ret;
8259 }
8260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8261         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8262         LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8263         int64_t ret_ref = 0;
8264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8266         return ret_ref;
8267 }
8268
8269 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8270         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8271         for (size_t i = 0; i < ret.datalen; i++) {
8272                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8273         }
8274         return ret;
8275 }
8276 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8277         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8278         for (size_t i = 0; i < ret.datalen; i++) {
8279                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8280         }
8281         return ret;
8282 }
8283 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8284         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8285         for (size_t i = 0; i < ret.datalen; i++) {
8286                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8287         }
8288         return ret;
8289 }
8290 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8291         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8292         for (size_t i = 0; i < ret.datalen; i++) {
8293                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8294         }
8295         return ret;
8296 }
8297 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8298         LDKAcceptChannel ret = *owner->contents.result;
8299         ret.is_owned = false;
8300         return ret;
8301 }
8302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8303         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8304         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8305         int64_t ret_ref = 0;
8306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8308         return ret_ref;
8309 }
8310
8311 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8312         LDKDecodeError ret = *owner->contents.err;
8313         ret.is_owned = false;
8314         return ret;
8315 }
8316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8317         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8318         LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8319         int64_t ret_ref = 0;
8320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8322         return ret_ref;
8323 }
8324
8325 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8326         LDKAnnouncementSignatures ret = *owner->contents.result;
8327         ret.is_owned = false;
8328         return ret;
8329 }
8330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8331         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8332         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8333         int64_t ret_ref = 0;
8334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8336         return ret_ref;
8337 }
8338
8339 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8340         LDKDecodeError ret = *owner->contents.err;
8341         ret.is_owned = false;
8342         return ret;
8343 }
8344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8345         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8346         LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8347         int64_t ret_ref = 0;
8348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8350         return ret_ref;
8351 }
8352
8353 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8354         LDKChannelReestablish ret = *owner->contents.result;
8355         ret.is_owned = false;
8356         return ret;
8357 }
8358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8359         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8360         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8361         int64_t ret_ref = 0;
8362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8364         return ret_ref;
8365 }
8366
8367 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8368         LDKDecodeError ret = *owner->contents.err;
8369         ret.is_owned = false;
8370         return ret;
8371 }
8372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8373         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8374         LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8375         int64_t ret_ref = 0;
8376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8378         return ret_ref;
8379 }
8380
8381 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8382         LDKClosingSigned ret = *owner->contents.result;
8383         ret.is_owned = false;
8384         return ret;
8385 }
8386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8387         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8388         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8389         int64_t ret_ref = 0;
8390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8392         return ret_ref;
8393 }
8394
8395 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8396         LDKDecodeError ret = *owner->contents.err;
8397         ret.is_owned = false;
8398         return ret;
8399 }
8400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8401         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8402         LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8403         int64_t ret_ref = 0;
8404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8406         return ret_ref;
8407 }
8408
8409 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8410         LDKClosingSignedFeeRange ret = *owner->contents.result;
8411         ret.is_owned = false;
8412         return ret;
8413 }
8414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8415         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8416         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8417         int64_t ret_ref = 0;
8418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8420         return ret_ref;
8421 }
8422
8423 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8424         LDKDecodeError ret = *owner->contents.err;
8425         ret.is_owned = false;
8426         return ret;
8427 }
8428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8429         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8430         LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8431         int64_t ret_ref = 0;
8432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8434         return ret_ref;
8435 }
8436
8437 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8438         LDKCommitmentSigned ret = *owner->contents.result;
8439         ret.is_owned = false;
8440         return ret;
8441 }
8442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8443         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8444         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8445         int64_t ret_ref = 0;
8446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8448         return ret_ref;
8449 }
8450
8451 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8452         LDKDecodeError ret = *owner->contents.err;
8453         ret.is_owned = false;
8454         return ret;
8455 }
8456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8457         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8458         LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8459         int64_t ret_ref = 0;
8460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8462         return ret_ref;
8463 }
8464
8465 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8466         LDKFundingCreated ret = *owner->contents.result;
8467         ret.is_owned = false;
8468         return ret;
8469 }
8470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8471         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8472         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8473         int64_t ret_ref = 0;
8474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8476         return ret_ref;
8477 }
8478
8479 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8480         LDKDecodeError ret = *owner->contents.err;
8481         ret.is_owned = false;
8482         return ret;
8483 }
8484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8485         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8486         LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8487         int64_t ret_ref = 0;
8488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8490         return ret_ref;
8491 }
8492
8493 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8494         LDKFundingSigned ret = *owner->contents.result;
8495         ret.is_owned = false;
8496         return ret;
8497 }
8498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8499         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8500         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8501         int64_t ret_ref = 0;
8502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8504         return ret_ref;
8505 }
8506
8507 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8508         LDKDecodeError ret = *owner->contents.err;
8509         ret.is_owned = false;
8510         return ret;
8511 }
8512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8513         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8514         LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8515         int64_t ret_ref = 0;
8516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8518         return ret_ref;
8519 }
8520
8521 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8522         LDKChannelReady ret = *owner->contents.result;
8523         ret.is_owned = false;
8524         return ret;
8525 }
8526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8527         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8528         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
8529         int64_t ret_ref = 0;
8530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8532         return ret_ref;
8533 }
8534
8535 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8536         LDKDecodeError ret = *owner->contents.err;
8537         ret.is_owned = false;
8538         return ret;
8539 }
8540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8541         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8542         LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8543         int64_t ret_ref = 0;
8544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8546         return ret_ref;
8547 }
8548
8549 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8550         LDKInit ret = *owner->contents.result;
8551         ret.is_owned = false;
8552         return ret;
8553 }
8554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8555         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8556         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8557         int64_t ret_ref = 0;
8558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8560         return ret_ref;
8561 }
8562
8563 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8564         LDKDecodeError ret = *owner->contents.err;
8565         ret.is_owned = false;
8566         return ret;
8567 }
8568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8569         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8570         LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
8571         int64_t ret_ref = 0;
8572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8574         return ret_ref;
8575 }
8576
8577 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8578         LDKOpenChannel ret = *owner->contents.result;
8579         ret.is_owned = false;
8580         return ret;
8581 }
8582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8583         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8584         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8585         int64_t ret_ref = 0;
8586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8588         return ret_ref;
8589 }
8590
8591 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8592         LDKDecodeError ret = *owner->contents.err;
8593         ret.is_owned = false;
8594         return ret;
8595 }
8596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8597         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8598         LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8599         int64_t ret_ref = 0;
8600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8602         return ret_ref;
8603 }
8604
8605 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8606         LDKRevokeAndACK ret = *owner->contents.result;
8607         ret.is_owned = false;
8608         return ret;
8609 }
8610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8611         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8612         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8613         int64_t ret_ref = 0;
8614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8616         return ret_ref;
8617 }
8618
8619 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8620         LDKDecodeError ret = *owner->contents.err;
8621         ret.is_owned = false;
8622         return ret;
8623 }
8624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8625         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8626         LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8627         int64_t ret_ref = 0;
8628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8630         return ret_ref;
8631 }
8632
8633 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8634         LDKShutdown ret = *owner->contents.result;
8635         ret.is_owned = false;
8636         return ret;
8637 }
8638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8639         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8640         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8641         int64_t ret_ref = 0;
8642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8644         return ret_ref;
8645 }
8646
8647 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8648         LDKDecodeError ret = *owner->contents.err;
8649         ret.is_owned = false;
8650         return ret;
8651 }
8652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8653         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8654         LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8655         int64_t ret_ref = 0;
8656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8658         return ret_ref;
8659 }
8660
8661 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8662         LDKUpdateFailHTLC ret = *owner->contents.result;
8663         ret.is_owned = false;
8664         return ret;
8665 }
8666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8667         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8668         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8669         int64_t ret_ref = 0;
8670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8672         return ret_ref;
8673 }
8674
8675 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8676         LDKDecodeError ret = *owner->contents.err;
8677         ret.is_owned = false;
8678         return ret;
8679 }
8680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8681         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8682         LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8683         int64_t ret_ref = 0;
8684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8686         return ret_ref;
8687 }
8688
8689 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8690         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8691         ret.is_owned = false;
8692         return ret;
8693 }
8694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8695         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8696         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8697         int64_t ret_ref = 0;
8698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8700         return ret_ref;
8701 }
8702
8703 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8704         LDKDecodeError ret = *owner->contents.err;
8705         ret.is_owned = false;
8706         return ret;
8707 }
8708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8709         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8710         LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8711         int64_t ret_ref = 0;
8712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8714         return ret_ref;
8715 }
8716
8717 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8718         LDKUpdateFee ret = *owner->contents.result;
8719         ret.is_owned = false;
8720         return ret;
8721 }
8722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8723         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8724         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8725         int64_t ret_ref = 0;
8726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8728         return ret_ref;
8729 }
8730
8731 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8732         LDKDecodeError ret = *owner->contents.err;
8733         ret.is_owned = false;
8734         return ret;
8735 }
8736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8737         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8738         LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8739         int64_t ret_ref = 0;
8740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8742         return ret_ref;
8743 }
8744
8745 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8746         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8747         ret.is_owned = false;
8748         return ret;
8749 }
8750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8751         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8752         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8753         int64_t ret_ref = 0;
8754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8756         return ret_ref;
8757 }
8758
8759 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8760         LDKDecodeError ret = *owner->contents.err;
8761         ret.is_owned = false;
8762         return ret;
8763 }
8764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8765         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8766         LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8767         int64_t ret_ref = 0;
8768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8770         return ret_ref;
8771 }
8772
8773 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8774         LDKUpdateAddHTLC ret = *owner->contents.result;
8775         ret.is_owned = false;
8776         return ret;
8777 }
8778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8779         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8780         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8781         int64_t ret_ref = 0;
8782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8784         return ret_ref;
8785 }
8786
8787 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8788         LDKDecodeError ret = *owner->contents.err;
8789         ret.is_owned = false;
8790         return ret;
8791 }
8792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8793         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8794         LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8795         int64_t ret_ref = 0;
8796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8798         return ret_ref;
8799 }
8800
8801 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8802         LDKPing ret = *owner->contents.result;
8803         ret.is_owned = false;
8804         return ret;
8805 }
8806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8807         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8808         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8809         int64_t ret_ref = 0;
8810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8812         return ret_ref;
8813 }
8814
8815 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8816         LDKDecodeError ret = *owner->contents.err;
8817         ret.is_owned = false;
8818         return ret;
8819 }
8820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8821         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8822         LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
8823         int64_t ret_ref = 0;
8824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8826         return ret_ref;
8827 }
8828
8829 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8830         LDKPong ret = *owner->contents.result;
8831         ret.is_owned = false;
8832         return ret;
8833 }
8834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8835         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8836         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8837         int64_t ret_ref = 0;
8838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8840         return ret_ref;
8841 }
8842
8843 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8844         LDKDecodeError ret = *owner->contents.err;
8845         ret.is_owned = false;
8846         return ret;
8847 }
8848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8849         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8850         LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
8851         int64_t ret_ref = 0;
8852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8854         return ret_ref;
8855 }
8856
8857 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8858         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8859         ret.is_owned = false;
8860         return ret;
8861 }
8862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8863         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8864         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8865         int64_t ret_ref = 0;
8866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8868         return ret_ref;
8869 }
8870
8871 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8872         LDKDecodeError ret = *owner->contents.err;
8873         ret.is_owned = false;
8874         return ret;
8875 }
8876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8877         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8878         LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8879         int64_t ret_ref = 0;
8880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8882         return ret_ref;
8883 }
8884
8885 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8886         LDKChannelAnnouncement ret = *owner->contents.result;
8887         ret.is_owned = false;
8888         return ret;
8889 }
8890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8891         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8892         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8893         int64_t ret_ref = 0;
8894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8896         return ret_ref;
8897 }
8898
8899 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8900         LDKDecodeError ret = *owner->contents.err;
8901         ret.is_owned = false;
8902         return ret;
8903 }
8904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8905         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8906         LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8907         int64_t ret_ref = 0;
8908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8910         return ret_ref;
8911 }
8912
8913 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8914         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8915         ret.is_owned = false;
8916         return ret;
8917 }
8918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8919         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8920         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8921         int64_t ret_ref = 0;
8922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8924         return ret_ref;
8925 }
8926
8927 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8928         LDKDecodeError ret = *owner->contents.err;
8929         ret.is_owned = false;
8930         return ret;
8931 }
8932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8933         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8934         LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8935         int64_t ret_ref = 0;
8936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8938         return ret_ref;
8939 }
8940
8941 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8942         LDKChannelUpdate ret = *owner->contents.result;
8943         ret.is_owned = false;
8944         return ret;
8945 }
8946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8947         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8948         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8949         int64_t ret_ref = 0;
8950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8952         return ret_ref;
8953 }
8954
8955 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8956         LDKDecodeError ret = *owner->contents.err;
8957         ret.is_owned = false;
8958         return ret;
8959 }
8960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8961         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8962         LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8963         int64_t ret_ref = 0;
8964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8966         return ret_ref;
8967 }
8968
8969 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8970         LDKErrorMessage ret = *owner->contents.result;
8971         ret.is_owned = false;
8972         return ret;
8973 }
8974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8975         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8976         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8977         int64_t ret_ref = 0;
8978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8980         return ret_ref;
8981 }
8982
8983 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8984         LDKDecodeError ret = *owner->contents.err;
8985         ret.is_owned = false;
8986         return ret;
8987 }
8988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8989         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8990         LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8991         int64_t ret_ref = 0;
8992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8994         return ret_ref;
8995 }
8996
8997 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8998         LDKWarningMessage ret = *owner->contents.result;
8999         ret.is_owned = false;
9000         return ret;
9001 }
9002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9003         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9004         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9005         int64_t ret_ref = 0;
9006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9008         return ret_ref;
9009 }
9010
9011 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9012         LDKDecodeError ret = *owner->contents.err;
9013         ret.is_owned = false;
9014         return ret;
9015 }
9016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9017         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9018         LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9019         int64_t ret_ref = 0;
9020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9022         return ret_ref;
9023 }
9024
9025 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9026         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9027         ret.is_owned = false;
9028         return ret;
9029 }
9030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9031         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9032         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9033         int64_t ret_ref = 0;
9034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9036         return ret_ref;
9037 }
9038
9039 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9040         LDKDecodeError ret = *owner->contents.err;
9041         ret.is_owned = false;
9042         return ret;
9043 }
9044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9045         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9046         LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9047         int64_t ret_ref = 0;
9048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9050         return ret_ref;
9051 }
9052
9053 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9054         LDKNodeAnnouncement ret = *owner->contents.result;
9055         ret.is_owned = false;
9056         return ret;
9057 }
9058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9059         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9060         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9061         int64_t ret_ref = 0;
9062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9064         return ret_ref;
9065 }
9066
9067 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9068         LDKDecodeError ret = *owner->contents.err;
9069         ret.is_owned = false;
9070         return ret;
9071 }
9072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9073         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9074         LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9075         int64_t ret_ref = 0;
9076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9078         return ret_ref;
9079 }
9080
9081 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9082         LDKQueryShortChannelIds ret = *owner->contents.result;
9083         ret.is_owned = false;
9084         return ret;
9085 }
9086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9087         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9088         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9089         int64_t ret_ref = 0;
9090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9092         return ret_ref;
9093 }
9094
9095 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9096         LDKDecodeError ret = *owner->contents.err;
9097         ret.is_owned = false;
9098         return ret;
9099 }
9100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9101         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9102         LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9103         int64_t ret_ref = 0;
9104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9106         return ret_ref;
9107 }
9108
9109 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9110         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
9111         ret.is_owned = false;
9112         return ret;
9113 }
9114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9115         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9116         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9117         int64_t ret_ref = 0;
9118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9120         return ret_ref;
9121 }
9122
9123 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9124         LDKDecodeError ret = *owner->contents.err;
9125         ret.is_owned = false;
9126         return ret;
9127 }
9128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9129         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9130         LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9131         int64_t ret_ref = 0;
9132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9134         return ret_ref;
9135 }
9136
9137 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9138         LDKQueryChannelRange ret = *owner->contents.result;
9139         ret.is_owned = false;
9140         return ret;
9141 }
9142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9143         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9144         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9145         int64_t ret_ref = 0;
9146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9148         return ret_ref;
9149 }
9150
9151 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9152         LDKDecodeError ret = *owner->contents.err;
9153         ret.is_owned = false;
9154         return ret;
9155 }
9156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9157         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9158         LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9159         int64_t ret_ref = 0;
9160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9162         return ret_ref;
9163 }
9164
9165 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9166         LDKReplyChannelRange ret = *owner->contents.result;
9167         ret.is_owned = false;
9168         return ret;
9169 }
9170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9171         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9172         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9173         int64_t ret_ref = 0;
9174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9176         return ret_ref;
9177 }
9178
9179 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9180         LDKDecodeError ret = *owner->contents.err;
9181         ret.is_owned = false;
9182         return ret;
9183 }
9184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9185         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9186         LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9187         int64_t ret_ref = 0;
9188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9190         return ret_ref;
9191 }
9192
9193 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9194         LDKGossipTimestampFilter ret = *owner->contents.result;
9195         ret.is_owned = false;
9196         return ret;
9197 }
9198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9199         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9200         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9201         int64_t ret_ref = 0;
9202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9204         return ret_ref;
9205 }
9206
9207 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9208         LDKDecodeError ret = *owner->contents.err;
9209         ret.is_owned = false;
9210         return ret;
9211 }
9212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9213         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9214         LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9215         int64_t ret_ref = 0;
9216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9218         return ret_ref;
9219 }
9220
9221 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9222         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9223         for (size_t i = 0; i < ret.datalen; i++) {
9224                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9225         }
9226         return ret;
9227 }
9228 static jclass LDKSignOrCreationError_SignError_class = NULL;
9229 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9230 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9231 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9233         LDKSignOrCreationError_SignError_class =
9234                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9235         CHECK(LDKSignOrCreationError_SignError_class != NULL);
9236         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9237         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9238         LDKSignOrCreationError_CreationError_class =
9239                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9240         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9241         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9242         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9243 }
9244 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9245         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
9246         switch(obj->tag) {
9247                 case LDKSignOrCreationError_SignError: {
9248                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9249                 }
9250                 case LDKSignOrCreationError_CreationError: {
9251                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9252                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9253                 }
9254                 default: abort();
9255         }
9256 }
9257 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9258         LDKInvoice ret = *owner->contents.result;
9259         ret.is_owned = false;
9260         return ret;
9261 }
9262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9263         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9264         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9265         int64_t ret_ref = 0;
9266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9268         return ret_ref;
9269 }
9270
9271 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9272 CHECK(!owner->result_ok);
9273         return SignOrCreationError_clone(&*owner->contents.err);
9274 }
9275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9276         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9277         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9278         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9279         int64_t ret_ref = tag_ptr(ret_copy, true);
9280         return ret_ref;
9281 }
9282
9283 typedef struct LDKFilter_JCalls {
9284         atomic_size_t refcnt;
9285         JavaVM *vm;
9286         jweak o;
9287         jmethodID register_tx_meth;
9288         jmethodID register_output_meth;
9289 } LDKFilter_JCalls;
9290 static void LDKFilter_JCalls_free(void* this_arg) {
9291         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9292         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9293                 JNIEnv *env;
9294                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9295                 if (get_jenv_res == JNI_EDETACHED) {
9296                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9297                 } else {
9298                         DO_ASSERT(get_jenv_res == JNI_OK);
9299                 }
9300                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9301                 if (get_jenv_res == JNI_EDETACHED) {
9302                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9303                 }
9304                 FREE(j_calls);
9305         }
9306 }
9307 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9308         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9309         JNIEnv *env;
9310         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9311         if (get_jenv_res == JNI_EDETACHED) {
9312                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9313         } else {
9314                 DO_ASSERT(get_jenv_res == JNI_OK);
9315         }
9316         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9317         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9318         LDKu8slice script_pubkey_var = script_pubkey;
9319         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9320         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9321         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9322         CHECK(obj != NULL);
9323         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9324         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9325                 (*env)->ExceptionDescribe(env);
9326                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
9327         }
9328         if (get_jenv_res == JNI_EDETACHED) {
9329                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9330         }
9331 }
9332 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9333         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9334         JNIEnv *env;
9335         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9336         if (get_jenv_res == JNI_EDETACHED) {
9337                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9338         } else {
9339                 DO_ASSERT(get_jenv_res == JNI_OK);
9340         }
9341         LDKWatchedOutput output_var = output;
9342         int64_t output_ref = 0;
9343         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9344         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
9345         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9346         CHECK(obj != NULL);
9347         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9348         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9349                 (*env)->ExceptionDescribe(env);
9350                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
9351         }
9352         void* ret_ptr = untag_ptr(ret);
9353         CHECK_ACCESS(ret_ptr);
9354         LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
9355         FREE(untag_ptr(ret));
9356         if (get_jenv_res == JNI_EDETACHED) {
9357                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9358         }
9359         return ret_conv;
9360 }
9361 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
9362         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
9363         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9364 }
9365 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
9366         jclass c = (*env)->GetObjectClass(env, o);
9367         CHECK(c != NULL);
9368         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
9369         atomic_init(&calls->refcnt, 1);
9370         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9371         calls->o = (*env)->NewWeakGlobalRef(env, o);
9372         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
9373         CHECK(calls->register_tx_meth != NULL);
9374         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
9375         CHECK(calls->register_output_meth != NULL);
9376
9377         LDKFilter ret = {
9378                 .this_arg = (void*) calls,
9379                 .register_tx = register_tx_LDKFilter_jcall,
9380                 .register_output = register_output_LDKFilter_jcall,
9381                 .free = LDKFilter_JCalls_free,
9382         };
9383         return ret;
9384 }
9385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
9386         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9387         *res_ptr = LDKFilter_init(env, clz, o);
9388         return tag_ptr(res_ptr, true);
9389 }
9390 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) {
9391         void* this_arg_ptr = untag_ptr(this_arg);
9392         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9393         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9394         unsigned char txid_arr[32];
9395         CHECK((*env)->GetArrayLength(env, txid) == 32);
9396         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9397         unsigned char (*txid_ref)[32] = &txid_arr;
9398         LDKu8slice script_pubkey_ref;
9399         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9400         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
9401         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
9402         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
9403 }
9404
9405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
9406         void* this_arg_ptr = untag_ptr(this_arg);
9407         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9408         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9409         LDKWatchedOutput output_conv;
9410         output_conv.inner = untag_ptr(output);
9411         output_conv.is_owned = ptr_is_owned(output);
9412         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
9413         output_conv = WatchedOutput_clone(&output_conv);
9414         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9415         *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
9416         int64_t ret_ref = tag_ptr(ret_copy, true);
9417         return ret_ref;
9418 }
9419
9420 static jclass LDKCOption_FilterZ_Some_class = NULL;
9421 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
9422 static jclass LDKCOption_FilterZ_None_class = NULL;
9423 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
9424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
9425         LDKCOption_FilterZ_Some_class =
9426                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9427         CHECK(LDKCOption_FilterZ_Some_class != NULL);
9428         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9429         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9430         LDKCOption_FilterZ_None_class =
9431                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9432         CHECK(LDKCOption_FilterZ_None_class != NULL);
9433         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9434         CHECK(LDKCOption_FilterZ_None_meth != NULL);
9435 }
9436 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9437         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
9438         switch(obj->tag) {
9439                 case LDKCOption_FilterZ_Some: {
9440                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9441                         *some_ret = obj->some;
9442                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
9443                         if ((*some_ret).free == LDKFilter_JCalls_free) {
9444                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9445                                 LDKFilter_JCalls_cloned(&(*some_ret));
9446                         }
9447                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
9448                 }
9449                 case LDKCOption_FilterZ_None: {
9450                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
9451                 }
9452                 default: abort();
9453         }
9454 }
9455 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9456         LDKLockedChannelMonitor ret = *owner->contents.result;
9457         ret.is_owned = false;
9458         return ret;
9459 }
9460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9461         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
9462         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
9463         int64_t ret_ref = 0;
9464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9466         return ret_ref;
9467 }
9468
9469 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9470 CHECK(!owner->result_ok);
9471         return *owner->contents.err;
9472 }
9473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9474         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
9475         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
9476 }
9477
9478 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
9479         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
9480         for (size_t i = 0; i < ret.datalen; i++) {
9481                 ret.data[i] = OutPoint_clone(&orig->data[i]);
9482         }
9483         return ret;
9484 }
9485 typedef struct LDKMessageSendEventsProvider_JCalls {
9486         atomic_size_t refcnt;
9487         JavaVM *vm;
9488         jweak o;
9489         jmethodID get_and_clear_pending_msg_events_meth;
9490 } LDKMessageSendEventsProvider_JCalls;
9491 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9492         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9493         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9494                 JNIEnv *env;
9495                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9496                 if (get_jenv_res == JNI_EDETACHED) {
9497                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9498                 } else {
9499                         DO_ASSERT(get_jenv_res == JNI_OK);
9500                 }
9501                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9502                 if (get_jenv_res == JNI_EDETACHED) {
9503                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9504                 }
9505                 FREE(j_calls);
9506         }
9507 }
9508 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9509         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9510         JNIEnv *env;
9511         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9512         if (get_jenv_res == JNI_EDETACHED) {
9513                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9514         } else {
9515                 DO_ASSERT(get_jenv_res == JNI_OK);
9516         }
9517         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9518         CHECK(obj != NULL);
9519         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
9520         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9521                 (*env)->ExceptionDescribe(env);
9522                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
9523         }
9524         LDKCVec_MessageSendEventZ ret_constr;
9525         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9526         if (ret_constr.datalen > 0)
9527                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9528         else
9529                 ret_constr.data = NULL;
9530         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9531         for (size_t s = 0; s < ret_constr.datalen; s++) {
9532                 int64_t ret_conv_18 = ret_vals[s];
9533                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
9534                 CHECK_ACCESS(ret_conv_18_ptr);
9535                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
9536                 FREE(untag_ptr(ret_conv_18));
9537                 ret_constr.data[s] = ret_conv_18_conv;
9538         }
9539         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9540         if (get_jenv_res == JNI_EDETACHED) {
9541                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9542         }
9543         return ret_constr;
9544 }
9545 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
9546         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
9547         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9548 }
9549 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9550         jclass c = (*env)->GetObjectClass(env, o);
9551         CHECK(c != NULL);
9552         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
9553         atomic_init(&calls->refcnt, 1);
9554         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9555         calls->o = (*env)->NewWeakGlobalRef(env, o);
9556         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
9557         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
9558
9559         LDKMessageSendEventsProvider ret = {
9560                 .this_arg = (void*) calls,
9561                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
9562                 .free = LDKMessageSendEventsProvider_JCalls_free,
9563         };
9564         return ret;
9565 }
9566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9567         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9568         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
9569         return tag_ptr(res_ptr, true);
9570 }
9571 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9572         void* this_arg_ptr = untag_ptr(this_arg);
9573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9574         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
9575         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
9576         int64_tArray ret_arr = NULL;
9577         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9578         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9579         for (size_t s = 0; s < ret_var.datalen; s++) {
9580                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9581                 *ret_conv_18_copy = ret_var.data[s];
9582                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
9583                 ret_arr_ptr[s] = ret_conv_18_ref;
9584         }
9585         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9586         FREE(ret_var.data);
9587         return ret_arr;
9588 }
9589
9590 typedef struct LDKEventHandler_JCalls {
9591         atomic_size_t refcnt;
9592         JavaVM *vm;
9593         jweak o;
9594         jmethodID handle_event_meth;
9595 } LDKEventHandler_JCalls;
9596 static void LDKEventHandler_JCalls_free(void* this_arg) {
9597         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9598         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9599                 JNIEnv *env;
9600                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9601                 if (get_jenv_res == JNI_EDETACHED) {
9602                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9603                 } else {
9604                         DO_ASSERT(get_jenv_res == JNI_OK);
9605                 }
9606                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9607                 if (get_jenv_res == JNI_EDETACHED) {
9608                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9609                 }
9610                 FREE(j_calls);
9611         }
9612 }
9613 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
9614         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9615         JNIEnv *env;
9616         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9617         if (get_jenv_res == JNI_EDETACHED) {
9618                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9619         } else {
9620                 DO_ASSERT(get_jenv_res == JNI_OK);
9621         }
9622         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
9623         *ret_event = Event_clone(event);
9624         int64_t ref_event = tag_ptr(ret_event, true);
9625         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9626         CHECK(obj != NULL);
9627         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, ref_event);
9628         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9629                 (*env)->ExceptionDescribe(env);
9630                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
9631         }
9632         if (get_jenv_res == JNI_EDETACHED) {
9633                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9634         }
9635 }
9636 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
9637         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
9638         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9639 }
9640 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
9641         jclass c = (*env)->GetObjectClass(env, o);
9642         CHECK(c != NULL);
9643         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
9644         atomic_init(&calls->refcnt, 1);
9645         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9646         calls->o = (*env)->NewWeakGlobalRef(env, o);
9647         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
9648         CHECK(calls->handle_event_meth != NULL);
9649
9650         LDKEventHandler ret = {
9651                 .this_arg = (void*) calls,
9652                 .handle_event = handle_event_LDKEventHandler_jcall,
9653                 .free = LDKEventHandler_JCalls_free,
9654         };
9655         return ret;
9656 }
9657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
9658         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9659         *res_ptr = LDKEventHandler_init(env, clz, o);
9660         return tag_ptr(res_ptr, true);
9661 }
9662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
9663         void* this_arg_ptr = untag_ptr(this_arg);
9664         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9665         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
9666         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
9667         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
9668 }
9669
9670 typedef struct LDKEventsProvider_JCalls {
9671         atomic_size_t refcnt;
9672         JavaVM *vm;
9673         jweak o;
9674         jmethodID process_pending_events_meth;
9675 } LDKEventsProvider_JCalls;
9676 static void LDKEventsProvider_JCalls_free(void* this_arg) {
9677         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9678         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9679                 JNIEnv *env;
9680                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9681                 if (get_jenv_res == JNI_EDETACHED) {
9682                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9683                 } else {
9684                         DO_ASSERT(get_jenv_res == JNI_OK);
9685                 }
9686                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9687                 if (get_jenv_res == JNI_EDETACHED) {
9688                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9689                 }
9690                 FREE(j_calls);
9691         }
9692 }
9693 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
9694         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9695         JNIEnv *env;
9696         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9697         if (get_jenv_res == JNI_EDETACHED) {
9698                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9699         } else {
9700                 DO_ASSERT(get_jenv_res == JNI_OK);
9701         }
9702         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9703         *handler_ret = handler;
9704         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9705         CHECK(obj != NULL);
9706         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
9707         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9708                 (*env)->ExceptionDescribe(env);
9709                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
9710         }
9711         if (get_jenv_res == JNI_EDETACHED) {
9712                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9713         }
9714 }
9715 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
9716         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
9717         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9718 }
9719 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9720         jclass c = (*env)->GetObjectClass(env, o);
9721         CHECK(c != NULL);
9722         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
9723         atomic_init(&calls->refcnt, 1);
9724         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9725         calls->o = (*env)->NewWeakGlobalRef(env, o);
9726         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
9727         CHECK(calls->process_pending_events_meth != NULL);
9728
9729         LDKEventsProvider ret = {
9730                 .this_arg = (void*) calls,
9731                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
9732                 .free = LDKEventsProvider_JCalls_free,
9733         };
9734         return ret;
9735 }
9736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9737         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9738         *res_ptr = LDKEventsProvider_init(env, clz, o);
9739         return tag_ptr(res_ptr, true);
9740 }
9741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
9742         void* this_arg_ptr = untag_ptr(this_arg);
9743         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9744         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
9745         void* handler_ptr = untag_ptr(handler);
9746         CHECK_ACCESS(handler_ptr);
9747         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
9748         if (handler_conv.free == LDKEventHandler_JCalls_free) {
9749                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9750                 LDKEventHandler_JCalls_cloned(&handler_conv);
9751         }
9752         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
9753 }
9754
9755 typedef struct LDKScore_JCalls {
9756         atomic_size_t refcnt;
9757         JavaVM *vm;
9758         jweak o;
9759         jmethodID channel_penalty_msat_meth;
9760         jmethodID payment_path_failed_meth;
9761         jmethodID payment_path_successful_meth;
9762         jmethodID probe_failed_meth;
9763         jmethodID probe_successful_meth;
9764         jmethodID write_meth;
9765 } LDKScore_JCalls;
9766 static void LDKScore_JCalls_free(void* this_arg) {
9767         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9768         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9769                 JNIEnv *env;
9770                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9771                 if (get_jenv_res == JNI_EDETACHED) {
9772                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9773                 } else {
9774                         DO_ASSERT(get_jenv_res == JNI_OK);
9775                 }
9776                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9777                 if (get_jenv_res == JNI_EDETACHED) {
9778                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9779                 }
9780                 FREE(j_calls);
9781         }
9782 }
9783 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
9784         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9785         JNIEnv *env;
9786         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9787         if (get_jenv_res == JNI_EDETACHED) {
9788                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9789         } else {
9790                 DO_ASSERT(get_jenv_res == JNI_OK);
9791         }
9792         int64_t short_channel_id_conv = short_channel_id;
9793         LDKNodeId source_var = *source;
9794         int64_t source_ref = 0;
9795         source_var = NodeId_clone(&source_var);
9796         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
9797         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
9798         LDKNodeId target_var = *target;
9799         int64_t target_ref = 0;
9800         target_var = NodeId_clone(&target_var);
9801         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
9802         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
9803         LDKChannelUsage usage_var = usage;
9804         int64_t usage_ref = 0;
9805         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
9806         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
9807         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9808         CHECK(obj != NULL);
9809         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
9810         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9811                 (*env)->ExceptionDescribe(env);
9812                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
9813         }
9814         if (get_jenv_res == JNI_EDETACHED) {
9815                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9816         }
9817         return ret;
9818 }
9819 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9820         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9821         JNIEnv *env;
9822         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9823         if (get_jenv_res == JNI_EDETACHED) {
9824                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9825         } else {
9826                 DO_ASSERT(get_jenv_res == JNI_OK);
9827         }
9828         LDKCVec_RouteHopZ path_var = path;
9829         int64_tArray path_arr = NULL;
9830         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9831         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9832         for (size_t k = 0; k < path_var.datalen; k++) {
9833                 LDKRouteHop path_conv_10_var = path_var.data[k];
9834                 int64_t path_conv_10_ref = 0;
9835                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9836                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9837                 path_arr_ptr[k] = path_conv_10_ref;
9838         }
9839         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9840         FREE(path_var.data);
9841         int64_t short_channel_id_conv = short_channel_id;
9842         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9843         CHECK(obj != NULL);
9844         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
9845         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9846                 (*env)->ExceptionDescribe(env);
9847                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
9848         }
9849         if (get_jenv_res == JNI_EDETACHED) {
9850                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9851         }
9852 }
9853 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9854         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9855         JNIEnv *env;
9856         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9857         if (get_jenv_res == JNI_EDETACHED) {
9858                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9859         } else {
9860                 DO_ASSERT(get_jenv_res == JNI_OK);
9861         }
9862         LDKCVec_RouteHopZ path_var = path;
9863         int64_tArray path_arr = NULL;
9864         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9865         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9866         for (size_t k = 0; k < path_var.datalen; k++) {
9867                 LDKRouteHop path_conv_10_var = path_var.data[k];
9868                 int64_t path_conv_10_ref = 0;
9869                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9870                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9871                 path_arr_ptr[k] = path_conv_10_ref;
9872         }
9873         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9874         FREE(path_var.data);
9875         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9876         CHECK(obj != NULL);
9877         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
9878         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9879                 (*env)->ExceptionDescribe(env);
9880                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
9881         }
9882         if (get_jenv_res == JNI_EDETACHED) {
9883                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9884         }
9885 }
9886 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9887         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9888         JNIEnv *env;
9889         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9890         if (get_jenv_res == JNI_EDETACHED) {
9891                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9892         } else {
9893                 DO_ASSERT(get_jenv_res == JNI_OK);
9894         }
9895         LDKCVec_RouteHopZ path_var = path;
9896         int64_tArray path_arr = NULL;
9897         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9898         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9899         for (size_t k = 0; k < path_var.datalen; k++) {
9900                 LDKRouteHop path_conv_10_var = path_var.data[k];
9901                 int64_t path_conv_10_ref = 0;
9902                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9903                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9904                 path_arr_ptr[k] = path_conv_10_ref;
9905         }
9906         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9907         FREE(path_var.data);
9908         int64_t short_channel_id_conv = short_channel_id;
9909         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9910         CHECK(obj != NULL);
9911         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv);
9912         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9913                 (*env)->ExceptionDescribe(env);
9914                 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
9915         }
9916         if (get_jenv_res == JNI_EDETACHED) {
9917                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9918         }
9919 }
9920 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9921         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9922         JNIEnv *env;
9923         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9924         if (get_jenv_res == JNI_EDETACHED) {
9925                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9926         } else {
9927                 DO_ASSERT(get_jenv_res == JNI_OK);
9928         }
9929         LDKCVec_RouteHopZ path_var = path;
9930         int64_tArray path_arr = NULL;
9931         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9932         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9933         for (size_t k = 0; k < path_var.datalen; k++) {
9934                 LDKRouteHop path_conv_10_var = path_var.data[k];
9935                 int64_t path_conv_10_ref = 0;
9936                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9937                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9938                 path_arr_ptr[k] = path_conv_10_ref;
9939         }
9940         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9941         FREE(path_var.data);
9942         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9943         CHECK(obj != NULL);
9944         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr);
9945         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9946                 (*env)->ExceptionDescribe(env);
9947                 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
9948         }
9949         if (get_jenv_res == JNI_EDETACHED) {
9950                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9951         }
9952 }
9953 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9954         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9955         JNIEnv *env;
9956         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9957         if (get_jenv_res == JNI_EDETACHED) {
9958                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9959         } else {
9960                 DO_ASSERT(get_jenv_res == JNI_OK);
9961         }
9962         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9963         CHECK(obj != NULL);
9964         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9965         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9966                 (*env)->ExceptionDescribe(env);
9967                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
9968         }
9969         LDKCVec_u8Z ret_ref;
9970         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9971         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9972         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9973         if (get_jenv_res == JNI_EDETACHED) {
9974                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9975         }
9976         return ret_ref;
9977 }
9978 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9979         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9980         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9981 }
9982 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
9983         jclass c = (*env)->GetObjectClass(env, o);
9984         CHECK(c != NULL);
9985         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9986         atomic_init(&calls->refcnt, 1);
9987         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9988         calls->o = (*env)->NewWeakGlobalRef(env, o);
9989         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
9990         CHECK(calls->channel_penalty_msat_meth != NULL);
9991         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
9992         CHECK(calls->payment_path_failed_meth != NULL);
9993         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
9994         CHECK(calls->payment_path_successful_meth != NULL);
9995         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V");
9996         CHECK(calls->probe_failed_meth != NULL);
9997         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V");
9998         CHECK(calls->probe_successful_meth != NULL);
9999         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10000         CHECK(calls->write_meth != NULL);
10001
10002         LDKScore ret = {
10003                 .this_arg = (void*) calls,
10004                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10005                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10006                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10007                 .probe_failed = probe_failed_LDKScore_jcall,
10008                 .probe_successful = probe_successful_LDKScore_jcall,
10009                 .write = write_LDKScore_jcall,
10010                 .free = LDKScore_JCalls_free,
10011         };
10012         return ret;
10013 }
10014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10015         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10016         *res_ptr = LDKScore_init(env, clz, o);
10017         return tag_ptr(res_ptr, true);
10018 }
10019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_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) {
10020         void* this_arg_ptr = untag_ptr(this_arg);
10021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10022         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10023         LDKNodeId source_conv;
10024         source_conv.inner = untag_ptr(source);
10025         source_conv.is_owned = ptr_is_owned(source);
10026         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10027         source_conv.is_owned = false;
10028         LDKNodeId target_conv;
10029         target_conv.inner = untag_ptr(target);
10030         target_conv.is_owned = ptr_is_owned(target);
10031         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10032         target_conv.is_owned = false;
10033         LDKChannelUsage usage_conv;
10034         usage_conv.inner = untag_ptr(usage);
10035         usage_conv.is_owned = ptr_is_owned(usage);
10036         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
10037         usage_conv = ChannelUsage_clone(&usage_conv);
10038         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
10039         return ret_conv;
10040 }
10041
10042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
10043         void* this_arg_ptr = untag_ptr(this_arg);
10044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10045         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10046         LDKCVec_RouteHopZ path_constr;
10047         path_constr.datalen = (*env)->GetArrayLength(env, path);
10048         if (path_constr.datalen > 0)
10049                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10050         else
10051                 path_constr.data = NULL;
10052         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10053         for (size_t k = 0; k < path_constr.datalen; k++) {
10054                 int64_t path_conv_10 = path_vals[k];
10055                 LDKRouteHop path_conv_10_conv;
10056                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10057                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10058                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10059                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10060                 path_constr.data[k] = path_conv_10_conv;
10061         }
10062         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10063         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10064 }
10065
10066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10067         void* this_arg_ptr = untag_ptr(this_arg);
10068         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10069         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10070         LDKCVec_RouteHopZ path_constr;
10071         path_constr.datalen = (*env)->GetArrayLength(env, path);
10072         if (path_constr.datalen > 0)
10073                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10074         else
10075                 path_constr.data = NULL;
10076         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10077         for (size_t k = 0; k < path_constr.datalen; k++) {
10078                 int64_t path_conv_10 = path_vals[k];
10079                 LDKRouteHop path_conv_10_conv;
10080                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10081                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10082                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10083                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10084                 path_constr.data[k] = path_conv_10_conv;
10085         }
10086         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10087         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
10088 }
10089
10090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
10091         void* this_arg_ptr = untag_ptr(this_arg);
10092         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10093         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10094         LDKCVec_RouteHopZ path_constr;
10095         path_constr.datalen = (*env)->GetArrayLength(env, path);
10096         if (path_constr.datalen > 0)
10097                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10098         else
10099                 path_constr.data = NULL;
10100         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10101         for (size_t k = 0; k < path_constr.datalen; k++) {
10102                 int64_t path_conv_10 = path_vals[k];
10103                 LDKRouteHop path_conv_10_conv;
10104                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10105                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10106                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10107                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10108                 path_constr.data[k] = path_conv_10_conv;
10109         }
10110         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10111         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10112 }
10113
10114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10115         void* this_arg_ptr = untag_ptr(this_arg);
10116         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10117         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10118         LDKCVec_RouteHopZ path_constr;
10119         path_constr.datalen = (*env)->GetArrayLength(env, path);
10120         if (path_constr.datalen > 0)
10121                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10122         else
10123                 path_constr.data = NULL;
10124         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10125         for (size_t k = 0; k < path_constr.datalen; k++) {
10126                 int64_t path_conv_10 = path_vals[k];
10127                 LDKRouteHop path_conv_10_conv;
10128                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10129                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10130                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10131                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10132                 path_constr.data[k] = path_conv_10_conv;
10133         }
10134         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10135         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
10136 }
10137
10138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10139         void* this_arg_ptr = untag_ptr(this_arg);
10140         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10141         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10142         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10143         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10144         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10145         CVec_u8Z_free(ret_var);
10146         return ret_arr;
10147 }
10148
10149 typedef struct LDKPersister_JCalls {
10150         atomic_size_t refcnt;
10151         JavaVM *vm;
10152         jweak o;
10153         jmethodID persist_manager_meth;
10154         jmethodID persist_graph_meth;
10155         jmethodID persist_scorer_meth;
10156 } LDKPersister_JCalls;
10157 static void LDKPersister_JCalls_free(void* this_arg) {
10158         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10159         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10160                 JNIEnv *env;
10161                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10162                 if (get_jenv_res == JNI_EDETACHED) {
10163                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10164                 } else {
10165                         DO_ASSERT(get_jenv_res == JNI_OK);
10166                 }
10167                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10168                 if (get_jenv_res == JNI_EDETACHED) {
10169                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10170                 }
10171                 FREE(j_calls);
10172         }
10173 }
10174 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10175         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10176         JNIEnv *env;
10177         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10178         if (get_jenv_res == JNI_EDETACHED) {
10179                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10180         } else {
10181                 DO_ASSERT(get_jenv_res == JNI_OK);
10182         }
10183         LDKChannelManager channel_manager_var = *channel_manager;
10184         int64_t channel_manager_ref = 0;
10185         // WARNING: we may need a move here but no clone is available for LDKChannelManager
10186         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
10187         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
10188         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10189         CHECK(obj != NULL);
10190         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10191         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10192                 (*env)->ExceptionDescribe(env);
10193                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
10194         }
10195         void* ret_ptr = untag_ptr(ret);
10196         CHECK_ACCESS(ret_ptr);
10197         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10198         FREE(untag_ptr(ret));
10199         if (get_jenv_res == JNI_EDETACHED) {
10200                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10201         }
10202         return ret_conv;
10203 }
10204 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
10205         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10206         JNIEnv *env;
10207         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10208         if (get_jenv_res == JNI_EDETACHED) {
10209                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10210         } else {
10211                 DO_ASSERT(get_jenv_res == JNI_OK);
10212         }
10213         LDKNetworkGraph network_graph_var = *network_graph;
10214         int64_t network_graph_ref = 0;
10215         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
10216         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
10217         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
10218         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10219         CHECK(obj != NULL);
10220         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
10221         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10222                 (*env)->ExceptionDescribe(env);
10223                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
10224         }
10225         void* ret_ptr = untag_ptr(ret);
10226         CHECK_ACCESS(ret_ptr);
10227         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10228         FREE(untag_ptr(ret));
10229         if (get_jenv_res == JNI_EDETACHED) {
10230                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10231         }
10232         return ret_conv;
10233 }
10234 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
10235         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10236         JNIEnv *env;
10237         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10238         if (get_jenv_res == JNI_EDETACHED) {
10239                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10240         } else {
10241                 DO_ASSERT(get_jenv_res == JNI_OK);
10242         }
10243         LDKMultiThreadedLockableScore scorer_var = *scorer;
10244         int64_t scorer_ref = 0;
10245         // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
10246         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
10247         scorer_ref = tag_ptr(scorer_var.inner, scorer_var.is_owned);
10248         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10249         CHECK(obj != NULL);
10250         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, scorer_ref);
10251         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10252                 (*env)->ExceptionDescribe(env);
10253                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
10254         }
10255         void* ret_ptr = untag_ptr(ret);
10256         CHECK_ACCESS(ret_ptr);
10257         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10258         FREE(untag_ptr(ret));
10259         if (get_jenv_res == JNI_EDETACHED) {
10260                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10261         }
10262         return ret_conv;
10263 }
10264 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
10265         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
10266         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10267 }
10268 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
10269         jclass c = (*env)->GetObjectClass(env, o);
10270         CHECK(c != NULL);
10271         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
10272         atomic_init(&calls->refcnt, 1);
10273         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10274         calls->o = (*env)->NewWeakGlobalRef(env, o);
10275         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10276         CHECK(calls->persist_manager_meth != NULL);
10277         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
10278         CHECK(calls->persist_graph_meth != NULL);
10279         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
10280         CHECK(calls->persist_scorer_meth != NULL);
10281
10282         LDKPersister ret = {
10283                 .this_arg = (void*) calls,
10284                 .persist_manager = persist_manager_LDKPersister_jcall,
10285                 .persist_graph = persist_graph_LDKPersister_jcall,
10286                 .persist_scorer = persist_scorer_LDKPersister_jcall,
10287                 .free = LDKPersister_JCalls_free,
10288         };
10289         return ret;
10290 }
10291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10292         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
10293         *res_ptr = LDKPersister_init(env, clz, o);
10294         return tag_ptr(res_ptr, true);
10295 }
10296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10297         void* this_arg_ptr = untag_ptr(this_arg);
10298         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10299         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10300         LDKChannelManager channel_manager_conv;
10301         channel_manager_conv.inner = untag_ptr(channel_manager);
10302         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
10303         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10304         channel_manager_conv.is_owned = false;
10305         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10306         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10307         return tag_ptr(ret_conv, true);
10308 }
10309
10310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
10311         void* this_arg_ptr = untag_ptr(this_arg);
10312         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10313         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10314         LDKNetworkGraph network_graph_conv;
10315         network_graph_conv.inner = untag_ptr(network_graph);
10316         network_graph_conv.is_owned = ptr_is_owned(network_graph);
10317         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
10318         network_graph_conv.is_owned = false;
10319         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10320         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
10321         return tag_ptr(ret_conv, true);
10322 }
10323
10324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
10325         void* this_arg_ptr = untag_ptr(this_arg);
10326         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10327         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10328         LDKMultiThreadedLockableScore scorer_conv;
10329         scorer_conv.inner = untag_ptr(scorer);
10330         scorer_conv.is_owned = ptr_is_owned(scorer);
10331         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
10332         scorer_conv.is_owned = false;
10333         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10334         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
10335         return tag_ptr(ret_conv, true);
10336 }
10337
10338 typedef struct LDKListen_JCalls {
10339         atomic_size_t refcnt;
10340         JavaVM *vm;
10341         jweak o;
10342         jmethodID filtered_block_connected_meth;
10343         jmethodID block_connected_meth;
10344         jmethodID block_disconnected_meth;
10345 } LDKListen_JCalls;
10346 static void LDKListen_JCalls_free(void* this_arg) {
10347         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10348         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10349                 JNIEnv *env;
10350                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10351                 if (get_jenv_res == JNI_EDETACHED) {
10352                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10353                 } else {
10354                         DO_ASSERT(get_jenv_res == JNI_OK);
10355                 }
10356                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10357                 if (get_jenv_res == JNI_EDETACHED) {
10358                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10359                 }
10360                 FREE(j_calls);
10361         }
10362 }
10363 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10364         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10365         JNIEnv *env;
10366         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10367         if (get_jenv_res == JNI_EDETACHED) {
10368                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10369         } else {
10370                 DO_ASSERT(get_jenv_res == JNI_OK);
10371         }
10372         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10373         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10374         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10375         int64_tArray txdata_arr = NULL;
10376         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10377         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10378         for (size_t c = 0; c < txdata_var.datalen; c++) {
10379                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10380                 *txdata_conv_28_conv = txdata_var.data[c];
10381                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
10382         }
10383         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10384         FREE(txdata_var.data);
10385         int32_t height_conv = height;
10386         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10387         CHECK(obj != NULL);
10388         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
10389         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10390                 (*env)->ExceptionDescribe(env);
10391                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
10392         }
10393         if (get_jenv_res == JNI_EDETACHED) {
10394                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10395         }
10396 }
10397 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
10398         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10399         JNIEnv *env;
10400         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10401         if (get_jenv_res == JNI_EDETACHED) {
10402                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10403         } else {
10404                 DO_ASSERT(get_jenv_res == JNI_OK);
10405         }
10406         LDKu8slice block_var = block;
10407         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
10408         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
10409         int32_t height_conv = height;
10410         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10411         CHECK(obj != NULL);
10412         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
10413         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10414                 (*env)->ExceptionDescribe(env);
10415                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
10416         }
10417         if (get_jenv_res == JNI_EDETACHED) {
10418                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10419         }
10420 }
10421 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10422         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10423         JNIEnv *env;
10424         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10425         if (get_jenv_res == JNI_EDETACHED) {
10426                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10427         } else {
10428                 DO_ASSERT(get_jenv_res == JNI_OK);
10429         }
10430         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10431         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10432         int32_t height_conv = height;
10433         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10434         CHECK(obj != NULL);
10435         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
10436         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10437                 (*env)->ExceptionDescribe(env);
10438                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
10439         }
10440         if (get_jenv_res == JNI_EDETACHED) {
10441                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10442         }
10443 }
10444 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
10445         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
10446         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10447 }
10448 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
10449         jclass c = (*env)->GetObjectClass(env, o);
10450         CHECK(c != NULL);
10451         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
10452         atomic_init(&calls->refcnt, 1);
10453         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10454         calls->o = (*env)->NewWeakGlobalRef(env, o);
10455         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
10456         CHECK(calls->filtered_block_connected_meth != NULL);
10457         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
10458         CHECK(calls->block_connected_meth != NULL);
10459         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
10460         CHECK(calls->block_disconnected_meth != NULL);
10461
10462         LDKListen ret = {
10463                 .this_arg = (void*) calls,
10464                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
10465                 .block_connected = block_connected_LDKListen_jcall,
10466                 .block_disconnected = block_disconnected_LDKListen_jcall,
10467                 .free = LDKListen_JCalls_free,
10468         };
10469         return ret;
10470 }
10471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
10472         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
10473         *res_ptr = LDKListen_init(env, clz, o);
10474         return tag_ptr(res_ptr, true);
10475 }
10476 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) {
10477         void* this_arg_ptr = untag_ptr(this_arg);
10478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10479         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10480         unsigned char header_arr[80];
10481         CHECK((*env)->GetArrayLength(env, header) == 80);
10482         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10483         unsigned char (*header_ref)[80] = &header_arr;
10484         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10485         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10486         if (txdata_constr.datalen > 0)
10487                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10488         else
10489                 txdata_constr.data = NULL;
10490         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10491         for (size_t c = 0; c < txdata_constr.datalen; c++) {
10492                 int64_t txdata_conv_28 = txdata_vals[c];
10493                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
10494                 CHECK_ACCESS(txdata_conv_28_ptr);
10495                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10496                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
10497                 txdata_constr.data[c] = txdata_conv_28_conv;
10498         }
10499         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10500         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10501 }
10502
10503 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) {
10504         void* this_arg_ptr = untag_ptr(this_arg);
10505         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10506         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10507         LDKu8slice block_ref;
10508         block_ref.datalen = (*env)->GetArrayLength(env, block);
10509         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
10510         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
10511         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
10512 }
10513
10514 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) {
10515         void* this_arg_ptr = untag_ptr(this_arg);
10516         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10517         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10518         unsigned char header_arr[80];
10519         CHECK((*env)->GetArrayLength(env, header) == 80);
10520         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10521         unsigned char (*header_ref)[80] = &header_arr;
10522         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
10523 }
10524
10525 typedef struct LDKConfirm_JCalls {
10526         atomic_size_t refcnt;
10527         JavaVM *vm;
10528         jweak o;
10529         jmethodID transactions_confirmed_meth;
10530         jmethodID transaction_unconfirmed_meth;
10531         jmethodID best_block_updated_meth;
10532         jmethodID get_relevant_txids_meth;
10533 } LDKConfirm_JCalls;
10534 static void LDKConfirm_JCalls_free(void* this_arg) {
10535         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10536         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10537                 JNIEnv *env;
10538                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10539                 if (get_jenv_res == JNI_EDETACHED) {
10540                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10541                 } else {
10542                         DO_ASSERT(get_jenv_res == JNI_OK);
10543                 }
10544                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10545                 if (get_jenv_res == JNI_EDETACHED) {
10546                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10547                 }
10548                 FREE(j_calls);
10549         }
10550 }
10551 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10552         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10553         JNIEnv *env;
10554         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10555         if (get_jenv_res == JNI_EDETACHED) {
10556                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10557         } else {
10558                 DO_ASSERT(get_jenv_res == JNI_OK);
10559         }
10560         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10561         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10562         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10563         int64_tArray txdata_arr = NULL;
10564         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10565         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10566         for (size_t c = 0; c < txdata_var.datalen; c++) {
10567                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10568                 *txdata_conv_28_conv = txdata_var.data[c];
10569                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
10570         }
10571         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10572         FREE(txdata_var.data);
10573         int32_t height_conv = height;
10574         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10575         CHECK(obj != NULL);
10576         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
10577         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10578                 (*env)->ExceptionDescribe(env);
10579                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
10580         }
10581         if (get_jenv_res == JNI_EDETACHED) {
10582                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10583         }
10584 }
10585 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
10586         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10587         JNIEnv *env;
10588         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10589         if (get_jenv_res == JNI_EDETACHED) {
10590                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10591         } else {
10592                 DO_ASSERT(get_jenv_res == JNI_OK);
10593         }
10594         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10595         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10596         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10597         CHECK(obj != NULL);
10598         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
10599         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10600                 (*env)->ExceptionDescribe(env);
10601                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
10602         }
10603         if (get_jenv_res == JNI_EDETACHED) {
10604                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10605         }
10606 }
10607 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10608         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10609         JNIEnv *env;
10610         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10611         if (get_jenv_res == JNI_EDETACHED) {
10612                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10613         } else {
10614                 DO_ASSERT(get_jenv_res == JNI_OK);
10615         }
10616         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10617         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10618         int32_t height_conv = height;
10619         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10620         CHECK(obj != NULL);
10621         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
10622         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10623                 (*env)->ExceptionDescribe(env);
10624                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
10625         }
10626         if (get_jenv_res == JNI_EDETACHED) {
10627                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10628         }
10629 }
10630 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
10631         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10632         JNIEnv *env;
10633         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10634         if (get_jenv_res == JNI_EDETACHED) {
10635                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10636         } else {
10637                 DO_ASSERT(get_jenv_res == JNI_OK);
10638         }
10639         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10640         CHECK(obj != NULL);
10641         jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
10642         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10643                 (*env)->ExceptionDescribe(env);
10644                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
10645         }
10646         LDKCVec_TxidZ ret_constr;
10647         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10648         if (ret_constr.datalen > 0)
10649                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10650         else
10651                 ret_constr.data = NULL;
10652         for (size_t i = 0; i < ret_constr.datalen; i++) {
10653                 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
10654                 LDKThirtyTwoBytes ret_conv_8_ref;
10655                 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
10656                 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
10657                 ret_constr.data[i] = ret_conv_8_ref;
10658         }
10659         if (get_jenv_res == JNI_EDETACHED) {
10660                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10661         }
10662         return ret_constr;
10663 }
10664 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
10665         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
10666         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10667 }
10668 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
10669         jclass c = (*env)->GetObjectClass(env, o);
10670         CHECK(c != NULL);
10671         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
10672         atomic_init(&calls->refcnt, 1);
10673         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10674         calls->o = (*env)->NewWeakGlobalRef(env, o);
10675         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
10676         CHECK(calls->transactions_confirmed_meth != NULL);
10677         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
10678         CHECK(calls->transaction_unconfirmed_meth != NULL);
10679         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
10680         CHECK(calls->best_block_updated_meth != NULL);
10681         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
10682         CHECK(calls->get_relevant_txids_meth != NULL);
10683
10684         LDKConfirm ret = {
10685                 .this_arg = (void*) calls,
10686                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
10687                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
10688                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
10689                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
10690                 .free = LDKConfirm_JCalls_free,
10691         };
10692         return ret;
10693 }
10694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
10695         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
10696         *res_ptr = LDKConfirm_init(env, clz, o);
10697         return tag_ptr(res_ptr, true);
10698 }
10699 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) {
10700         void* this_arg_ptr = untag_ptr(this_arg);
10701         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10702         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10703         unsigned char header_arr[80];
10704         CHECK((*env)->GetArrayLength(env, header) == 80);
10705         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10706         unsigned char (*header_ref)[80] = &header_arr;
10707         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10708         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10709         if (txdata_constr.datalen > 0)
10710                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10711         else
10712                 txdata_constr.data = NULL;
10713         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10714         for (size_t c = 0; c < txdata_constr.datalen; c++) {
10715                 int64_t txdata_conv_28 = txdata_vals[c];
10716                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
10717                 CHECK_ACCESS(txdata_conv_28_ptr);
10718                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10719                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
10720                 txdata_constr.data[c] = txdata_conv_28_conv;
10721         }
10722         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10723         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10724 }
10725
10726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
10727         void* this_arg_ptr = untag_ptr(this_arg);
10728         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10729         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10730         unsigned char txid_arr[32];
10731         CHECK((*env)->GetArrayLength(env, txid) == 32);
10732         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10733         unsigned char (*txid_ref)[32] = &txid_arr;
10734         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
10735 }
10736
10737 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) {
10738         void* this_arg_ptr = untag_ptr(this_arg);
10739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10740         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10741         unsigned char header_arr[80];
10742         CHECK((*env)->GetArrayLength(env, header) == 80);
10743         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10744         unsigned char (*header_ref)[80] = &header_arr;
10745         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
10746 }
10747
10748 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
10749         void* this_arg_ptr = untag_ptr(this_arg);
10750         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10751         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10752         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
10753         jobjectArray ret_arr = NULL;
10754         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10755         ;
10756         for (size_t i = 0; i < ret_var.datalen; i++) {
10757                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
10758                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
10759                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10760         }
10761         
10762         FREE(ret_var.data);
10763         return ret_arr;
10764 }
10765
10766 typedef struct LDKPersist_JCalls {
10767         atomic_size_t refcnt;
10768         JavaVM *vm;
10769         jweak o;
10770         jmethodID persist_new_channel_meth;
10771         jmethodID update_persisted_channel_meth;
10772 } LDKPersist_JCalls;
10773 static void LDKPersist_JCalls_free(void* this_arg) {
10774         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10775         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10776                 JNIEnv *env;
10777                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10778                 if (get_jenv_res == JNI_EDETACHED) {
10779                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10780                 } else {
10781                         DO_ASSERT(get_jenv_res == JNI_OK);
10782                 }
10783                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10784                 if (get_jenv_res == JNI_EDETACHED) {
10785                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10786                 }
10787                 FREE(j_calls);
10788         }
10789 }
10790 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10791         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10792         JNIEnv *env;
10793         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10794         if (get_jenv_res == JNI_EDETACHED) {
10795                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10796         } else {
10797                 DO_ASSERT(get_jenv_res == JNI_OK);
10798         }
10799         LDKOutPoint channel_id_var = channel_id;
10800         int64_t channel_id_ref = 0;
10801         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10802         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
10803         LDKChannelMonitor data_var = *data;
10804         int64_t data_ref = 0;
10805         data_var = ChannelMonitor_clone(&data_var);
10806         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10807         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
10808         LDKMonitorUpdateId update_id_var = update_id;
10809         int64_t update_id_ref = 0;
10810         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10811         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
10812         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10813         CHECK(obj != NULL);
10814         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
10815         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10816                 (*env)->ExceptionDescribe(env);
10817                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
10818         }
10819         void* ret_ptr = untag_ptr(ret);
10820         CHECK_ACCESS(ret_ptr);
10821         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10822         FREE(untag_ptr(ret));
10823         if (get_jenv_res == JNI_EDETACHED) {
10824                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10825         }
10826         return ret_conv;
10827 }
10828 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10829         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10830         JNIEnv *env;
10831         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10832         if (get_jenv_res == JNI_EDETACHED) {
10833                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10834         } else {
10835                 DO_ASSERT(get_jenv_res == JNI_OK);
10836         }
10837         LDKOutPoint channel_id_var = channel_id;
10838         int64_t channel_id_ref = 0;
10839         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10840         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
10841         LDKChannelMonitorUpdate update_var = *update;
10842         int64_t update_ref = 0;
10843         update_var = ChannelMonitorUpdate_clone(&update_var);
10844         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
10845         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
10846         LDKChannelMonitor data_var = *data;
10847         int64_t data_ref = 0;
10848         data_var = ChannelMonitor_clone(&data_var);
10849         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10850         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
10851         LDKMonitorUpdateId update_id_var = update_id;
10852         int64_t update_id_ref = 0;
10853         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10854         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
10855         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10856         CHECK(obj != NULL);
10857         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
10858         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10859                 (*env)->ExceptionDescribe(env);
10860                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
10861         }
10862         void* ret_ptr = untag_ptr(ret);
10863         CHECK_ACCESS(ret_ptr);
10864         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10865         FREE(untag_ptr(ret));
10866         if (get_jenv_res == JNI_EDETACHED) {
10867                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10868         }
10869         return ret_conv;
10870 }
10871 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
10872         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
10873         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10874 }
10875 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
10876         jclass c = (*env)->GetObjectClass(env, o);
10877         CHECK(c != NULL);
10878         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
10879         atomic_init(&calls->refcnt, 1);
10880         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10881         calls->o = (*env)->NewWeakGlobalRef(env, o);
10882         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
10883         CHECK(calls->persist_new_channel_meth != NULL);
10884         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
10885         CHECK(calls->update_persisted_channel_meth != NULL);
10886
10887         LDKPersist ret = {
10888                 .this_arg = (void*) calls,
10889                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
10890                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
10891                 .free = LDKPersist_JCalls_free,
10892         };
10893         return ret;
10894 }
10895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
10896         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
10897         *res_ptr = LDKPersist_init(env, clz, o);
10898         return tag_ptr(res_ptr, true);
10899 }
10900 JNIEXPORT int64_t 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) {
10901         void* this_arg_ptr = untag_ptr(this_arg);
10902         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10903         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10904         LDKOutPoint channel_id_conv;
10905         channel_id_conv.inner = untag_ptr(channel_id);
10906         channel_id_conv.is_owned = ptr_is_owned(channel_id);
10907         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10908         channel_id_conv = OutPoint_clone(&channel_id_conv);
10909         LDKChannelMonitor data_conv;
10910         data_conv.inner = untag_ptr(data);
10911         data_conv.is_owned = ptr_is_owned(data);
10912         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10913         data_conv.is_owned = false;
10914         LDKMonitorUpdateId update_id_conv;
10915         update_id_conv.inner = untag_ptr(update_id);
10916         update_id_conv.is_owned = ptr_is_owned(update_id);
10917         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10918         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10919         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10920         *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
10921         return tag_ptr(ret_conv, true);
10922 }
10923
10924 JNIEXPORT int64_t 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) {
10925         void* this_arg_ptr = untag_ptr(this_arg);
10926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10927         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10928         LDKOutPoint channel_id_conv;
10929         channel_id_conv.inner = untag_ptr(channel_id);
10930         channel_id_conv.is_owned = ptr_is_owned(channel_id);
10931         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10932         channel_id_conv = OutPoint_clone(&channel_id_conv);
10933         LDKChannelMonitorUpdate update_conv;
10934         update_conv.inner = untag_ptr(update);
10935         update_conv.is_owned = ptr_is_owned(update);
10936         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
10937         update_conv.is_owned = false;
10938         LDKChannelMonitor data_conv;
10939         data_conv.inner = untag_ptr(data);
10940         data_conv.is_owned = ptr_is_owned(data);
10941         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10942         data_conv.is_owned = false;
10943         LDKMonitorUpdateId update_id_conv;
10944         update_id_conv.inner = untag_ptr(update_id);
10945         update_id_conv.is_owned = ptr_is_owned(update_id);
10946         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10947         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10948         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10949         *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
10950         return tag_ptr(ret_conv, true);
10951 }
10952
10953 typedef struct LDKChannelMessageHandler_JCalls {
10954         atomic_size_t refcnt;
10955         JavaVM *vm;
10956         jweak o;
10957         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10958         jmethodID handle_open_channel_meth;
10959         jmethodID handle_accept_channel_meth;
10960         jmethodID handle_funding_created_meth;
10961         jmethodID handle_funding_signed_meth;
10962         jmethodID handle_channel_ready_meth;
10963         jmethodID handle_shutdown_meth;
10964         jmethodID handle_closing_signed_meth;
10965         jmethodID handle_update_add_htlc_meth;
10966         jmethodID handle_update_fulfill_htlc_meth;
10967         jmethodID handle_update_fail_htlc_meth;
10968         jmethodID handle_update_fail_malformed_htlc_meth;
10969         jmethodID handle_commitment_signed_meth;
10970         jmethodID handle_revoke_and_ack_meth;
10971         jmethodID handle_update_fee_meth;
10972         jmethodID handle_announcement_signatures_meth;
10973         jmethodID peer_disconnected_meth;
10974         jmethodID peer_connected_meth;
10975         jmethodID handle_channel_reestablish_meth;
10976         jmethodID handle_channel_update_meth;
10977         jmethodID handle_error_meth;
10978 } LDKChannelMessageHandler_JCalls;
10979 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10980         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10981         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10982                 JNIEnv *env;
10983                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10984                 if (get_jenv_res == JNI_EDETACHED) {
10985                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10986                 } else {
10987                         DO_ASSERT(get_jenv_res == JNI_OK);
10988                 }
10989                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10990                 if (get_jenv_res == JNI_EDETACHED) {
10991                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10992                 }
10993                 FREE(j_calls);
10994         }
10995 }
10996 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
10997         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10998         JNIEnv *env;
10999         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11000         if (get_jenv_res == JNI_EDETACHED) {
11001                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11002         } else {
11003                 DO_ASSERT(get_jenv_res == JNI_OK);
11004         }
11005         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11006         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11007         LDKInitFeatures their_features_var = their_features;
11008         int64_t their_features_ref = 0;
11009         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11010         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11011         LDKOpenChannel msg_var = *msg;
11012         int64_t msg_ref = 0;
11013         msg_var = OpenChannel_clone(&msg_var);
11014         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11015         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11016         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11017         CHECK(obj != NULL);
11018         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11019         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11020                 (*env)->ExceptionDescribe(env);
11021                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
11022         }
11023         if (get_jenv_res == JNI_EDETACHED) {
11024                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11025         }
11026 }
11027 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
11028         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11029         JNIEnv *env;
11030         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11031         if (get_jenv_res == JNI_EDETACHED) {
11032                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11033         } else {
11034                 DO_ASSERT(get_jenv_res == JNI_OK);
11035         }
11036         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11037         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11038         LDKInitFeatures their_features_var = their_features;
11039         int64_t their_features_ref = 0;
11040         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11041         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11042         LDKAcceptChannel msg_var = *msg;
11043         int64_t msg_ref = 0;
11044         msg_var = AcceptChannel_clone(&msg_var);
11045         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11046         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11047         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11048         CHECK(obj != NULL);
11049         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11050         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11051                 (*env)->ExceptionDescribe(env);
11052                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
11053         }
11054         if (get_jenv_res == JNI_EDETACHED) {
11055                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11056         }
11057 }
11058 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
11059         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11060         JNIEnv *env;
11061         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11062         if (get_jenv_res == JNI_EDETACHED) {
11063                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11064         } else {
11065                 DO_ASSERT(get_jenv_res == JNI_OK);
11066         }
11067         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11068         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11069         LDKFundingCreated msg_var = *msg;
11070         int64_t msg_ref = 0;
11071         msg_var = FundingCreated_clone(&msg_var);
11072         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11073         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11074         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11075         CHECK(obj != NULL);
11076         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
11077         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11078                 (*env)->ExceptionDescribe(env);
11079                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
11080         }
11081         if (get_jenv_res == JNI_EDETACHED) {
11082                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11083         }
11084 }
11085 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
11086         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11087         JNIEnv *env;
11088         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11089         if (get_jenv_res == JNI_EDETACHED) {
11090                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11091         } else {
11092                 DO_ASSERT(get_jenv_res == JNI_OK);
11093         }
11094         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11095         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11096         LDKFundingSigned msg_var = *msg;
11097         int64_t msg_ref = 0;
11098         msg_var = FundingSigned_clone(&msg_var);
11099         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11100         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11101         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11102         CHECK(obj != NULL);
11103         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
11104         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11105                 (*env)->ExceptionDescribe(env);
11106                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
11107         }
11108         if (get_jenv_res == JNI_EDETACHED) {
11109                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11110         }
11111 }
11112 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
11113         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11114         JNIEnv *env;
11115         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11116         if (get_jenv_res == JNI_EDETACHED) {
11117                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11118         } else {
11119                 DO_ASSERT(get_jenv_res == JNI_OK);
11120         }
11121         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11122         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11123         LDKChannelReady msg_var = *msg;
11124         int64_t msg_ref = 0;
11125         msg_var = ChannelReady_clone(&msg_var);
11126         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11127         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11128         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11129         CHECK(obj != NULL);
11130         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
11131         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11132                 (*env)->ExceptionDescribe(env);
11133                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
11134         }
11135         if (get_jenv_res == JNI_EDETACHED) {
11136                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11137         }
11138 }
11139 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
11140         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11141         JNIEnv *env;
11142         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11143         if (get_jenv_res == JNI_EDETACHED) {
11144                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11145         } else {
11146                 DO_ASSERT(get_jenv_res == JNI_OK);
11147         }
11148         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11149         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11150         LDKInitFeatures their_features_var = *their_features;
11151         int64_t their_features_ref = 0;
11152         their_features_var = InitFeatures_clone(&their_features_var);
11153         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11154         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11155         LDKShutdown msg_var = *msg;
11156         int64_t msg_ref = 0;
11157         msg_var = Shutdown_clone(&msg_var);
11158         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11159         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11160         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11161         CHECK(obj != NULL);
11162         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
11163         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11164                 (*env)->ExceptionDescribe(env);
11165                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
11166         }
11167         if (get_jenv_res == JNI_EDETACHED) {
11168                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11169         }
11170 }
11171 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11172         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11173         JNIEnv *env;
11174         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11175         if (get_jenv_res == JNI_EDETACHED) {
11176                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11177         } else {
11178                 DO_ASSERT(get_jenv_res == JNI_OK);
11179         }
11180         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11181         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11182         LDKClosingSigned msg_var = *msg;
11183         int64_t msg_ref = 0;
11184         msg_var = ClosingSigned_clone(&msg_var);
11185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11186         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11187         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11188         CHECK(obj != NULL);
11189         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
11190         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11191                 (*env)->ExceptionDescribe(env);
11192                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
11193         }
11194         if (get_jenv_res == JNI_EDETACHED) {
11195                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11196         }
11197 }
11198 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11199         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11200         JNIEnv *env;
11201         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11202         if (get_jenv_res == JNI_EDETACHED) {
11203                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11204         } else {
11205                 DO_ASSERT(get_jenv_res == JNI_OK);
11206         }
11207         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11208         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11209         LDKUpdateAddHTLC msg_var = *msg;
11210         int64_t msg_ref = 0;
11211         msg_var = UpdateAddHTLC_clone(&msg_var);
11212         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11213         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11214         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11215         CHECK(obj != NULL);
11216         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
11217         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11218                 (*env)->ExceptionDescribe(env);
11219                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
11220         }
11221         if (get_jenv_res == JNI_EDETACHED) {
11222                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11223         }
11224 }
11225 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11226         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11227         JNIEnv *env;
11228         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11229         if (get_jenv_res == JNI_EDETACHED) {
11230                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11231         } else {
11232                 DO_ASSERT(get_jenv_res == JNI_OK);
11233         }
11234         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11235         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11236         LDKUpdateFulfillHTLC msg_var = *msg;
11237         int64_t msg_ref = 0;
11238         msg_var = UpdateFulfillHTLC_clone(&msg_var);
11239         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11240         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11241         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11242         CHECK(obj != NULL);
11243         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
11244         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11245                 (*env)->ExceptionDescribe(env);
11246                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
11247         }
11248         if (get_jenv_res == JNI_EDETACHED) {
11249                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11250         }
11251 }
11252 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11253         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11254         JNIEnv *env;
11255         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11256         if (get_jenv_res == JNI_EDETACHED) {
11257                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11258         } else {
11259                 DO_ASSERT(get_jenv_res == JNI_OK);
11260         }
11261         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11262         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11263         LDKUpdateFailHTLC msg_var = *msg;
11264         int64_t msg_ref = 0;
11265         msg_var = UpdateFailHTLC_clone(&msg_var);
11266         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11267         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11268         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11269         CHECK(obj != NULL);
11270         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
11271         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11272                 (*env)->ExceptionDescribe(env);
11273                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
11274         }
11275         if (get_jenv_res == JNI_EDETACHED) {
11276                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11277         }
11278 }
11279 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11280         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11281         JNIEnv *env;
11282         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11283         if (get_jenv_res == JNI_EDETACHED) {
11284                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11285         } else {
11286                 DO_ASSERT(get_jenv_res == JNI_OK);
11287         }
11288         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11289         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11290         LDKUpdateFailMalformedHTLC msg_var = *msg;
11291         int64_t msg_ref = 0;
11292         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11293         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11294         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11295         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11296         CHECK(obj != NULL);
11297         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
11298         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11299                 (*env)->ExceptionDescribe(env);
11300                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
11301         }
11302         if (get_jenv_res == JNI_EDETACHED) {
11303                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11304         }
11305 }
11306 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11307         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11308         JNIEnv *env;
11309         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11310         if (get_jenv_res == JNI_EDETACHED) {
11311                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11312         } else {
11313                 DO_ASSERT(get_jenv_res == JNI_OK);
11314         }
11315         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11316         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11317         LDKCommitmentSigned msg_var = *msg;
11318         int64_t msg_ref = 0;
11319         msg_var = CommitmentSigned_clone(&msg_var);
11320         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11321         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11322         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11323         CHECK(obj != NULL);
11324         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
11325         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11326                 (*env)->ExceptionDescribe(env);
11327                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
11328         }
11329         if (get_jenv_res == JNI_EDETACHED) {
11330                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11331         }
11332 }
11333 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
11334         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11335         JNIEnv *env;
11336         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11337         if (get_jenv_res == JNI_EDETACHED) {
11338                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11339         } else {
11340                 DO_ASSERT(get_jenv_res == JNI_OK);
11341         }
11342         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11343         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11344         LDKRevokeAndACK msg_var = *msg;
11345         int64_t msg_ref = 0;
11346         msg_var = RevokeAndACK_clone(&msg_var);
11347         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11348         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11349         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11350         CHECK(obj != NULL);
11351         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
11352         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11353                 (*env)->ExceptionDescribe(env);
11354                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
11355         }
11356         if (get_jenv_res == JNI_EDETACHED) {
11357                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11358         }
11359 }
11360 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
11361         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11362         JNIEnv *env;
11363         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11364         if (get_jenv_res == JNI_EDETACHED) {
11365                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11366         } else {
11367                 DO_ASSERT(get_jenv_res == JNI_OK);
11368         }
11369         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11370         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11371         LDKUpdateFee msg_var = *msg;
11372         int64_t msg_ref = 0;
11373         msg_var = UpdateFee_clone(&msg_var);
11374         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11375         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11376         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11377         CHECK(obj != NULL);
11378         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
11379         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11380                 (*env)->ExceptionDescribe(env);
11381                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
11382         }
11383         if (get_jenv_res == JNI_EDETACHED) {
11384                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11385         }
11386 }
11387 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
11388         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11389         JNIEnv *env;
11390         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11391         if (get_jenv_res == JNI_EDETACHED) {
11392                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11393         } else {
11394                 DO_ASSERT(get_jenv_res == JNI_OK);
11395         }
11396         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11397         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11398         LDKAnnouncementSignatures msg_var = *msg;
11399         int64_t msg_ref = 0;
11400         msg_var = AnnouncementSignatures_clone(&msg_var);
11401         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11402         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11403         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11404         CHECK(obj != NULL);
11405         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
11406         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11407                 (*env)->ExceptionDescribe(env);
11408                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
11409         }
11410         if (get_jenv_res == JNI_EDETACHED) {
11411                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11412         }
11413 }
11414 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
11415         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11416         JNIEnv *env;
11417         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11418         if (get_jenv_res == JNI_EDETACHED) {
11419                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11420         } else {
11421                 DO_ASSERT(get_jenv_res == JNI_OK);
11422         }
11423         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11424         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11425         jboolean no_connection_possible_conv = no_connection_possible;
11426         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11427         CHECK(obj != NULL);
11428         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
11429         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11430                 (*env)->ExceptionDescribe(env);
11431                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
11432         }
11433         if (get_jenv_res == JNI_EDETACHED) {
11434                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11435         }
11436 }
11437 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
11438         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11439         JNIEnv *env;
11440         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11441         if (get_jenv_res == JNI_EDETACHED) {
11442                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11443         } else {
11444                 DO_ASSERT(get_jenv_res == JNI_OK);
11445         }
11446         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11447         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11448         LDKInit msg_var = *msg;
11449         int64_t msg_ref = 0;
11450         msg_var = Init_clone(&msg_var);
11451         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11452         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11453         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11454         CHECK(obj != NULL);
11455         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
11456         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11457                 (*env)->ExceptionDescribe(env);
11458                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
11459         }
11460         if (get_jenv_res == JNI_EDETACHED) {
11461                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11462         }
11463 }
11464 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
11465         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11466         JNIEnv *env;
11467         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11468         if (get_jenv_res == JNI_EDETACHED) {
11469                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11470         } else {
11471                 DO_ASSERT(get_jenv_res == JNI_OK);
11472         }
11473         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11474         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11475         LDKChannelReestablish msg_var = *msg;
11476         int64_t msg_ref = 0;
11477         msg_var = ChannelReestablish_clone(&msg_var);
11478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11479         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11480         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11481         CHECK(obj != NULL);
11482         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
11483         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11484                 (*env)->ExceptionDescribe(env);
11485                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
11486         }
11487         if (get_jenv_res == JNI_EDETACHED) {
11488                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11489         }
11490 }
11491 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
11492         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11493         JNIEnv *env;
11494         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11495         if (get_jenv_res == JNI_EDETACHED) {
11496                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11497         } else {
11498                 DO_ASSERT(get_jenv_res == JNI_OK);
11499         }
11500         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11501         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11502         LDKChannelUpdate msg_var = *msg;
11503         int64_t msg_ref = 0;
11504         msg_var = ChannelUpdate_clone(&msg_var);
11505         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11506         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11507         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11508         CHECK(obj != NULL);
11509         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
11510         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11511                 (*env)->ExceptionDescribe(env);
11512                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
11513         }
11514         if (get_jenv_res == JNI_EDETACHED) {
11515                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11516         }
11517 }
11518 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
11519         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11520         JNIEnv *env;
11521         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11522         if (get_jenv_res == JNI_EDETACHED) {
11523                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11524         } else {
11525                 DO_ASSERT(get_jenv_res == JNI_OK);
11526         }
11527         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11528         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11529         LDKErrorMessage msg_var = *msg;
11530         int64_t msg_ref = 0;
11531         msg_var = ErrorMessage_clone(&msg_var);
11532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11533         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11534         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11535         CHECK(obj != NULL);
11536         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
11537         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11538                 (*env)->ExceptionDescribe(env);
11539                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
11540         }
11541         if (get_jenv_res == JNI_EDETACHED) {
11542                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11543         }
11544 }
11545 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11546         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11547         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11548         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11549 }
11550 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11551         jclass c = (*env)->GetObjectClass(env, o);
11552         CHECK(c != NULL);
11553         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11554         atomic_init(&calls->refcnt, 1);
11555         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11556         calls->o = (*env)->NewWeakGlobalRef(env, o);
11557         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
11558         CHECK(calls->handle_open_channel_meth != NULL);
11559         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
11560         CHECK(calls->handle_accept_channel_meth != NULL);
11561         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
11562         CHECK(calls->handle_funding_created_meth != NULL);
11563         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
11564         CHECK(calls->handle_funding_signed_meth != NULL);
11565         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
11566         CHECK(calls->handle_channel_ready_meth != NULL);
11567         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
11568         CHECK(calls->handle_shutdown_meth != NULL);
11569         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
11570         CHECK(calls->handle_closing_signed_meth != NULL);
11571         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
11572         CHECK(calls->handle_update_add_htlc_meth != NULL);
11573         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
11574         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
11575         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
11576         CHECK(calls->handle_update_fail_htlc_meth != NULL);
11577         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
11578         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
11579         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
11580         CHECK(calls->handle_commitment_signed_meth != NULL);
11581         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
11582         CHECK(calls->handle_revoke_and_ack_meth != NULL);
11583         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
11584         CHECK(calls->handle_update_fee_meth != NULL);
11585         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
11586         CHECK(calls->handle_announcement_signatures_meth != NULL);
11587         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
11588         CHECK(calls->peer_disconnected_meth != NULL);
11589         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
11590         CHECK(calls->peer_connected_meth != NULL);
11591         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
11592         CHECK(calls->handle_channel_reestablish_meth != NULL);
11593         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
11594         CHECK(calls->handle_channel_update_meth != NULL);
11595         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
11596         CHECK(calls->handle_error_meth != NULL);
11597
11598         LDKChannelMessageHandler ret = {
11599                 .this_arg = (void*) calls,
11600                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11601                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
11602                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
11603                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
11604                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
11605                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
11606                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
11607                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
11608                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
11609                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
11610                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
11611                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
11612                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
11613                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
11614                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
11615                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
11616                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
11617                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
11618                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
11619                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
11620                 .free = LDKChannelMessageHandler_JCalls_free,
11621                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11622         };
11623         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11624         return ret;
11625 }
11626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11627         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11628         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11629         return tag_ptr(res_ptr, true);
11630 }
11631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11632         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
11633         return tag_ptr(&inp->MessageSendEventsProvider, false);
11634 }
11635 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 their_features, int64_t msg) {
11636         void* this_arg_ptr = untag_ptr(this_arg);
11637         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11638         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11639         LDKPublicKey their_node_id_ref;
11640         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11641         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11642         LDKInitFeatures their_features_conv;
11643         their_features_conv.inner = untag_ptr(their_features);
11644         their_features_conv.is_owned = ptr_is_owned(their_features);
11645         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11646         their_features_conv = InitFeatures_clone(&their_features_conv);
11647         LDKOpenChannel msg_conv;
11648         msg_conv.inner = untag_ptr(msg);
11649         msg_conv.is_owned = ptr_is_owned(msg);
11650         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11651         msg_conv.is_owned = false;
11652         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11653 }
11654
11655 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 their_features, int64_t msg) {
11656         void* this_arg_ptr = untag_ptr(this_arg);
11657         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11658         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11659         LDKPublicKey their_node_id_ref;
11660         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11661         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11662         LDKInitFeatures their_features_conv;
11663         their_features_conv.inner = untag_ptr(their_features);
11664         their_features_conv.is_owned = ptr_is_owned(their_features);
11665         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11666         their_features_conv = InitFeatures_clone(&their_features_conv);
11667         LDKAcceptChannel msg_conv;
11668         msg_conv.inner = untag_ptr(msg);
11669         msg_conv.is_owned = ptr_is_owned(msg);
11670         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11671         msg_conv.is_owned = false;
11672         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11673 }
11674
11675 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) {
11676         void* this_arg_ptr = untag_ptr(this_arg);
11677         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11678         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11679         LDKPublicKey their_node_id_ref;
11680         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11681         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11682         LDKFundingCreated msg_conv;
11683         msg_conv.inner = untag_ptr(msg);
11684         msg_conv.is_owned = ptr_is_owned(msg);
11685         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11686         msg_conv.is_owned = false;
11687         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11688 }
11689
11690 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) {
11691         void* this_arg_ptr = untag_ptr(this_arg);
11692         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11693         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11694         LDKPublicKey their_node_id_ref;
11695         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11696         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11697         LDKFundingSigned msg_conv;
11698         msg_conv.inner = untag_ptr(msg);
11699         msg_conv.is_owned = ptr_is_owned(msg);
11700         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11701         msg_conv.is_owned = false;
11702         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11703 }
11704
11705 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) {
11706         void* this_arg_ptr = untag_ptr(this_arg);
11707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11708         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11709         LDKPublicKey their_node_id_ref;
11710         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11711         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11712         LDKChannelReady msg_conv;
11713         msg_conv.inner = untag_ptr(msg);
11714         msg_conv.is_owned = ptr_is_owned(msg);
11715         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11716         msg_conv.is_owned = false;
11717         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11718 }
11719
11720 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 their_features, int64_t msg) {
11721         void* this_arg_ptr = untag_ptr(this_arg);
11722         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11723         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11724         LDKPublicKey their_node_id_ref;
11725         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11726         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11727         LDKInitFeatures their_features_conv;
11728         their_features_conv.inner = untag_ptr(their_features);
11729         their_features_conv.is_owned = ptr_is_owned(their_features);
11730         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11731         their_features_conv.is_owned = false;
11732         LDKShutdown msg_conv;
11733         msg_conv.inner = untag_ptr(msg);
11734         msg_conv.is_owned = ptr_is_owned(msg);
11735         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11736         msg_conv.is_owned = false;
11737         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
11738 }
11739
11740 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) {
11741         void* this_arg_ptr = untag_ptr(this_arg);
11742         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11743         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11744         LDKPublicKey their_node_id_ref;
11745         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11746         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11747         LDKClosingSigned msg_conv;
11748         msg_conv.inner = untag_ptr(msg);
11749         msg_conv.is_owned = ptr_is_owned(msg);
11750         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11751         msg_conv.is_owned = false;
11752         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11753 }
11754
11755 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) {
11756         void* this_arg_ptr = untag_ptr(this_arg);
11757         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11758         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11759         LDKPublicKey their_node_id_ref;
11760         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11761         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11762         LDKUpdateAddHTLC msg_conv;
11763         msg_conv.inner = untag_ptr(msg);
11764         msg_conv.is_owned = ptr_is_owned(msg);
11765         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11766         msg_conv.is_owned = false;
11767         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11768 }
11769
11770 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) {
11771         void* this_arg_ptr = untag_ptr(this_arg);
11772         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11773         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11774         LDKPublicKey their_node_id_ref;
11775         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11776         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11777         LDKUpdateFulfillHTLC msg_conv;
11778         msg_conv.inner = untag_ptr(msg);
11779         msg_conv.is_owned = ptr_is_owned(msg);
11780         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11781         msg_conv.is_owned = false;
11782         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11783 }
11784
11785 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) {
11786         void* this_arg_ptr = untag_ptr(this_arg);
11787         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11788         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11789         LDKPublicKey their_node_id_ref;
11790         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11791         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11792         LDKUpdateFailHTLC msg_conv;
11793         msg_conv.inner = untag_ptr(msg);
11794         msg_conv.is_owned = ptr_is_owned(msg);
11795         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11796         msg_conv.is_owned = false;
11797         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11798 }
11799
11800 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) {
11801         void* this_arg_ptr = untag_ptr(this_arg);
11802         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11803         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11804         LDKPublicKey their_node_id_ref;
11805         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11806         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11807         LDKUpdateFailMalformedHTLC msg_conv;
11808         msg_conv.inner = untag_ptr(msg);
11809         msg_conv.is_owned = ptr_is_owned(msg);
11810         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11811         msg_conv.is_owned = false;
11812         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11813 }
11814
11815 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) {
11816         void* this_arg_ptr = untag_ptr(this_arg);
11817         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11818         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11819         LDKPublicKey their_node_id_ref;
11820         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11821         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11822         LDKCommitmentSigned msg_conv;
11823         msg_conv.inner = untag_ptr(msg);
11824         msg_conv.is_owned = ptr_is_owned(msg);
11825         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11826         msg_conv.is_owned = false;
11827         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11828 }
11829
11830 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) {
11831         void* this_arg_ptr = untag_ptr(this_arg);
11832         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11833         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11834         LDKPublicKey their_node_id_ref;
11835         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11836         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11837         LDKRevokeAndACK msg_conv;
11838         msg_conv.inner = untag_ptr(msg);
11839         msg_conv.is_owned = ptr_is_owned(msg);
11840         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11841         msg_conv.is_owned = false;
11842         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11843 }
11844
11845 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) {
11846         void* this_arg_ptr = untag_ptr(this_arg);
11847         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11848         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11849         LDKPublicKey their_node_id_ref;
11850         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11851         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11852         LDKUpdateFee msg_conv;
11853         msg_conv.inner = untag_ptr(msg);
11854         msg_conv.is_owned = ptr_is_owned(msg);
11855         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11856         msg_conv.is_owned = false;
11857         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11858 }
11859
11860 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) {
11861         void* this_arg_ptr = untag_ptr(this_arg);
11862         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11863         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11864         LDKPublicKey their_node_id_ref;
11865         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11866         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11867         LDKAnnouncementSignatures msg_conv;
11868         msg_conv.inner = untag_ptr(msg);
11869         msg_conv.is_owned = ptr_is_owned(msg);
11870         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11871         msg_conv.is_owned = false;
11872         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11873 }
11874
11875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
11876         void* this_arg_ptr = untag_ptr(this_arg);
11877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11878         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11879         LDKPublicKey their_node_id_ref;
11880         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11881         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11882         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
11883 }
11884
11885 JNIEXPORT void 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) {
11886         void* this_arg_ptr = untag_ptr(this_arg);
11887         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11888         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11889         LDKPublicKey their_node_id_ref;
11890         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11891         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11892         LDKInit msg_conv;
11893         msg_conv.inner = untag_ptr(msg);
11894         msg_conv.is_owned = ptr_is_owned(msg);
11895         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11896         msg_conv.is_owned = false;
11897         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11898 }
11899
11900 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) {
11901         void* this_arg_ptr = untag_ptr(this_arg);
11902         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11903         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11904         LDKPublicKey their_node_id_ref;
11905         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11906         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11907         LDKChannelReestablish msg_conv;
11908         msg_conv.inner = untag_ptr(msg);
11909         msg_conv.is_owned = ptr_is_owned(msg);
11910         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11911         msg_conv.is_owned = false;
11912         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11913 }
11914
11915 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) {
11916         void* this_arg_ptr = untag_ptr(this_arg);
11917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11918         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11919         LDKPublicKey their_node_id_ref;
11920         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11921         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11922         LDKChannelUpdate msg_conv;
11923         msg_conv.inner = untag_ptr(msg);
11924         msg_conv.is_owned = ptr_is_owned(msg);
11925         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11926         msg_conv.is_owned = false;
11927         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11928 }
11929
11930 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) {
11931         void* this_arg_ptr = untag_ptr(this_arg);
11932         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11933         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11934         LDKPublicKey their_node_id_ref;
11935         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11936         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11937         LDKErrorMessage msg_conv;
11938         msg_conv.inner = untag_ptr(msg);
11939         msg_conv.is_owned = ptr_is_owned(msg);
11940         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11941         msg_conv.is_owned = false;
11942         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11943 }
11944
11945 typedef struct LDKRoutingMessageHandler_JCalls {
11946         atomic_size_t refcnt;
11947         JavaVM *vm;
11948         jweak o;
11949         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11950         jmethodID handle_node_announcement_meth;
11951         jmethodID handle_channel_announcement_meth;
11952         jmethodID handle_channel_update_meth;
11953         jmethodID get_next_channel_announcements_meth;
11954         jmethodID get_next_node_announcements_meth;
11955         jmethodID peer_connected_meth;
11956         jmethodID handle_reply_channel_range_meth;
11957         jmethodID handle_reply_short_channel_ids_end_meth;
11958         jmethodID handle_query_channel_range_meth;
11959         jmethodID handle_query_short_channel_ids_meth;
11960 } LDKRoutingMessageHandler_JCalls;
11961 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
11962         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11963         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11964                 JNIEnv *env;
11965                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11966                 if (get_jenv_res == JNI_EDETACHED) {
11967                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11968                 } else {
11969                         DO_ASSERT(get_jenv_res == JNI_OK);
11970                 }
11971                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11972                 if (get_jenv_res == JNI_EDETACHED) {
11973                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11974                 }
11975                 FREE(j_calls);
11976         }
11977 }
11978 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
11979         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11980         JNIEnv *env;
11981         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11982         if (get_jenv_res == JNI_EDETACHED) {
11983                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11984         } else {
11985                 DO_ASSERT(get_jenv_res == JNI_OK);
11986         }
11987         LDKNodeAnnouncement msg_var = *msg;
11988         int64_t msg_ref = 0;
11989         msg_var = NodeAnnouncement_clone(&msg_var);
11990         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11991         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11992         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11993         CHECK(obj != NULL);
11994         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
11995         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11996                 (*env)->ExceptionDescribe(env);
11997                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11998         }
11999         void* ret_ptr = untag_ptr(ret);
12000         CHECK_ACCESS(ret_ptr);
12001         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12002         FREE(untag_ptr(ret));
12003         if (get_jenv_res == JNI_EDETACHED) {
12004                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12005         }
12006         return ret_conv;
12007 }
12008 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
12009         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12010         JNIEnv *env;
12011         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12012         if (get_jenv_res == JNI_EDETACHED) {
12013                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12014         } else {
12015                 DO_ASSERT(get_jenv_res == JNI_OK);
12016         }
12017         LDKChannelAnnouncement msg_var = *msg;
12018         int64_t msg_ref = 0;
12019         msg_var = ChannelAnnouncement_clone(&msg_var);
12020         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12021         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12022         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12023         CHECK(obj != NULL);
12024         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
12025         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12026                 (*env)->ExceptionDescribe(env);
12027                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12028         }
12029         void* ret_ptr = untag_ptr(ret);
12030         CHECK_ACCESS(ret_ptr);
12031         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12032         FREE(untag_ptr(ret));
12033         if (get_jenv_res == JNI_EDETACHED) {
12034                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12035         }
12036         return ret_conv;
12037 }
12038 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
12039         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12040         JNIEnv *env;
12041         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12042         if (get_jenv_res == JNI_EDETACHED) {
12043                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12044         } else {
12045                 DO_ASSERT(get_jenv_res == JNI_OK);
12046         }
12047         LDKChannelUpdate msg_var = *msg;
12048         int64_t msg_ref = 0;
12049         msg_var = ChannelUpdate_clone(&msg_var);
12050         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12051         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12052         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12053         CHECK(obj != NULL);
12054         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
12055         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12056                 (*env)->ExceptionDescribe(env);
12057                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
12058         }
12059         void* ret_ptr = untag_ptr(ret);
12060         CHECK_ACCESS(ret_ptr);
12061         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12062         FREE(untag_ptr(ret));
12063         if (get_jenv_res == JNI_EDETACHED) {
12064                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12065         }
12066         return ret_conv;
12067 }
12068 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
12069         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12070         JNIEnv *env;
12071         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12072         if (get_jenv_res == JNI_EDETACHED) {
12073                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12074         } else {
12075                 DO_ASSERT(get_jenv_res == JNI_OK);
12076         }
12077         int64_t starting_point_conv = starting_point;
12078         int8_t batch_amount_conv = batch_amount;
12079         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12080         CHECK(obj != NULL);
12081         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point_conv, batch_amount_conv);
12082         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12083                 (*env)->ExceptionDescribe(env);
12084                 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12085         }
12086         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
12087         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12088         if (ret_constr.datalen > 0)
12089                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
12090         else
12091                 ret_constr.data = NULL;
12092         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12093         for (size_t h = 0; h < ret_constr.datalen; h++) {
12094                 int64_t ret_conv_59 = ret_vals[h];
12095                 void* ret_conv_59_ptr = untag_ptr(ret_conv_59);
12096                 CHECK_ACCESS(ret_conv_59_ptr);
12097                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
12098                 FREE(untag_ptr(ret_conv_59));
12099                 ret_constr.data[h] = ret_conv_59_conv;
12100         }
12101         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12102         if (get_jenv_res == JNI_EDETACHED) {
12103                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12104         }
12105         return ret_constr;
12106 }
12107 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
12108         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12109         JNIEnv *env;
12110         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12111         if (get_jenv_res == JNI_EDETACHED) {
12112                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12113         } else {
12114                 DO_ASSERT(get_jenv_res == JNI_OK);
12115         }
12116         int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
12117         (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
12118         int8_t batch_amount_conv = batch_amount;
12119         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12120         CHECK(obj != NULL);
12121         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount_conv);
12122         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12123                 (*env)->ExceptionDescribe(env);
12124                 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12125         }
12126         LDKCVec_NodeAnnouncementZ ret_constr;
12127         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12128         if (ret_constr.datalen > 0)
12129                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
12130         else
12131                 ret_constr.data = NULL;
12132         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12133         for (size_t s = 0; s < ret_constr.datalen; s++) {
12134                 int64_t ret_conv_18 = ret_vals[s];
12135                 LDKNodeAnnouncement ret_conv_18_conv;
12136                 ret_conv_18_conv.inner = untag_ptr(ret_conv_18);
12137                 ret_conv_18_conv.is_owned = ptr_is_owned(ret_conv_18);
12138                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
12139                 ret_constr.data[s] = ret_conv_18_conv;
12140         }
12141         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12142         if (get_jenv_res == JNI_EDETACHED) {
12143                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12144         }
12145         return ret_constr;
12146 }
12147 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
12148         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12149         JNIEnv *env;
12150         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12151         if (get_jenv_res == JNI_EDETACHED) {
12152                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12153         } else {
12154                 DO_ASSERT(get_jenv_res == JNI_OK);
12155         }
12156         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12157         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12158         LDKInit init_var = *init;
12159         int64_t init_ref = 0;
12160         init_var = Init_clone(&init_var);
12161         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12162         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
12163         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12164         CHECK(obj != NULL);
12165         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
12166         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12167                 (*env)->ExceptionDescribe(env);
12168                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
12169         }
12170         if (get_jenv_res == JNI_EDETACHED) {
12171                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12172         }
12173 }
12174 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12175         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12176         JNIEnv *env;
12177         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12178         if (get_jenv_res == JNI_EDETACHED) {
12179                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12180         } else {
12181                 DO_ASSERT(get_jenv_res == JNI_OK);
12182         }
12183         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12184         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12185         LDKReplyChannelRange msg_var = msg;
12186         int64_t msg_ref = 0;
12187         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12188         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12189         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12190         CHECK(obj != NULL);
12191         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
12192         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12193                 (*env)->ExceptionDescribe(env);
12194                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12195         }
12196         void* ret_ptr = untag_ptr(ret);
12197         CHECK_ACCESS(ret_ptr);
12198         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12199         FREE(untag_ptr(ret));
12200         if (get_jenv_res == JNI_EDETACHED) {
12201                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12202         }
12203         return ret_conv;
12204 }
12205 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12206         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12207         JNIEnv *env;
12208         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12209         if (get_jenv_res == JNI_EDETACHED) {
12210                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12211         } else {
12212                 DO_ASSERT(get_jenv_res == JNI_OK);
12213         }
12214         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12215         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12216         LDKReplyShortChannelIdsEnd msg_var = msg;
12217         int64_t msg_ref = 0;
12218         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12219         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12220         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12221         CHECK(obj != NULL);
12222         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
12223         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12224                 (*env)->ExceptionDescribe(env);
12225                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
12226         }
12227         void* ret_ptr = untag_ptr(ret);
12228         CHECK_ACCESS(ret_ptr);
12229         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12230         FREE(untag_ptr(ret));
12231         if (get_jenv_res == JNI_EDETACHED) {
12232                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12233         }
12234         return ret_conv;
12235 }
12236 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12237         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12238         JNIEnv *env;
12239         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12240         if (get_jenv_res == JNI_EDETACHED) {
12241                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12242         } else {
12243                 DO_ASSERT(get_jenv_res == JNI_OK);
12244         }
12245         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12246         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12247         LDKQueryChannelRange msg_var = msg;
12248         int64_t msg_ref = 0;
12249         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12250         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12251         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12252         CHECK(obj != NULL);
12253         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
12254         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12255                 (*env)->ExceptionDescribe(env);
12256                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12257         }
12258         void* ret_ptr = untag_ptr(ret);
12259         CHECK_ACCESS(ret_ptr);
12260         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12261         FREE(untag_ptr(ret));
12262         if (get_jenv_res == JNI_EDETACHED) {
12263                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12264         }
12265         return ret_conv;
12266 }
12267 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12268         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12269         JNIEnv *env;
12270         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12271         if (get_jenv_res == JNI_EDETACHED) {
12272                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12273         } else {
12274                 DO_ASSERT(get_jenv_res == JNI_OK);
12275         }
12276         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12277         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12278         LDKQueryShortChannelIds msg_var = msg;
12279         int64_t msg_ref = 0;
12280         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12281         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12282         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12283         CHECK(obj != NULL);
12284         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
12285         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12286                 (*env)->ExceptionDescribe(env);
12287                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
12288         }
12289         void* ret_ptr = untag_ptr(ret);
12290         CHECK_ACCESS(ret_ptr);
12291         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12292         FREE(untag_ptr(ret));
12293         if (get_jenv_res == JNI_EDETACHED) {
12294                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12295         }
12296         return ret_conv;
12297 }
12298 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
12299         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
12300         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12301         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12302 }
12303 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12304         jclass c = (*env)->GetObjectClass(env, o);
12305         CHECK(c != NULL);
12306         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
12307         atomic_init(&calls->refcnt, 1);
12308         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12309         calls->o = (*env)->NewWeakGlobalRef(env, o);
12310         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
12311         CHECK(calls->handle_node_announcement_meth != NULL);
12312         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
12313         CHECK(calls->handle_channel_announcement_meth != NULL);
12314         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
12315         CHECK(calls->handle_channel_update_meth != NULL);
12316         calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
12317         CHECK(calls->get_next_channel_announcements_meth != NULL);
12318         calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
12319         CHECK(calls->get_next_node_announcements_meth != NULL);
12320         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12321         CHECK(calls->peer_connected_meth != NULL);
12322         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
12323         CHECK(calls->handle_reply_channel_range_meth != NULL);
12324         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
12325         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
12326         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
12327         CHECK(calls->handle_query_channel_range_meth != NULL);
12328         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
12329         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
12330
12331         LDKRoutingMessageHandler ret = {
12332                 .this_arg = (void*) calls,
12333                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
12334                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
12335                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
12336                 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
12337                 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
12338                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
12339                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
12340                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
12341                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
12342                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
12343                 .free = LDKRoutingMessageHandler_JCalls_free,
12344                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12345         };
12346         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12347         return ret;
12348 }
12349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12350         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12351         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12352         return tag_ptr(res_ptr, true);
12353 }
12354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12355         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
12356         return tag_ptr(&inp->MessageSendEventsProvider, false);
12357 }
12358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12359         void* this_arg_ptr = untag_ptr(this_arg);
12360         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12361         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12362         LDKNodeAnnouncement msg_conv;
12363         msg_conv.inner = untag_ptr(msg);
12364         msg_conv.is_owned = ptr_is_owned(msg);
12365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12366         msg_conv.is_owned = false;
12367         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12368         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
12369         return tag_ptr(ret_conv, true);
12370 }
12371
12372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12373         void* this_arg_ptr = untag_ptr(this_arg);
12374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12375         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12376         LDKChannelAnnouncement msg_conv;
12377         msg_conv.inner = untag_ptr(msg);
12378         msg_conv.is_owned = ptr_is_owned(msg);
12379         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12380         msg_conv.is_owned = false;
12381         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12382         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
12383         return tag_ptr(ret_conv, true);
12384 }
12385
12386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12387         void* this_arg_ptr = untag_ptr(this_arg);
12388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12389         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12390         LDKChannelUpdate msg_conv;
12391         msg_conv.inner = untag_ptr(msg);
12392         msg_conv.is_owned = ptr_is_owned(msg);
12393         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12394         msg_conv.is_owned = false;
12395         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12396         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
12397         return tag_ptr(ret_conv, true);
12398 }
12399
12400 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
12401         void* this_arg_ptr = untag_ptr(this_arg);
12402         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12403         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12404         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
12405         int64_tArray ret_arr = NULL;
12406         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12407         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12408         for (size_t h = 0; h < ret_var.datalen; h++) {
12409                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12410                 *ret_conv_59_conv = ret_var.data[h];
12411                 ret_arr_ptr[h] = tag_ptr(ret_conv_59_conv, true);
12412         }
12413         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12414         FREE(ret_var.data);
12415         return ret_arr;
12416 }
12417
12418 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
12419         void* this_arg_ptr = untag_ptr(this_arg);
12420         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12421         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12422         LDKPublicKey starting_point_ref;
12423         CHECK((*env)->GetArrayLength(env, starting_point) == 33);
12424         (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
12425         LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
12426         int64_tArray ret_arr = NULL;
12427         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12428         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12429         for (size_t s = 0; s < ret_var.datalen; s++) {
12430                 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
12431                 int64_t ret_conv_18_ref = 0;
12432                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
12433                 ret_conv_18_ref = tag_ptr(ret_conv_18_var.inner, ret_conv_18_var.is_owned);
12434                 ret_arr_ptr[s] = ret_conv_18_ref;
12435         }
12436         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12437         FREE(ret_var.data);
12438         return ret_arr;
12439 }
12440
12441 JNIEXPORT void 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) {
12442         void* this_arg_ptr = untag_ptr(this_arg);
12443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12444         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12445         LDKPublicKey their_node_id_ref;
12446         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12447         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12448         LDKInit init_conv;
12449         init_conv.inner = untag_ptr(init);
12450         init_conv.is_owned = ptr_is_owned(init);
12451         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12452         init_conv.is_owned = false;
12453         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
12454 }
12455
12456 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) {
12457         void* this_arg_ptr = untag_ptr(this_arg);
12458         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12459         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12460         LDKPublicKey their_node_id_ref;
12461         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12462         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12463         LDKReplyChannelRange msg_conv;
12464         msg_conv.inner = untag_ptr(msg);
12465         msg_conv.is_owned = ptr_is_owned(msg);
12466         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12467         msg_conv = ReplyChannelRange_clone(&msg_conv);
12468         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12469         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12470         return tag_ptr(ret_conv, true);
12471 }
12472
12473 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) {
12474         void* this_arg_ptr = untag_ptr(this_arg);
12475         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12476         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12477         LDKPublicKey their_node_id_ref;
12478         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12479         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12480         LDKReplyShortChannelIdsEnd msg_conv;
12481         msg_conv.inner = untag_ptr(msg);
12482         msg_conv.is_owned = ptr_is_owned(msg);
12483         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12484         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12485         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12486         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12487         return tag_ptr(ret_conv, true);
12488 }
12489
12490 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) {
12491         void* this_arg_ptr = untag_ptr(this_arg);
12492         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12493         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12494         LDKPublicKey their_node_id_ref;
12495         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12496         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12497         LDKQueryChannelRange msg_conv;
12498         msg_conv.inner = untag_ptr(msg);
12499         msg_conv.is_owned = ptr_is_owned(msg);
12500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12501         msg_conv = QueryChannelRange_clone(&msg_conv);
12502         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12503         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12504         return tag_ptr(ret_conv, true);
12505 }
12506
12507 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) {
12508         void* this_arg_ptr = untag_ptr(this_arg);
12509         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12510         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12511         LDKPublicKey their_node_id_ref;
12512         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12513         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12514         LDKQueryShortChannelIds msg_conv;
12515         msg_conv.inner = untag_ptr(msg);
12516         msg_conv.is_owned = ptr_is_owned(msg);
12517         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12518         msg_conv = QueryShortChannelIds_clone(&msg_conv);
12519         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12520         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12521         return tag_ptr(ret_conv, true);
12522 }
12523
12524 typedef struct LDKCustomMessageReader_JCalls {
12525         atomic_size_t refcnt;
12526         JavaVM *vm;
12527         jweak o;
12528         jmethodID read_meth;
12529 } LDKCustomMessageReader_JCalls;
12530 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
12531         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12532         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12533                 JNIEnv *env;
12534                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12535                 if (get_jenv_res == JNI_EDETACHED) {
12536                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12537                 } else {
12538                         DO_ASSERT(get_jenv_res == JNI_OK);
12539                 }
12540                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12541                 if (get_jenv_res == JNI_EDETACHED) {
12542                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12543                 }
12544                 FREE(j_calls);
12545         }
12546 }
12547 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
12548         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12549         JNIEnv *env;
12550         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12551         if (get_jenv_res == JNI_EDETACHED) {
12552                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12553         } else {
12554                 DO_ASSERT(get_jenv_res == JNI_OK);
12555         }
12556         int16_t message_type_conv = message_type;
12557         LDKu8slice buffer_var = buffer;
12558         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
12559         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
12560         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12561         CHECK(obj != NULL);
12562         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
12563         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12564                 (*env)->ExceptionDescribe(env);
12565                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
12566         }
12567         void* ret_ptr = untag_ptr(ret);
12568         CHECK_ACCESS(ret_ptr);
12569         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
12570         FREE(untag_ptr(ret));
12571         if (get_jenv_res == JNI_EDETACHED) {
12572                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12573         }
12574         return ret_conv;
12575 }
12576 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
12577         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
12578         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12579 }
12580 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
12581         jclass c = (*env)->GetObjectClass(env, o);
12582         CHECK(c != NULL);
12583         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
12584         atomic_init(&calls->refcnt, 1);
12585         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12586         calls->o = (*env)->NewWeakGlobalRef(env, o);
12587         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
12588         CHECK(calls->read_meth != NULL);
12589
12590         LDKCustomMessageReader ret = {
12591                 .this_arg = (void*) calls,
12592                 .read = read_LDKCustomMessageReader_jcall,
12593                 .free = LDKCustomMessageReader_JCalls_free,
12594         };
12595         return ret;
12596 }
12597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
12598         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
12599         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
12600         return tag_ptr(res_ptr, true);
12601 }
12602 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) {
12603         void* this_arg_ptr = untag_ptr(this_arg);
12604         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12605         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
12606         LDKu8slice buffer_ref;
12607         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
12608         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
12609         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12610         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
12611         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
12612         return tag_ptr(ret_conv, true);
12613 }
12614
12615 typedef struct LDKCustomMessageHandler_JCalls {
12616         atomic_size_t refcnt;
12617         JavaVM *vm;
12618         jweak o;
12619         LDKCustomMessageReader_JCalls* CustomMessageReader;
12620         jmethodID handle_custom_message_meth;
12621         jmethodID get_and_clear_pending_msg_meth;
12622 } LDKCustomMessageHandler_JCalls;
12623 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
12624         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12625         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12626                 JNIEnv *env;
12627                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12628                 if (get_jenv_res == JNI_EDETACHED) {
12629                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12630                 } else {
12631                         DO_ASSERT(get_jenv_res == JNI_OK);
12632                 }
12633                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12634                 if (get_jenv_res == JNI_EDETACHED) {
12635                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12636                 }
12637                 FREE(j_calls);
12638         }
12639 }
12640 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
12641         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12642         JNIEnv *env;
12643         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12644         if (get_jenv_res == JNI_EDETACHED) {
12645                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12646         } else {
12647                 DO_ASSERT(get_jenv_res == JNI_OK);
12648         }
12649         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
12650         *msg_ret = msg;
12651         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
12652         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
12653         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12654         CHECK(obj != NULL);
12655         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
12656         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12657                 (*env)->ExceptionDescribe(env);
12658                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
12659         }
12660         void* ret_ptr = untag_ptr(ret);
12661         CHECK_ACCESS(ret_ptr);
12662         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12663         FREE(untag_ptr(ret));
12664         if (get_jenv_res == JNI_EDETACHED) {
12665                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12666         }
12667         return ret_conv;
12668 }
12669 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
12670         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12671         JNIEnv *env;
12672         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12673         if (get_jenv_res == JNI_EDETACHED) {
12674                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12675         } else {
12676                 DO_ASSERT(get_jenv_res == JNI_OK);
12677         }
12678         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12679         CHECK(obj != NULL);
12680         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
12681         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12682                 (*env)->ExceptionDescribe(env);
12683                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
12684         }
12685         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
12686         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12687         if (ret_constr.datalen > 0)
12688                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12689         else
12690                 ret_constr.data = NULL;
12691         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12692         for (size_t z = 0; z < ret_constr.datalen; z++) {
12693                 int64_t ret_conv_25 = ret_vals[z];
12694                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
12695                 CHECK_ACCESS(ret_conv_25_ptr);
12696                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
12697                 FREE(untag_ptr(ret_conv_25));
12698                 ret_constr.data[z] = ret_conv_25_conv;
12699         }
12700         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12701         if (get_jenv_res == JNI_EDETACHED) {
12702                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12703         }
12704         return ret_constr;
12705 }
12706 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
12707         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
12708         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12709         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
12710 }
12711 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12712         jclass c = (*env)->GetObjectClass(env, o);
12713         CHECK(c != NULL);
12714         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
12715         atomic_init(&calls->refcnt, 1);
12716         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12717         calls->o = (*env)->NewWeakGlobalRef(env, o);
12718         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
12719         CHECK(calls->handle_custom_message_meth != NULL);
12720         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
12721         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
12722
12723         LDKCustomMessageHandler ret = {
12724                 .this_arg = (void*) calls,
12725                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
12726                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
12727                 .free = LDKCustomMessageHandler_JCalls_free,
12728                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
12729         };
12730         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
12731         return ret;
12732 }
12733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12734         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
12735         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
12736         return tag_ptr(res_ptr, true);
12737 }
12738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
12739         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
12740         return tag_ptr(&inp->CustomMessageReader, false);
12741 }
12742 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) {
12743         void* this_arg_ptr = untag_ptr(this_arg);
12744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12745         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12746         void* msg_ptr = untag_ptr(msg);
12747         CHECK_ACCESS(msg_ptr);
12748         LDKType msg_conv = *(LDKType*)(msg_ptr);
12749         if (msg_conv.free == LDKType_JCalls_free) {
12750                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12751                 LDKType_JCalls_cloned(&msg_conv);
12752         }
12753         LDKPublicKey sender_node_id_ref;
12754         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
12755         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
12756         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12757         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
12758         return tag_ptr(ret_conv, true);
12759 }
12760
12761 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
12762         void* this_arg_ptr = untag_ptr(this_arg);
12763         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12764         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12765         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
12766         int64_tArray ret_arr = NULL;
12767         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12768         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12769         for (size_t z = 0; z < ret_var.datalen; z++) {
12770                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12771                 *ret_conv_25_conv = ret_var.data[z];
12772                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
12773         }
12774         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12775         FREE(ret_var.data);
12776         return ret_arr;
12777 }
12778
12779 typedef struct LDKSocketDescriptor_JCalls {
12780         atomic_size_t refcnt;
12781         JavaVM *vm;
12782         jweak o;
12783         jmethodID send_data_meth;
12784         jmethodID disconnect_socket_meth;
12785         jmethodID eq_meth;
12786         jmethodID hash_meth;
12787 } LDKSocketDescriptor_JCalls;
12788 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
12789         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12790         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12791                 JNIEnv *env;
12792                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12793                 if (get_jenv_res == JNI_EDETACHED) {
12794                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12795                 } else {
12796                         DO_ASSERT(get_jenv_res == JNI_OK);
12797                 }
12798                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12799                 if (get_jenv_res == JNI_EDETACHED) {
12800                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12801                 }
12802                 FREE(j_calls);
12803         }
12804 }
12805 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
12806         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12807         JNIEnv *env;
12808         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12809         if (get_jenv_res == JNI_EDETACHED) {
12810                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12811         } else {
12812                 DO_ASSERT(get_jenv_res == JNI_OK);
12813         }
12814         LDKu8slice data_var = data;
12815         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
12816         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
12817         jboolean resume_read_conv = resume_read;
12818         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12819         CHECK(obj != NULL);
12820         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
12821         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12822                 (*env)->ExceptionDescribe(env);
12823                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
12824         }
12825         if (get_jenv_res == JNI_EDETACHED) {
12826                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12827         }
12828         return ret;
12829 }
12830 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
12831         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12832         JNIEnv *env;
12833         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12834         if (get_jenv_res == JNI_EDETACHED) {
12835                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12836         } else {
12837                 DO_ASSERT(get_jenv_res == JNI_OK);
12838         }
12839         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12840         CHECK(obj != NULL);
12841         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
12842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12843                 (*env)->ExceptionDescribe(env);
12844                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
12845         }
12846         if (get_jenv_res == JNI_EDETACHED) {
12847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12848         }
12849 }
12850 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
12851         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12852         JNIEnv *env;
12853         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12854         if (get_jenv_res == JNI_EDETACHED) {
12855                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12856         } else {
12857                 DO_ASSERT(get_jenv_res == JNI_OK);
12858         }
12859         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12860         *other_arg_clone = SocketDescriptor_clone(other_arg);
12861         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12862         CHECK(obj != NULL);
12863         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
12864         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12865                 (*env)->ExceptionDescribe(env);
12866                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
12867         }
12868         if (get_jenv_res == JNI_EDETACHED) {
12869                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12870         }
12871         return ret;
12872 }
12873 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
12874         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12875         JNIEnv *env;
12876         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12877         if (get_jenv_res == JNI_EDETACHED) {
12878                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12879         } else {
12880                 DO_ASSERT(get_jenv_res == JNI_OK);
12881         }
12882         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12883         CHECK(obj != NULL);
12884         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
12885         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12886                 (*env)->ExceptionDescribe(env);
12887                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
12888         }
12889         if (get_jenv_res == JNI_EDETACHED) {
12890                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12891         }
12892         return ret;
12893 }
12894 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
12895         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
12896         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12897 }
12898 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
12899         jclass c = (*env)->GetObjectClass(env, o);
12900         CHECK(c != NULL);
12901         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
12902         atomic_init(&calls->refcnt, 1);
12903         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12904         calls->o = (*env)->NewWeakGlobalRef(env, o);
12905         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
12906         CHECK(calls->send_data_meth != NULL);
12907         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
12908         CHECK(calls->disconnect_socket_meth != NULL);
12909         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
12910         CHECK(calls->eq_meth != NULL);
12911         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
12912         CHECK(calls->hash_meth != NULL);
12913
12914         LDKSocketDescriptor ret = {
12915                 .this_arg = (void*) calls,
12916                 .send_data = send_data_LDKSocketDescriptor_jcall,
12917                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
12918                 .eq = eq_LDKSocketDescriptor_jcall,
12919                 .hash = hash_LDKSocketDescriptor_jcall,
12920                 .cloned = LDKSocketDescriptor_JCalls_cloned,
12921                 .free = LDKSocketDescriptor_JCalls_free,
12922         };
12923         return ret;
12924 }
12925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
12926         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12927         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
12928         return tag_ptr(res_ptr, true);
12929 }
12930 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) {
12931         void* this_arg_ptr = untag_ptr(this_arg);
12932         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12933         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12934         LDKu8slice data_ref;
12935         data_ref.datalen = (*env)->GetArrayLength(env, data);
12936         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
12937         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
12938         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
12939         return ret_conv;
12940 }
12941
12942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
12943         void* this_arg_ptr = untag_ptr(this_arg);
12944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12945         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12946         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
12947 }
12948
12949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
12950         void* this_arg_ptr = untag_ptr(this_arg);
12951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12952         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12953         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
12954         return ret_conv;
12955 }
12956
12957 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
12958 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
12959 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
12960 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
12961 static jclass LDKEffectiveCapacity_Total_class = NULL;
12962 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
12963 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
12964 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
12965 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
12966 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
12967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
12968         LDKEffectiveCapacity_ExactLiquidity_class =
12969                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
12970         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
12971         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
12972         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
12973         LDKEffectiveCapacity_MaximumHTLC_class =
12974                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
12975         CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
12976         LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
12977         CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
12978         LDKEffectiveCapacity_Total_class =
12979                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
12980         CHECK(LDKEffectiveCapacity_Total_class != NULL);
12981         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
12982         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
12983         LDKEffectiveCapacity_Infinite_class =
12984                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
12985         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
12986         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
12987         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
12988         LDKEffectiveCapacity_Unknown_class =
12989                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
12990         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
12991         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
12992         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
12993 }
12994 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12995         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
12996         switch(obj->tag) {
12997                 case LDKEffectiveCapacity_ExactLiquidity: {
12998                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
12999                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
13000                 }
13001                 case LDKEffectiveCapacity_MaximumHTLC: {
13002                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
13003                         return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
13004                 }
13005                 case LDKEffectiveCapacity_Total: {
13006                         int64_t capacity_msat_conv = obj->total.capacity_msat;
13007                         int64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
13008                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_ref);
13009                 }
13010                 case LDKEffectiveCapacity_Infinite: {
13011                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
13012                 }
13013                 case LDKEffectiveCapacity_Unknown: {
13014                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
13015                 }
13016                 default: abort();
13017         }
13018 }
13019 typedef struct LDKLockableScore_JCalls {
13020         atomic_size_t refcnt;
13021         JavaVM *vm;
13022         jweak o;
13023         jmethodID lock_meth;
13024 } LDKLockableScore_JCalls;
13025 static void LDKLockableScore_JCalls_free(void* this_arg) {
13026         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13027         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13028                 JNIEnv *env;
13029                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13030                 if (get_jenv_res == JNI_EDETACHED) {
13031                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13032                 } else {
13033                         DO_ASSERT(get_jenv_res == JNI_OK);
13034                 }
13035                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13036                 if (get_jenv_res == JNI_EDETACHED) {
13037                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13038                 }
13039                 FREE(j_calls);
13040         }
13041 }
13042 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
13043         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13044         JNIEnv *env;
13045         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13046         if (get_jenv_res == JNI_EDETACHED) {
13047                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13048         } else {
13049                 DO_ASSERT(get_jenv_res == JNI_OK);
13050         }
13051         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13052         CHECK(obj != NULL);
13053         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
13054         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13055                 (*env)->ExceptionDescribe(env);
13056                 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
13057         }
13058         void* ret_ptr = untag_ptr(ret);
13059         CHECK_ACCESS(ret_ptr);
13060         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
13061         if (ret_conv.free == LDKScore_JCalls_free) {
13062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13063                 LDKScore_JCalls_cloned(&ret_conv);
13064         }// WARNING: we may need a move here but no clone is available for LDKScore
13065         
13066         if (get_jenv_res == JNI_EDETACHED) {
13067                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13068         }
13069         return ret_conv;
13070 }
13071 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
13072         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
13073         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13074 }
13075 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
13076         jclass c = (*env)->GetObjectClass(env, o);
13077         CHECK(c != NULL);
13078         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
13079         atomic_init(&calls->refcnt, 1);
13080         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13081         calls->o = (*env)->NewWeakGlobalRef(env, o);
13082         calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
13083         CHECK(calls->lock_meth != NULL);
13084
13085         LDKLockableScore ret = {
13086                 .this_arg = (void*) calls,
13087                 .lock = lock_LDKLockableScore_jcall,
13088                 .free = LDKLockableScore_JCalls_free,
13089         };
13090         return ret;
13091 }
13092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
13093         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
13094         *res_ptr = LDKLockableScore_init(env, clz, o);
13095         return tag_ptr(res_ptr, true);
13096 }
13097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
13098         void* this_arg_ptr = untag_ptr(this_arg);
13099         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13100         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
13101         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
13102         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
13103         return tag_ptr(ret_ret, true);
13104 }
13105
13106 static jclass LDKGossipSync_P2P_class = NULL;
13107 static jmethodID LDKGossipSync_P2P_meth = NULL;
13108 static jclass LDKGossipSync_Rapid_class = NULL;
13109 static jmethodID LDKGossipSync_Rapid_meth = NULL;
13110 static jclass LDKGossipSync_None_class = NULL;
13111 static jmethodID LDKGossipSync_None_meth = NULL;
13112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
13113         LDKGossipSync_P2P_class =
13114                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
13115         CHECK(LDKGossipSync_P2P_class != NULL);
13116         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
13117         CHECK(LDKGossipSync_P2P_meth != NULL);
13118         LDKGossipSync_Rapid_class =
13119                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
13120         CHECK(LDKGossipSync_Rapid_class != NULL);
13121         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
13122         CHECK(LDKGossipSync_Rapid_meth != NULL);
13123         LDKGossipSync_None_class =
13124                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
13125         CHECK(LDKGossipSync_None_class != NULL);
13126         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
13127         CHECK(LDKGossipSync_None_meth != NULL);
13128 }
13129 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13130         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
13131         switch(obj->tag) {
13132                 case LDKGossipSync_P2P: {
13133                         LDKP2PGossipSync p2p_var = obj->p2p;
13134                         int64_t p2p_ref = 0;
13135                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
13136                         p2p_ref = tag_ptr(p2p_var.inner, false);
13137                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
13138                 }
13139                 case LDKGossipSync_Rapid: {
13140                         LDKRapidGossipSync rapid_var = obj->rapid;
13141                         int64_t rapid_ref = 0;
13142                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
13143                         rapid_ref = tag_ptr(rapid_var.inner, false);
13144                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
13145                 }
13146                 case LDKGossipSync_None: {
13147                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
13148                 }
13149                 default: abort();
13150         }
13151 }
13152 static jclass LDKFallback_SegWitProgram_class = NULL;
13153 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
13154 static jclass LDKFallback_PubKeyHash_class = NULL;
13155 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
13156 static jclass LDKFallback_ScriptHash_class = NULL;
13157 static jmethodID LDKFallback_ScriptHash_meth = NULL;
13158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
13159         LDKFallback_SegWitProgram_class =
13160                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
13161         CHECK(LDKFallback_SegWitProgram_class != NULL);
13162         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
13163         CHECK(LDKFallback_SegWitProgram_meth != NULL);
13164         LDKFallback_PubKeyHash_class =
13165                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
13166         CHECK(LDKFallback_PubKeyHash_class != NULL);
13167         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
13168         CHECK(LDKFallback_PubKeyHash_meth != NULL);
13169         LDKFallback_ScriptHash_class =
13170                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
13171         CHECK(LDKFallback_ScriptHash_class != NULL);
13172         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
13173         CHECK(LDKFallback_ScriptHash_meth != NULL);
13174 }
13175 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13176         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
13177         switch(obj->tag) {
13178                 case LDKFallback_SegWitProgram: {
13179                         uint8_t version_val = obj->seg_wit_program.version._0;
13180                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
13181                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
13182                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
13183                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
13184                 }
13185                 case LDKFallback_PubKeyHash: {
13186                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
13187                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
13188                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
13189                 }
13190                 case LDKFallback_ScriptHash: {
13191                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
13192                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
13193                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
13194                 }
13195                 default: abort();
13196         }
13197 }
13198 typedef struct LDKPayer_JCalls {
13199         atomic_size_t refcnt;
13200         JavaVM *vm;
13201         jweak o;
13202         jmethodID node_id_meth;
13203         jmethodID first_hops_meth;
13204         jmethodID send_payment_meth;
13205         jmethodID send_spontaneous_payment_meth;
13206         jmethodID retry_payment_meth;
13207         jmethodID abandon_payment_meth;
13208 } LDKPayer_JCalls;
13209 static void LDKPayer_JCalls_free(void* this_arg) {
13210         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13211         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13212                 JNIEnv *env;
13213                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13214                 if (get_jenv_res == JNI_EDETACHED) {
13215                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13216                 } else {
13217                         DO_ASSERT(get_jenv_res == JNI_OK);
13218                 }
13219                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13220                 if (get_jenv_res == JNI_EDETACHED) {
13221                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13222                 }
13223                 FREE(j_calls);
13224         }
13225 }
13226 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13227         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13228         JNIEnv *env;
13229         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13230         if (get_jenv_res == JNI_EDETACHED) {
13231                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13232         } else {
13233                 DO_ASSERT(get_jenv_res == JNI_OK);
13234         }
13235         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13236         CHECK(obj != NULL);
13237         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13238         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13239                 (*env)->ExceptionDescribe(env);
13240                 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13241         }
13242         LDKPublicKey ret_ref;
13243         CHECK((*env)->GetArrayLength(env, ret) == 33);
13244         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13245         if (get_jenv_res == JNI_EDETACHED) {
13246                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13247         }
13248         return ret_ref;
13249 }
13250 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13251         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13252         JNIEnv *env;
13253         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13254         if (get_jenv_res == JNI_EDETACHED) {
13255                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13256         } else {
13257                 DO_ASSERT(get_jenv_res == JNI_OK);
13258         }
13259         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13260         CHECK(obj != NULL);
13261         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13262         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13263                 (*env)->ExceptionDescribe(env);
13264                 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
13265         }
13266         LDKCVec_ChannelDetailsZ ret_constr;
13267         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13268         if (ret_constr.datalen > 0)
13269                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13270         else
13271                 ret_constr.data = NULL;
13272         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13273         for (size_t q = 0; q < ret_constr.datalen; q++) {
13274                 int64_t ret_conv_16 = ret_vals[q];
13275                 LDKChannelDetails ret_conv_16_conv;
13276                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
13277                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
13278                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
13279                 ret_constr.data[q] = ret_conv_16_conv;
13280         }
13281         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13282         if (get_jenv_res == JNI_EDETACHED) {
13283                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13284         }
13285         return ret_constr;
13286 }
13287 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
13288         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13289         JNIEnv *env;
13290         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13291         if (get_jenv_res == JNI_EDETACHED) {
13292                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13293         } else {
13294                 DO_ASSERT(get_jenv_res == JNI_OK);
13295         }
13296         LDKRoute route_var = *route;
13297         int64_t route_ref = 0;
13298         route_var = Route_clone(&route_var);
13299         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13300         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13301         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13302         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
13303         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13304         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
13305         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13306         CHECK(obj != NULL);
13307         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
13308         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13309                 (*env)->ExceptionDescribe(env);
13310                 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
13311         }
13312         void* ret_ptr = untag_ptr(ret);
13313         CHECK_ACCESS(ret_ptr);
13314         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13315         FREE(untag_ptr(ret));
13316         if (get_jenv_res == JNI_EDETACHED) {
13317                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13318         }
13319         return ret_conv;
13320 }
13321 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
13322         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13323         JNIEnv *env;
13324         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13325         if (get_jenv_res == JNI_EDETACHED) {
13326                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13327         } else {
13328                 DO_ASSERT(get_jenv_res == JNI_OK);
13329         }
13330         LDKRoute route_var = *route;
13331         int64_t route_ref = 0;
13332         route_var = Route_clone(&route_var);
13333         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13334         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13335         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13336         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
13337         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13338         CHECK(obj != NULL);
13339         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
13340         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13341                 (*env)->ExceptionDescribe(env);
13342                 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
13343         }
13344         void* ret_ptr = untag_ptr(ret);
13345         CHECK_ACCESS(ret_ptr);
13346         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13347         FREE(untag_ptr(ret));
13348         if (get_jenv_res == JNI_EDETACHED) {
13349                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13350         }
13351         return ret_conv;
13352 }
13353 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
13354         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13355         JNIEnv *env;
13356         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13357         if (get_jenv_res == JNI_EDETACHED) {
13358                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13359         } else {
13360                 DO_ASSERT(get_jenv_res == JNI_OK);
13361         }
13362         LDKRoute route_var = *route;
13363         int64_t route_ref = 0;
13364         route_var = Route_clone(&route_var);
13365         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13366         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13367         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13368         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13369         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13370         CHECK(obj != NULL);
13371         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
13372         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13373                 (*env)->ExceptionDescribe(env);
13374                 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
13375         }
13376         void* ret_ptr = untag_ptr(ret);
13377         CHECK_ACCESS(ret_ptr);
13378         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
13379         FREE(untag_ptr(ret));
13380         if (get_jenv_res == JNI_EDETACHED) {
13381                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13382         }
13383         return ret_conv;
13384 }
13385 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
13386         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13387         JNIEnv *env;
13388         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13389         if (get_jenv_res == JNI_EDETACHED) {
13390                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13391         } else {
13392                 DO_ASSERT(get_jenv_res == JNI_OK);
13393         }
13394         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13395         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13396         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13397         CHECK(obj != NULL);
13398         (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
13399         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13400                 (*env)->ExceptionDescribe(env);
13401                 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
13402         }
13403         if (get_jenv_res == JNI_EDETACHED) {
13404                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13405         }
13406 }
13407 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
13408         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
13409         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13410 }
13411 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
13412         jclass c = (*env)->GetObjectClass(env, o);
13413         CHECK(c != NULL);
13414         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
13415         atomic_init(&calls->refcnt, 1);
13416         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13417         calls->o = (*env)->NewWeakGlobalRef(env, o);
13418         calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
13419         CHECK(calls->node_id_meth != NULL);
13420         calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
13421         CHECK(calls->first_hops_meth != NULL);
13422         calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
13423         CHECK(calls->send_payment_meth != NULL);
13424         calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
13425         CHECK(calls->send_spontaneous_payment_meth != NULL);
13426         calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
13427         CHECK(calls->retry_payment_meth != NULL);
13428         calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
13429         CHECK(calls->abandon_payment_meth != NULL);
13430
13431         LDKPayer ret = {
13432                 .this_arg = (void*) calls,
13433                 .node_id = node_id_LDKPayer_jcall,
13434                 .first_hops = first_hops_LDKPayer_jcall,
13435                 .send_payment = send_payment_LDKPayer_jcall,
13436                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
13437                 .retry_payment = retry_payment_LDKPayer_jcall,
13438                 .abandon_payment = abandon_payment_LDKPayer_jcall,
13439                 .free = LDKPayer_JCalls_free,
13440         };
13441         return ret;
13442 }
13443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
13444         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
13445         *res_ptr = LDKPayer_init(env, clz, o);
13446         return tag_ptr(res_ptr, true);
13447 }
13448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13449         void* this_arg_ptr = untag_ptr(this_arg);
13450         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13451         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13452         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13453         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
13454         return ret_arr;
13455 }
13456
13457 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
13458         void* this_arg_ptr = untag_ptr(this_arg);
13459         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13460         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13461         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
13462         int64_tArray ret_arr = NULL;
13463         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13464         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13465         for (size_t q = 0; q < ret_var.datalen; q++) {
13466                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
13467                 int64_t ret_conv_16_ref = 0;
13468                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
13469                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
13470                 ret_arr_ptr[q] = ret_conv_16_ref;
13471         }
13472         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13473         FREE(ret_var.data);
13474         return ret_arr;
13475 }
13476
13477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
13478         void* this_arg_ptr = untag_ptr(this_arg);
13479         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13480         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13481         LDKRoute route_conv;
13482         route_conv.inner = untag_ptr(route);
13483         route_conv.is_owned = ptr_is_owned(route);
13484         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13485         route_conv.is_owned = false;
13486         LDKThirtyTwoBytes payment_hash_ref;
13487         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13488         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13489         LDKThirtyTwoBytes payment_secret_ref;
13490         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13491         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13492         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13493         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
13494         return tag_ptr(ret_conv, true);
13495 }
13496
13497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
13498         void* this_arg_ptr = untag_ptr(this_arg);
13499         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13500         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13501         LDKRoute route_conv;
13502         route_conv.inner = untag_ptr(route);
13503         route_conv.is_owned = ptr_is_owned(route);
13504         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13505         route_conv.is_owned = false;
13506         LDKThirtyTwoBytes payment_preimage_ref;
13507         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13508         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13509         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13510         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
13511         return tag_ptr(ret_conv, true);
13512 }
13513
13514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) {
13515         void* this_arg_ptr = untag_ptr(this_arg);
13516         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13517         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13518         LDKRoute route_conv;
13519         route_conv.inner = untag_ptr(route);
13520         route_conv.is_owned = ptr_is_owned(route);
13521         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13522         route_conv.is_owned = false;
13523         LDKThirtyTwoBytes payment_id_ref;
13524         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13525         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13526         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13527         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
13528         return tag_ptr(ret_conv, true);
13529 }
13530
13531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
13532         void* this_arg_ptr = untag_ptr(this_arg);
13533         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13534         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13535         LDKThirtyTwoBytes payment_id_ref;
13536         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13537         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13538         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
13539 }
13540
13541 typedef struct LDKRouter_JCalls {
13542         atomic_size_t refcnt;
13543         JavaVM *vm;
13544         jweak o;
13545         jmethodID find_route_meth;
13546 } LDKRouter_JCalls;
13547 static void LDKRouter_JCalls_free(void* this_arg) {
13548         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13549         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13550                 JNIEnv *env;
13551                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13552                 if (get_jenv_res == JNI_EDETACHED) {
13553                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13554                 } else {
13555                         DO_ASSERT(get_jenv_res == JNI_OK);
13556                 }
13557                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13558                 if (get_jenv_res == JNI_EDETACHED) {
13559                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13560                 }
13561                 FREE(j_calls);
13562         }
13563 }
13564 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
13565         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13566         JNIEnv *env;
13567         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13568         if (get_jenv_res == JNI_EDETACHED) {
13569                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13570         } else {
13571                 DO_ASSERT(get_jenv_res == JNI_OK);
13572         }
13573         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
13574         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
13575         LDKRouteParameters route_params_var = *route_params;
13576         int64_t route_params_ref = 0;
13577         route_params_var = RouteParameters_clone(&route_params_var);
13578         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
13579         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
13580         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13581         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
13582         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
13583         int64_tArray first_hops_arr = NULL;
13584         if (first_hops != NULL) {
13585                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
13586                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
13587                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
13588                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
13589                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
13590                         int64_t first_hops_conv_16_ref = 0;
13591                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
13592                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
13593                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
13594                 }
13595                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
13596         }
13597         // WARNING: This object doesn't live past this scope, needs clone!
13598         int64_t ret_scorer = tag_ptr(scorer, false);
13599         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13600         CHECK(obj != NULL);
13601         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, payment_hash_arr, first_hops_arr, ret_scorer);
13602         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13603                 (*env)->ExceptionDescribe(env);
13604                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
13605         }
13606         void* ret_ptr = untag_ptr(ret);
13607         CHECK_ACCESS(ret_ptr);
13608         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
13609         FREE(untag_ptr(ret));
13610         if (get_jenv_res == JNI_EDETACHED) {
13611                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13612         }
13613         return ret_conv;
13614 }
13615 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
13616         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
13617         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13618 }
13619 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
13620         jclass c = (*env)->GetObjectClass(env, o);
13621         CHECK(c != NULL);
13622         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
13623         atomic_init(&calls->refcnt, 1);
13624         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13625         calls->o = (*env)->NewWeakGlobalRef(env, o);
13626         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
13627         CHECK(calls->find_route_meth != NULL);
13628
13629         LDKRouter ret = {
13630                 .this_arg = (void*) calls,
13631                 .find_route = find_route_LDKRouter_jcall,
13632                 .free = LDKRouter_JCalls_free,
13633         };
13634         return ret;
13635 }
13636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
13637         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
13638         *res_ptr = LDKRouter_init(env, clz, o);
13639         return tag_ptr(res_ptr, true);
13640 }
13641 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, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) {
13642         void* this_arg_ptr = untag_ptr(this_arg);
13643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13644         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
13645         LDKPublicKey payer_ref;
13646         CHECK((*env)->GetArrayLength(env, payer) == 33);
13647         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
13648         LDKRouteParameters route_params_conv;
13649         route_params_conv.inner = untag_ptr(route_params);
13650         route_params_conv.is_owned = ptr_is_owned(route_params);
13651         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
13652         route_params_conv.is_owned = false;
13653         unsigned char payment_hash_arr[32];
13654         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13655         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
13656         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
13657         LDKCVec_ChannelDetailsZ first_hops_constr;
13658         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
13659         if (first_hops != NULL) {
13660                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
13661                 if (first_hops_constr.datalen > 0)
13662                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13663                 else
13664                         first_hops_constr.data = NULL;
13665                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
13666                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13667                         int64_t first_hops_conv_16 = first_hops_vals[q];
13668                         LDKChannelDetails first_hops_conv_16_conv;
13669                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
13670                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
13671                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
13672                         first_hops_conv_16_conv.is_owned = false;
13673                         first_hops_constr.data[q] = first_hops_conv_16_conv;
13674                 }
13675                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
13676                 first_hops_ptr = &first_hops_constr;
13677         }
13678         void* scorer_ptr = untag_ptr(scorer);
13679         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
13680         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
13681         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13682         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
13683         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
13684         return tag_ptr(ret_conv, true);
13685 }
13686
13687 static jclass LDKRetry_Attempts_class = NULL;
13688 static jmethodID LDKRetry_Attempts_meth = NULL;
13689 static jclass LDKRetry_Timeout_class = NULL;
13690 static jmethodID LDKRetry_Timeout_meth = NULL;
13691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
13692         LDKRetry_Attempts_class =
13693                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
13694         CHECK(LDKRetry_Attempts_class != NULL);
13695         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
13696         CHECK(LDKRetry_Attempts_meth != NULL);
13697         LDKRetry_Timeout_class =
13698                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
13699         CHECK(LDKRetry_Timeout_class != NULL);
13700         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
13701         CHECK(LDKRetry_Timeout_meth != NULL);
13702 }
13703 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13704         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
13705         switch(obj->tag) {
13706                 case LDKRetry_Attempts: {
13707                         int64_t attempts_conv = obj->attempts;
13708                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
13709                 }
13710                 case LDKRetry_Timeout: {
13711                         int64_t timeout_conv = obj->timeout;
13712                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
13713                 }
13714                 default: abort();
13715         }
13716 }
13717 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13718         LDKStr ret_str = _ldk_get_compiled_version();
13719         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13720         Str_free(ret_str);
13721         return ret_conv;
13722 }
13723
13724 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13725         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
13726         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13727         Str_free(ret_str);
13728         return ret_conv;
13729 }
13730
13731 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
13732         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
13733         *ret_copy = Bech32Error_clone(arg);
13734         int64_t ret_ref = tag_ptr(ret_copy, true);
13735         return ret_ref;
13736 }
13737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13738         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
13739         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
13740         return ret_conv;
13741 }
13742
13743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13744         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
13745         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
13746         *ret_copy = Bech32Error_clone(orig_conv);
13747         int64_t ret_ref = tag_ptr(ret_copy, true);
13748         return ret_ref;
13749 }
13750
13751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
13752         if (!ptr_is_owned(o)) return;
13753         void* o_ptr = untag_ptr(o);
13754         CHECK_ACCESS(o_ptr);
13755         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
13756         FREE(untag_ptr(o));
13757         Bech32Error_free(o_conv);
13758 }
13759
13760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
13761         LDKTransaction _res_ref;
13762         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
13763         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
13764         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
13765         _res_ref.data_is_owned = true;
13766         Transaction_free(_res_ref);
13767 }
13768
13769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
13770         LDKCVec_u8Z script_pubkey_ref;
13771         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
13772         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
13773         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
13774         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13775         *ret_ref = TxOut_new(script_pubkey_ref, value);
13776         return tag_ptr(ret_ref, true);
13777 }
13778
13779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
13780         if (!ptr_is_owned(_res)) return;
13781         void* _res_ptr = untag_ptr(_res);
13782         CHECK_ACCESS(_res_ptr);
13783         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
13784         FREE(untag_ptr(_res));
13785         TxOut_free(_res_conv);
13786 }
13787
13788 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
13789         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13790         *ret_ref = TxOut_clone(arg);
13791         return tag_ptr(ret_ref, true);
13792 }
13793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13794         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
13795         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
13796         return ret_conv;
13797 }
13798
13799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13800         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
13801         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13802         *ret_ref = TxOut_clone(orig_conv);
13803         return tag_ptr(ret_ref, true);
13804 }
13805
13806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
13807         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
13808         Str_free(dummy);
13809 }
13810
13811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
13812         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13813         *ret_conv = CResult_NoneNoneZ_ok();
13814         return tag_ptr(ret_conv, true);
13815 }
13816
13817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
13818         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13819         *ret_conv = CResult_NoneNoneZ_err();
13820         return tag_ptr(ret_conv, true);
13821 }
13822
13823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13824         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
13825         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
13826         return ret_conv;
13827 }
13828
13829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13830         if (!ptr_is_owned(_res)) return;
13831         void* _res_ptr = untag_ptr(_res);
13832         CHECK_ACCESS(_res_ptr);
13833         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
13834         FREE(untag_ptr(_res));
13835         CResult_NoneNoneZ_free(_res_conv);
13836 }
13837
13838 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
13839         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13840         *ret_conv = CResult_NoneNoneZ_clone(arg);
13841         return tag_ptr(ret_conv, true);
13842 }
13843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13844         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
13845         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
13846         return ret_conv;
13847 }
13848
13849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13850         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
13851         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13852         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
13853         return tag_ptr(ret_conv, true);
13854 }
13855
13856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13857         LDKCounterpartyCommitmentSecrets o_conv;
13858         o_conv.inner = untag_ptr(o);
13859         o_conv.is_owned = ptr_is_owned(o);
13860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13861         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
13862         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13863         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
13864         return tag_ptr(ret_conv, true);
13865 }
13866
13867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13868         LDKDecodeError e_conv;
13869         e_conv.inner = untag_ptr(e);
13870         e_conv.is_owned = ptr_is_owned(e);
13871         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13872         e_conv = DecodeError_clone(&e_conv);
13873         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13874         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
13875         return tag_ptr(ret_conv, true);
13876 }
13877
13878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13879         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
13880         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
13881         return ret_conv;
13882 }
13883
13884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13885         if (!ptr_is_owned(_res)) return;
13886         void* _res_ptr = untag_ptr(_res);
13887         CHECK_ACCESS(_res_ptr);
13888         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
13889         FREE(untag_ptr(_res));
13890         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
13891 }
13892
13893 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
13894         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13895         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
13896         return tag_ptr(ret_conv, true);
13897 }
13898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13899         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
13900         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
13901         return ret_conv;
13902 }
13903
13904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13905         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
13906         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13907         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
13908         return tag_ptr(ret_conv, true);
13909 }
13910
13911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13912         LDKSecretKey o_ref;
13913         CHECK((*env)->GetArrayLength(env, o) == 32);
13914         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
13915         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13916         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
13917         return tag_ptr(ret_conv, true);
13918 }
13919
13920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13921         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13922         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13923         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
13924         return tag_ptr(ret_conv, true);
13925 }
13926
13927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13928         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
13929         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
13930         return ret_conv;
13931 }
13932
13933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13934         if (!ptr_is_owned(_res)) return;
13935         void* _res_ptr = untag_ptr(_res);
13936         CHECK_ACCESS(_res_ptr);
13937         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
13938         FREE(untag_ptr(_res));
13939         CResult_SecretKeyErrorZ_free(_res_conv);
13940 }
13941
13942 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
13943         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13944         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
13945         return tag_ptr(ret_conv, true);
13946 }
13947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13948         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
13949         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
13950         return ret_conv;
13951 }
13952
13953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13954         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
13955         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13956         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
13957         return tag_ptr(ret_conv, true);
13958 }
13959
13960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13961         LDKPublicKey o_ref;
13962         CHECK((*env)->GetArrayLength(env, o) == 33);
13963         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
13964         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13965         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
13966         return tag_ptr(ret_conv, true);
13967 }
13968
13969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13970         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13971         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13972         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
13973         return tag_ptr(ret_conv, true);
13974 }
13975
13976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13977         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
13978         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
13979         return ret_conv;
13980 }
13981
13982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13983         if (!ptr_is_owned(_res)) return;
13984         void* _res_ptr = untag_ptr(_res);
13985         CHECK_ACCESS(_res_ptr);
13986         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
13987         FREE(untag_ptr(_res));
13988         CResult_PublicKeyErrorZ_free(_res_conv);
13989 }
13990
13991 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
13992         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13993         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
13994         return tag_ptr(ret_conv, true);
13995 }
13996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13997         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
13998         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
13999         return ret_conv;
14000 }
14001
14002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14003         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
14004         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14005         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
14006         return tag_ptr(ret_conv, true);
14007 }
14008
14009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14010         LDKTxCreationKeys o_conv;
14011         o_conv.inner = untag_ptr(o);
14012         o_conv.is_owned = ptr_is_owned(o);
14013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14014         o_conv = TxCreationKeys_clone(&o_conv);
14015         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14016         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
14017         return tag_ptr(ret_conv, true);
14018 }
14019
14020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14021         LDKDecodeError e_conv;
14022         e_conv.inner = untag_ptr(e);
14023         e_conv.is_owned = ptr_is_owned(e);
14024         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14025         e_conv = DecodeError_clone(&e_conv);
14026         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14027         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
14028         return tag_ptr(ret_conv, true);
14029 }
14030
14031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14032         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
14033         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
14034         return ret_conv;
14035 }
14036
14037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14038         if (!ptr_is_owned(_res)) return;
14039         void* _res_ptr = untag_ptr(_res);
14040         CHECK_ACCESS(_res_ptr);
14041         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
14042         FREE(untag_ptr(_res));
14043         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
14044 }
14045
14046 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
14047         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14048         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
14049         return tag_ptr(ret_conv, true);
14050 }
14051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14052         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
14053         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
14054         return ret_conv;
14055 }
14056
14057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14058         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
14059         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14060         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
14061         return tag_ptr(ret_conv, true);
14062 }
14063
14064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14065         LDKChannelPublicKeys o_conv;
14066         o_conv.inner = untag_ptr(o);
14067         o_conv.is_owned = ptr_is_owned(o);
14068         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14069         o_conv = ChannelPublicKeys_clone(&o_conv);
14070         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14071         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
14072         return tag_ptr(ret_conv, true);
14073 }
14074
14075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14076         LDKDecodeError e_conv;
14077         e_conv.inner = untag_ptr(e);
14078         e_conv.is_owned = ptr_is_owned(e);
14079         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14080         e_conv = DecodeError_clone(&e_conv);
14081         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14082         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14083         return tag_ptr(ret_conv, true);
14084 }
14085
14086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14087         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
14088         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
14089         return ret_conv;
14090 }
14091
14092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14093         if (!ptr_is_owned(_res)) return;
14094         void* _res_ptr = untag_ptr(_res);
14095         CHECK_ACCESS(_res_ptr);
14096         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
14097         FREE(untag_ptr(_res));
14098         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
14099 }
14100
14101 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
14102         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14103         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
14104         return tag_ptr(ret_conv, true);
14105 }
14106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14107         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
14108         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
14109         return ret_conv;
14110 }
14111
14112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14113         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
14114         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14115         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
14116         return tag_ptr(ret_conv, true);
14117 }
14118
14119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14120         LDKTxCreationKeys o_conv;
14121         o_conv.inner = untag_ptr(o);
14122         o_conv.is_owned = ptr_is_owned(o);
14123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14124         o_conv = TxCreationKeys_clone(&o_conv);
14125         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14126         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
14127         return tag_ptr(ret_conv, true);
14128 }
14129
14130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14131         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14132         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14133         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
14134         return tag_ptr(ret_conv, true);
14135 }
14136
14137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14138         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
14139         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
14140         return ret_conv;
14141 }
14142
14143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14144         if (!ptr_is_owned(_res)) return;
14145         void* _res_ptr = untag_ptr(_res);
14146         CHECK_ACCESS(_res_ptr);
14147         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
14148         FREE(untag_ptr(_res));
14149         CResult_TxCreationKeysErrorZ_free(_res_conv);
14150 }
14151
14152 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
14153         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14154         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
14155         return tag_ptr(ret_conv, true);
14156 }
14157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14158         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
14159         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
14160         return ret_conv;
14161 }
14162
14163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14164         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
14165         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14166         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
14167         return tag_ptr(ret_conv, true);
14168 }
14169
14170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
14171         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14172         *ret_copy = COption_u32Z_some(o);
14173         int64_t ret_ref = tag_ptr(ret_copy, true);
14174         return ret_ref;
14175 }
14176
14177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
14178         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14179         *ret_copy = COption_u32Z_none();
14180         int64_t ret_ref = tag_ptr(ret_copy, true);
14181         return ret_ref;
14182 }
14183
14184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14185         if (!ptr_is_owned(_res)) return;
14186         void* _res_ptr = untag_ptr(_res);
14187         CHECK_ACCESS(_res_ptr);
14188         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
14189         FREE(untag_ptr(_res));
14190         COption_u32Z_free(_res_conv);
14191 }
14192
14193 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
14194         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14195         *ret_copy = COption_u32Z_clone(arg);
14196         int64_t ret_ref = tag_ptr(ret_copy, true);
14197         return ret_ref;
14198 }
14199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14200         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
14201         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
14202         return ret_conv;
14203 }
14204
14205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14206         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
14207         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14208         *ret_copy = COption_u32Z_clone(orig_conv);
14209         int64_t ret_ref = tag_ptr(ret_copy, true);
14210         return ret_ref;
14211 }
14212
14213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14214         LDKHTLCOutputInCommitment o_conv;
14215         o_conv.inner = untag_ptr(o);
14216         o_conv.is_owned = ptr_is_owned(o);
14217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14218         o_conv = HTLCOutputInCommitment_clone(&o_conv);
14219         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14220         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14221         return tag_ptr(ret_conv, true);
14222 }
14223
14224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14225         LDKDecodeError e_conv;
14226         e_conv.inner = untag_ptr(e);
14227         e_conv.is_owned = ptr_is_owned(e);
14228         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14229         e_conv = DecodeError_clone(&e_conv);
14230         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14231         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14232         return tag_ptr(ret_conv, true);
14233 }
14234
14235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14236         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
14237         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
14238         return ret_conv;
14239 }
14240
14241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14242         if (!ptr_is_owned(_res)) return;
14243         void* _res_ptr = untag_ptr(_res);
14244         CHECK_ACCESS(_res_ptr);
14245         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
14246         FREE(untag_ptr(_res));
14247         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
14248 }
14249
14250 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
14251         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14252         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
14253         return tag_ptr(ret_conv, true);
14254 }
14255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14256         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
14257         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
14258         return ret_conv;
14259 }
14260
14261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14262         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
14263         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14264         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
14265         return tag_ptr(ret_conv, true);
14266 }
14267
14268 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
14269         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
14270         return ret_conv;
14271 }
14272
14273 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
14274         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
14275         return ret_conv;
14276 }
14277
14278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
14279         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
14280         COption_NoneZ_free(_res_conv);
14281 }
14282
14283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14284         LDKCounterpartyChannelTransactionParameters o_conv;
14285         o_conv.inner = untag_ptr(o);
14286         o_conv.is_owned = ptr_is_owned(o);
14287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14288         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
14289         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14290         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14291         return tag_ptr(ret_conv, true);
14292 }
14293
14294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14295         LDKDecodeError e_conv;
14296         e_conv.inner = untag_ptr(e);
14297         e_conv.is_owned = ptr_is_owned(e);
14298         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14299         e_conv = DecodeError_clone(&e_conv);
14300         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14301         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
14302         return tag_ptr(ret_conv, true);
14303 }
14304
14305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14306         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
14307         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14308         return ret_conv;
14309 }
14310
14311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14312         if (!ptr_is_owned(_res)) return;
14313         void* _res_ptr = untag_ptr(_res);
14314         CHECK_ACCESS(_res_ptr);
14315         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14316         FREE(untag_ptr(_res));
14317         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14318 }
14319
14320 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14321         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14322         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
14323         return tag_ptr(ret_conv, true);
14324 }
14325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14326         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
14327         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14328         return ret_conv;
14329 }
14330
14331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14332         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
14333         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14334         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14335         return tag_ptr(ret_conv, true);
14336 }
14337
14338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14339         LDKChannelTransactionParameters o_conv;
14340         o_conv.inner = untag_ptr(o);
14341         o_conv.is_owned = ptr_is_owned(o);
14342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14343         o_conv = ChannelTransactionParameters_clone(&o_conv);
14344         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14345         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14346         return tag_ptr(ret_conv, true);
14347 }
14348
14349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14350         LDKDecodeError e_conv;
14351         e_conv.inner = untag_ptr(e);
14352         e_conv.is_owned = ptr_is_owned(e);
14353         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14354         e_conv = DecodeError_clone(&e_conv);
14355         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14356         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
14357         return tag_ptr(ret_conv, true);
14358 }
14359
14360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14361         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
14362         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14363         return ret_conv;
14364 }
14365
14366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14367         if (!ptr_is_owned(_res)) return;
14368         void* _res_ptr = untag_ptr(_res);
14369         CHECK_ACCESS(_res_ptr);
14370         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14371         FREE(untag_ptr(_res));
14372         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14373 }
14374
14375 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14376         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14377         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
14378         return tag_ptr(ret_conv, true);
14379 }
14380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14381         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
14382         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14383         return ret_conv;
14384 }
14385
14386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14387         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
14388         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14389         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14390         return tag_ptr(ret_conv, true);
14391 }
14392
14393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14394         LDKCVec_SignatureZ _res_constr;
14395         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14396         if (_res_constr.datalen > 0)
14397                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14398         else
14399                 _res_constr.data = NULL;
14400         for (size_t i = 0; i < _res_constr.datalen; i++) {
14401                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14402                 LDKSignature _res_conv_8_ref;
14403                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
14404                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
14405                 _res_constr.data[i] = _res_conv_8_ref;
14406         }
14407         CVec_SignatureZ_free(_res_constr);
14408 }
14409
14410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14411         LDKHolderCommitmentTransaction o_conv;
14412         o_conv.inner = untag_ptr(o);
14413         o_conv.is_owned = ptr_is_owned(o);
14414         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14415         o_conv = HolderCommitmentTransaction_clone(&o_conv);
14416         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14417         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
14418         return tag_ptr(ret_conv, true);
14419 }
14420
14421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14422         LDKDecodeError e_conv;
14423         e_conv.inner = untag_ptr(e);
14424         e_conv.is_owned = ptr_is_owned(e);
14425         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14426         e_conv = DecodeError_clone(&e_conv);
14427         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14428         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
14429         return tag_ptr(ret_conv, true);
14430 }
14431
14432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14433         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14434         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14435         return ret_conv;
14436 }
14437
14438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14439         if (!ptr_is_owned(_res)) return;
14440         void* _res_ptr = untag_ptr(_res);
14441         CHECK_ACCESS(_res_ptr);
14442         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14443         FREE(untag_ptr(_res));
14444         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
14445 }
14446
14447 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14448         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14449         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
14450         return tag_ptr(ret_conv, true);
14451 }
14452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14453         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14454         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14455         return ret_conv;
14456 }
14457
14458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14459         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14460         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14461         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14462         return tag_ptr(ret_conv, true);
14463 }
14464
14465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14466         LDKBuiltCommitmentTransaction o_conv;
14467         o_conv.inner = untag_ptr(o);
14468         o_conv.is_owned = ptr_is_owned(o);
14469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14470         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
14471         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14472         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
14473         return tag_ptr(ret_conv, true);
14474 }
14475
14476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14477         LDKDecodeError e_conv;
14478         e_conv.inner = untag_ptr(e);
14479         e_conv.is_owned = ptr_is_owned(e);
14480         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14481         e_conv = DecodeError_clone(&e_conv);
14482         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14483         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
14484         return tag_ptr(ret_conv, true);
14485 }
14486
14487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14488         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14489         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14490         return ret_conv;
14491 }
14492
14493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14494         if (!ptr_is_owned(_res)) return;
14495         void* _res_ptr = untag_ptr(_res);
14496         CHECK_ACCESS(_res_ptr);
14497         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14498         FREE(untag_ptr(_res));
14499         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
14500 }
14501
14502 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14503         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14504         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
14505         return tag_ptr(ret_conv, true);
14506 }
14507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14508         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14509         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14510         return ret_conv;
14511 }
14512
14513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14514         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14515         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14516         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14517         return tag_ptr(ret_conv, true);
14518 }
14519
14520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14521         LDKTrustedClosingTransaction o_conv;
14522         o_conv.inner = untag_ptr(o);
14523         o_conv.is_owned = ptr_is_owned(o);
14524         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14525         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
14526         
14527         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14528         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
14529         return tag_ptr(ret_conv, true);
14530 }
14531
14532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14533         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14534         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
14535         return tag_ptr(ret_conv, true);
14536 }
14537
14538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14539         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
14540         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
14541         return ret_conv;
14542 }
14543
14544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14545         if (!ptr_is_owned(_res)) return;
14546         void* _res_ptr = untag_ptr(_res);
14547         CHECK_ACCESS(_res_ptr);
14548         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
14549         FREE(untag_ptr(_res));
14550         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
14551 }
14552
14553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14554         LDKCommitmentTransaction o_conv;
14555         o_conv.inner = untag_ptr(o);
14556         o_conv.is_owned = ptr_is_owned(o);
14557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14558         o_conv = CommitmentTransaction_clone(&o_conv);
14559         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14560         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
14561         return tag_ptr(ret_conv, true);
14562 }
14563
14564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14565         LDKDecodeError e_conv;
14566         e_conv.inner = untag_ptr(e);
14567         e_conv.is_owned = ptr_is_owned(e);
14568         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14569         e_conv = DecodeError_clone(&e_conv);
14570         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14571         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
14572         return tag_ptr(ret_conv, true);
14573 }
14574
14575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14576         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14577         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14578         return ret_conv;
14579 }
14580
14581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14582         if (!ptr_is_owned(_res)) return;
14583         void* _res_ptr = untag_ptr(_res);
14584         CHECK_ACCESS(_res_ptr);
14585         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
14586         FREE(untag_ptr(_res));
14587         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
14588 }
14589
14590 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14591         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14592         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
14593         return tag_ptr(ret_conv, true);
14594 }
14595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14596         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14597         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14598         return ret_conv;
14599 }
14600
14601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14602         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14603         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14604         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
14605         return tag_ptr(ret_conv, true);
14606 }
14607
14608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14609         LDKTrustedCommitmentTransaction o_conv;
14610         o_conv.inner = untag_ptr(o);
14611         o_conv.is_owned = ptr_is_owned(o);
14612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14613         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
14614         
14615         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14616         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
14617         return tag_ptr(ret_conv, true);
14618 }
14619
14620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14621         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14622         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
14623         return tag_ptr(ret_conv, true);
14624 }
14625
14626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14627         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
14628         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
14629         return ret_conv;
14630 }
14631
14632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14633         if (!ptr_is_owned(_res)) return;
14634         void* _res_ptr = untag_ptr(_res);
14635         CHECK_ACCESS(_res_ptr);
14636         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
14637         FREE(untag_ptr(_res));
14638         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
14639 }
14640
14641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
14642         LDKCVec_SignatureZ o_constr;
14643         o_constr.datalen = (*env)->GetArrayLength(env, o);
14644         if (o_constr.datalen > 0)
14645                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14646         else
14647                 o_constr.data = NULL;
14648         for (size_t i = 0; i < o_constr.datalen; i++) {
14649                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
14650                 LDKSignature o_conv_8_ref;
14651                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
14652                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
14653                 o_constr.data[i] = o_conv_8_ref;
14654         }
14655         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14656         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
14657         return tag_ptr(ret_conv, true);
14658 }
14659
14660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
14661         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14662         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
14663         return tag_ptr(ret_conv, true);
14664 }
14665
14666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14667         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
14668         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
14669         return ret_conv;
14670 }
14671
14672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14673         if (!ptr_is_owned(_res)) return;
14674         void* _res_ptr = untag_ptr(_res);
14675         CHECK_ACCESS(_res_ptr);
14676         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
14677         FREE(untag_ptr(_res));
14678         CResult_CVec_SignatureZNoneZ_free(_res_conv);
14679 }
14680
14681 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
14682         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14683         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
14684         return tag_ptr(ret_conv, true);
14685 }
14686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14687         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
14688         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
14689         return ret_conv;
14690 }
14691
14692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14693         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
14694         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14695         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
14696         return tag_ptr(ret_conv, true);
14697 }
14698
14699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14700         LDKShutdownScript o_conv;
14701         o_conv.inner = untag_ptr(o);
14702         o_conv.is_owned = ptr_is_owned(o);
14703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14704         o_conv = ShutdownScript_clone(&o_conv);
14705         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14706         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
14707         return tag_ptr(ret_conv, true);
14708 }
14709
14710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14711         LDKDecodeError e_conv;
14712         e_conv.inner = untag_ptr(e);
14713         e_conv.is_owned = ptr_is_owned(e);
14714         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14715         e_conv = DecodeError_clone(&e_conv);
14716         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14717         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
14718         return tag_ptr(ret_conv, true);
14719 }
14720
14721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14722         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
14723         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
14724         return ret_conv;
14725 }
14726
14727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14728         if (!ptr_is_owned(_res)) return;
14729         void* _res_ptr = untag_ptr(_res);
14730         CHECK_ACCESS(_res_ptr);
14731         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
14732         FREE(untag_ptr(_res));
14733         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
14734 }
14735
14736 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
14737         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14738         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
14739         return tag_ptr(ret_conv, true);
14740 }
14741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14742         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
14743         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
14744         return ret_conv;
14745 }
14746
14747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14748         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
14749         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14750         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
14751         return tag_ptr(ret_conv, true);
14752 }
14753
14754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14755         LDKShutdownScript o_conv;
14756         o_conv.inner = untag_ptr(o);
14757         o_conv.is_owned = ptr_is_owned(o);
14758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14759         o_conv = ShutdownScript_clone(&o_conv);
14760         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14761         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
14762         return tag_ptr(ret_conv, true);
14763 }
14764
14765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14766         LDKInvalidShutdownScript e_conv;
14767         e_conv.inner = untag_ptr(e);
14768         e_conv.is_owned = ptr_is_owned(e);
14769         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14770         e_conv = InvalidShutdownScript_clone(&e_conv);
14771         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14772         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
14773         return tag_ptr(ret_conv, true);
14774 }
14775
14776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14777         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
14778         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
14779         return ret_conv;
14780 }
14781
14782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14783         if (!ptr_is_owned(_res)) return;
14784         void* _res_ptr = untag_ptr(_res);
14785         CHECK_ACCESS(_res_ptr);
14786         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
14787         FREE(untag_ptr(_res));
14788         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
14789 }
14790
14791 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
14792         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14793         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
14794         return tag_ptr(ret_conv, true);
14795 }
14796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14797         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
14798         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
14799         return ret_conv;
14800 }
14801
14802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14803         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
14804         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14805         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
14806         return tag_ptr(ret_conv, true);
14807 }
14808
14809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
14810         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14811         *ret_conv = CResult_NoneErrorZ_ok();
14812         return tag_ptr(ret_conv, true);
14813 }
14814
14815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14816         LDKIOError e_conv = LDKIOError_from_java(env, e);
14817         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14818         *ret_conv = CResult_NoneErrorZ_err(e_conv);
14819         return tag_ptr(ret_conv, true);
14820 }
14821
14822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14823         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
14824         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
14825         return ret_conv;
14826 }
14827
14828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14829         if (!ptr_is_owned(_res)) return;
14830         void* _res_ptr = untag_ptr(_res);
14831         CHECK_ACCESS(_res_ptr);
14832         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
14833         FREE(untag_ptr(_res));
14834         CResult_NoneErrorZ_free(_res_conv);
14835 }
14836
14837 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
14838         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14839         *ret_conv = CResult_NoneErrorZ_clone(arg);
14840         return tag_ptr(ret_conv, true);
14841 }
14842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14843         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
14844         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
14845         return ret_conv;
14846 }
14847
14848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14849         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
14850         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14851         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
14852         return tag_ptr(ret_conv, true);
14853 }
14854
14855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14856         LDKRouteHop o_conv;
14857         o_conv.inner = untag_ptr(o);
14858         o_conv.is_owned = ptr_is_owned(o);
14859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14860         o_conv = RouteHop_clone(&o_conv);
14861         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14862         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
14863         return tag_ptr(ret_conv, true);
14864 }
14865
14866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14867         LDKDecodeError e_conv;
14868         e_conv.inner = untag_ptr(e);
14869         e_conv.is_owned = ptr_is_owned(e);
14870         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14871         e_conv = DecodeError_clone(&e_conv);
14872         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14873         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
14874         return tag_ptr(ret_conv, true);
14875 }
14876
14877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14878         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
14879         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
14880         return ret_conv;
14881 }
14882
14883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14884         if (!ptr_is_owned(_res)) return;
14885         void* _res_ptr = untag_ptr(_res);
14886         CHECK_ACCESS(_res_ptr);
14887         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
14888         FREE(untag_ptr(_res));
14889         CResult_RouteHopDecodeErrorZ_free(_res_conv);
14890 }
14891
14892 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
14893         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14894         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
14895         return tag_ptr(ret_conv, true);
14896 }
14897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14898         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
14899         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
14900         return ret_conv;
14901 }
14902
14903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14904         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
14905         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14906         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
14907         return tag_ptr(ret_conv, true);
14908 }
14909
14910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14911         LDKCVec_RouteHopZ _res_constr;
14912         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14913         if (_res_constr.datalen > 0)
14914                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14915         else
14916                 _res_constr.data = NULL;
14917         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14918         for (size_t k = 0; k < _res_constr.datalen; k++) {
14919                 int64_t _res_conv_10 = _res_vals[k];
14920                 LDKRouteHop _res_conv_10_conv;
14921                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
14922                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
14923                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
14924                 _res_constr.data[k] = _res_conv_10_conv;
14925         }
14926         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14927         CVec_RouteHopZ_free(_res_constr);
14928 }
14929
14930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14931         LDKCVec_CVec_RouteHopZZ _res_constr;
14932         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14933         if (_res_constr.datalen > 0)
14934                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14935         else
14936                 _res_constr.data = NULL;
14937         for (size_t m = 0; m < _res_constr.datalen; m++) {
14938                 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
14939                 LDKCVec_RouteHopZ _res_conv_12_constr;
14940                 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
14941                 if (_res_conv_12_constr.datalen > 0)
14942                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14943                 else
14944                         _res_conv_12_constr.data = NULL;
14945                 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
14946                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
14947                         int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
14948                         LDKRouteHop _res_conv_12_conv_10_conv;
14949                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
14950                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
14951                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
14952                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
14953                 }
14954                 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
14955                 _res_constr.data[m] = _res_conv_12_constr;
14956         }
14957         CVec_CVec_RouteHopZZ_free(_res_constr);
14958 }
14959
14960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14961         LDKRoute o_conv;
14962         o_conv.inner = untag_ptr(o);
14963         o_conv.is_owned = ptr_is_owned(o);
14964         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14965         o_conv = Route_clone(&o_conv);
14966         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14967         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
14968         return tag_ptr(ret_conv, true);
14969 }
14970
14971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14972         LDKDecodeError e_conv;
14973         e_conv.inner = untag_ptr(e);
14974         e_conv.is_owned = ptr_is_owned(e);
14975         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14976         e_conv = DecodeError_clone(&e_conv);
14977         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14978         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
14979         return tag_ptr(ret_conv, true);
14980 }
14981
14982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14983         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
14984         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
14985         return ret_conv;
14986 }
14987
14988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14989         if (!ptr_is_owned(_res)) return;
14990         void* _res_ptr = untag_ptr(_res);
14991         CHECK_ACCESS(_res_ptr);
14992         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
14993         FREE(untag_ptr(_res));
14994         CResult_RouteDecodeErrorZ_free(_res_conv);
14995 }
14996
14997 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
14998         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14999         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
15000         return tag_ptr(ret_conv, true);
15001 }
15002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15003         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
15004         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
15005         return ret_conv;
15006 }
15007
15008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15009         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
15010         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15011         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
15012         return tag_ptr(ret_conv, true);
15013 }
15014
15015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15016         LDKRouteParameters o_conv;
15017         o_conv.inner = untag_ptr(o);
15018         o_conv.is_owned = ptr_is_owned(o);
15019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15020         o_conv = RouteParameters_clone(&o_conv);
15021         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15022         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
15023         return tag_ptr(ret_conv, true);
15024 }
15025
15026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15027         LDKDecodeError e_conv;
15028         e_conv.inner = untag_ptr(e);
15029         e_conv.is_owned = ptr_is_owned(e);
15030         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15031         e_conv = DecodeError_clone(&e_conv);
15032         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15033         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
15034         return tag_ptr(ret_conv, true);
15035 }
15036
15037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15038         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
15039         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
15040         return ret_conv;
15041 }
15042
15043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15044         if (!ptr_is_owned(_res)) return;
15045         void* _res_ptr = untag_ptr(_res);
15046         CHECK_ACCESS(_res_ptr);
15047         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
15048         FREE(untag_ptr(_res));
15049         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
15050 }
15051
15052 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
15053         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15054         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
15055         return tag_ptr(ret_conv, true);
15056 }
15057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15058         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
15059         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
15060         return ret_conv;
15061 }
15062
15063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15064         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
15065         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15066         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
15067         return tag_ptr(ret_conv, true);
15068 }
15069
15070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15071         LDKCVec_RouteHintZ _res_constr;
15072         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15073         if (_res_constr.datalen > 0)
15074                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
15075         else
15076                 _res_constr.data = NULL;
15077         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15078         for (size_t l = 0; l < _res_constr.datalen; l++) {
15079                 int64_t _res_conv_11 = _res_vals[l];
15080                 LDKRouteHint _res_conv_11_conv;
15081                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
15082                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
15083                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
15084                 _res_constr.data[l] = _res_conv_11_conv;
15085         }
15086         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15087         CVec_RouteHintZ_free(_res_constr);
15088 }
15089
15090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
15091         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15092         *ret_copy = COption_u64Z_some(o);
15093         int64_t ret_ref = tag_ptr(ret_copy, true);
15094         return ret_ref;
15095 }
15096
15097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
15098         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15099         *ret_copy = COption_u64Z_none();
15100         int64_t ret_ref = tag_ptr(ret_copy, true);
15101         return ret_ref;
15102 }
15103
15104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15105         if (!ptr_is_owned(_res)) return;
15106         void* _res_ptr = untag_ptr(_res);
15107         CHECK_ACCESS(_res_ptr);
15108         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15109         FREE(untag_ptr(_res));
15110         COption_u64Z_free(_res_conv);
15111 }
15112
15113 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15114         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15115         *ret_copy = COption_u64Z_clone(arg);
15116         int64_t ret_ref = tag_ptr(ret_copy, true);
15117         return ret_ref;
15118 }
15119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15120         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
15121         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15122         return ret_conv;
15123 }
15124
15125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15126         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
15127         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15128         *ret_copy = COption_u64Z_clone(orig_conv);
15129         int64_t ret_ref = tag_ptr(ret_copy, true);
15130         return ret_ref;
15131 }
15132
15133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15134         LDKCVec_u64Z _res_constr;
15135         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15136         if (_res_constr.datalen > 0)
15137                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15138         else
15139                 _res_constr.data = NULL;
15140         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15141         for (size_t g = 0; g < _res_constr.datalen; g++) {
15142                 int64_t _res_conv_6 = _res_vals[g];
15143                 _res_constr.data[g] = _res_conv_6;
15144         }
15145         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15146         CVec_u64Z_free(_res_constr);
15147 }
15148
15149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15150         LDKPaymentParameters o_conv;
15151         o_conv.inner = untag_ptr(o);
15152         o_conv.is_owned = ptr_is_owned(o);
15153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15154         o_conv = PaymentParameters_clone(&o_conv);
15155         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15156         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
15157         return tag_ptr(ret_conv, true);
15158 }
15159
15160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15161         LDKDecodeError e_conv;
15162         e_conv.inner = untag_ptr(e);
15163         e_conv.is_owned = ptr_is_owned(e);
15164         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15165         e_conv = DecodeError_clone(&e_conv);
15166         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15167         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
15168         return tag_ptr(ret_conv, true);
15169 }
15170
15171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15172         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
15173         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
15174         return ret_conv;
15175 }
15176
15177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15178         if (!ptr_is_owned(_res)) return;
15179         void* _res_ptr = untag_ptr(_res);
15180         CHECK_ACCESS(_res_ptr);
15181         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
15182         FREE(untag_ptr(_res));
15183         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
15184 }
15185
15186 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
15187         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15188         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
15189         return tag_ptr(ret_conv, true);
15190 }
15191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15192         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
15193         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
15194         return ret_conv;
15195 }
15196
15197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15198         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
15199         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15200         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
15201         return tag_ptr(ret_conv, true);
15202 }
15203
15204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15205         LDKCVec_RouteHintHopZ _res_constr;
15206         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15207         if (_res_constr.datalen > 0)
15208                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15209         else
15210                 _res_constr.data = NULL;
15211         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15212         for (size_t o = 0; o < _res_constr.datalen; o++) {
15213                 int64_t _res_conv_14 = _res_vals[o];
15214                 LDKRouteHintHop _res_conv_14_conv;
15215                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
15216                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
15217                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15218                 _res_constr.data[o] = _res_conv_14_conv;
15219         }
15220         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15221         CVec_RouteHintHopZ_free(_res_constr);
15222 }
15223
15224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15225         LDKRouteHint o_conv;
15226         o_conv.inner = untag_ptr(o);
15227         o_conv.is_owned = ptr_is_owned(o);
15228         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15229         o_conv = RouteHint_clone(&o_conv);
15230         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15231         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15232         return tag_ptr(ret_conv, true);
15233 }
15234
15235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15236         LDKDecodeError e_conv;
15237         e_conv.inner = untag_ptr(e);
15238         e_conv.is_owned = ptr_is_owned(e);
15239         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15240         e_conv = DecodeError_clone(&e_conv);
15241         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15242         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15243         return tag_ptr(ret_conv, true);
15244 }
15245
15246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15247         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
15248         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15249         return ret_conv;
15250 }
15251
15252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15253         if (!ptr_is_owned(_res)) return;
15254         void* _res_ptr = untag_ptr(_res);
15255         CHECK_ACCESS(_res_ptr);
15256         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
15257         FREE(untag_ptr(_res));
15258         CResult_RouteHintDecodeErrorZ_free(_res_conv);
15259 }
15260
15261 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
15262         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15263         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
15264         return tag_ptr(ret_conv, true);
15265 }
15266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15267         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
15268         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
15269         return ret_conv;
15270 }
15271
15272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15273         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
15274         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15275         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
15276         return tag_ptr(ret_conv, true);
15277 }
15278
15279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15280         LDKRouteHintHop o_conv;
15281         o_conv.inner = untag_ptr(o);
15282         o_conv.is_owned = ptr_is_owned(o);
15283         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15284         o_conv = RouteHintHop_clone(&o_conv);
15285         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15286         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
15287         return tag_ptr(ret_conv, true);
15288 }
15289
15290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15291         LDKDecodeError e_conv;
15292         e_conv.inner = untag_ptr(e);
15293         e_conv.is_owned = ptr_is_owned(e);
15294         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15295         e_conv = DecodeError_clone(&e_conv);
15296         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15297         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
15298         return tag_ptr(ret_conv, true);
15299 }
15300
15301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15302         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
15303         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
15304         return ret_conv;
15305 }
15306
15307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15308         if (!ptr_is_owned(_res)) return;
15309         void* _res_ptr = untag_ptr(_res);
15310         CHECK_ACCESS(_res_ptr);
15311         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
15312         FREE(untag_ptr(_res));
15313         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
15314 }
15315
15316 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
15317         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15318         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
15319         return tag_ptr(ret_conv, true);
15320 }
15321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15322         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
15323         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
15324         return ret_conv;
15325 }
15326
15327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15328         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
15329         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15330         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
15331         return tag_ptr(ret_conv, true);
15332 }
15333
15334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15335         LDKCVec_ChannelDetailsZ _res_constr;
15336         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15337         if (_res_constr.datalen > 0)
15338                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15339         else
15340                 _res_constr.data = NULL;
15341         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15342         for (size_t q = 0; q < _res_constr.datalen; q++) {
15343                 int64_t _res_conv_16 = _res_vals[q];
15344                 LDKChannelDetails _res_conv_16_conv;
15345                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
15346                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
15347                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15348                 _res_constr.data[q] = _res_conv_16_conv;
15349         }
15350         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15351         CVec_ChannelDetailsZ_free(_res_constr);
15352 }
15353
15354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15355         LDKRoute o_conv;
15356         o_conv.inner = untag_ptr(o);
15357         o_conv.is_owned = ptr_is_owned(o);
15358         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15359         o_conv = Route_clone(&o_conv);
15360         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15361         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
15362         return tag_ptr(ret_conv, true);
15363 }
15364
15365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15366         LDKLightningError e_conv;
15367         e_conv.inner = untag_ptr(e);
15368         e_conv.is_owned = ptr_is_owned(e);
15369         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15370         e_conv = LightningError_clone(&e_conv);
15371         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15372         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
15373         return tag_ptr(ret_conv, true);
15374 }
15375
15376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15377         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
15378         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
15379         return ret_conv;
15380 }
15381
15382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15383         if (!ptr_is_owned(_res)) return;
15384         void* _res_ptr = untag_ptr(_res);
15385         CHECK_ACCESS(_res_ptr);
15386         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
15387         FREE(untag_ptr(_res));
15388         CResult_RouteLightningErrorZ_free(_res_conv);
15389 }
15390
15391 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
15392         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15393         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
15394         return tag_ptr(ret_conv, true);
15395 }
15396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15397         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
15398         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
15399         return ret_conv;
15400 }
15401
15402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15403         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
15404         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15405         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
15406         return tag_ptr(ret_conv, true);
15407 }
15408
15409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15410         LDKCVec_PublicKeyZ _res_constr;
15411         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15412         if (_res_constr.datalen > 0)
15413                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
15414         else
15415                 _res_constr.data = NULL;
15416         for (size_t i = 0; i < _res_constr.datalen; i++) {
15417                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15418                 LDKPublicKey _res_conv_8_ref;
15419                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
15420                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
15421                 _res_constr.data[i] = _res_conv_8_ref;
15422         }
15423         CVec_PublicKeyZ_free(_res_constr);
15424 }
15425
15426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15427         void* o_ptr = untag_ptr(o);
15428         CHECK_ACCESS(o_ptr);
15429         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
15430         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
15431         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15432         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
15433         return tag_ptr(ret_conv, true);
15434 }
15435
15436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15437         LDKDecodeError e_conv;
15438         e_conv.inner = untag_ptr(e);
15439         e_conv.is_owned = ptr_is_owned(e);
15440         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15441         e_conv = DecodeError_clone(&e_conv);
15442         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15443         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
15444         return tag_ptr(ret_conv, true);
15445 }
15446
15447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15448         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
15449         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
15450         return ret_conv;
15451 }
15452
15453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15454         if (!ptr_is_owned(_res)) return;
15455         void* _res_ptr = untag_ptr(_res);
15456         CHECK_ACCESS(_res_ptr);
15457         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
15458         FREE(untag_ptr(_res));
15459         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
15460 }
15461
15462 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
15463         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15464         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
15465         return tag_ptr(ret_conv, true);
15466 }
15467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15468         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
15469         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
15470         return ret_conv;
15471 }
15472
15473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15474         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
15475         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15476         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
15477         return tag_ptr(ret_conv, true);
15478 }
15479
15480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15481         void* o_ptr = untag_ptr(o);
15482         CHECK_ACCESS(o_ptr);
15483         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
15484         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
15485         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15486         *ret_copy = COption_ClosureReasonZ_some(o_conv);
15487         int64_t ret_ref = tag_ptr(ret_copy, true);
15488         return ret_ref;
15489 }
15490
15491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
15492         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15493         *ret_copy = COption_ClosureReasonZ_none();
15494         int64_t ret_ref = tag_ptr(ret_copy, true);
15495         return ret_ref;
15496 }
15497
15498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15499         if (!ptr_is_owned(_res)) return;
15500         void* _res_ptr = untag_ptr(_res);
15501         CHECK_ACCESS(_res_ptr);
15502         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
15503         FREE(untag_ptr(_res));
15504         COption_ClosureReasonZ_free(_res_conv);
15505 }
15506
15507 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
15508         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15509         *ret_copy = COption_ClosureReasonZ_clone(arg);
15510         int64_t ret_ref = tag_ptr(ret_copy, true);
15511         return ret_ref;
15512 }
15513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15514         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
15515         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
15516         return ret_conv;
15517 }
15518
15519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15520         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
15521         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15522         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
15523         int64_t ret_ref = tag_ptr(ret_copy, true);
15524         return ret_ref;
15525 }
15526
15527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15528         void* o_ptr = untag_ptr(o);
15529         CHECK_ACCESS(o_ptr);
15530         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
15531         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
15532         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15533         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
15534         return tag_ptr(ret_conv, true);
15535 }
15536
15537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15538         LDKDecodeError e_conv;
15539         e_conv.inner = untag_ptr(e);
15540         e_conv.is_owned = ptr_is_owned(e);
15541         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15542         e_conv = DecodeError_clone(&e_conv);
15543         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15544         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
15545         return tag_ptr(ret_conv, true);
15546 }
15547
15548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15549         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
15550         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
15551         return ret_conv;
15552 }
15553
15554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15555         if (!ptr_is_owned(_res)) return;
15556         void* _res_ptr = untag_ptr(_res);
15557         CHECK_ACCESS(_res_ptr);
15558         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
15559         FREE(untag_ptr(_res));
15560         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
15561 }
15562
15563 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
15564         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15565         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
15566         return tag_ptr(ret_conv, true);
15567 }
15568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15569         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
15570         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
15571         return ret_conv;
15572 }
15573
15574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15575         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
15576         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15577         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
15578         return tag_ptr(ret_conv, true);
15579 }
15580
15581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15582         void* o_ptr = untag_ptr(o);
15583         CHECK_ACCESS(o_ptr);
15584         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
15585         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
15586         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15587         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
15588         int64_t ret_ref = tag_ptr(ret_copy, true);
15589         return ret_ref;
15590 }
15591
15592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
15593         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15594         *ret_copy = COption_HTLCDestinationZ_none();
15595         int64_t ret_ref = tag_ptr(ret_copy, true);
15596         return ret_ref;
15597 }
15598
15599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15600         if (!ptr_is_owned(_res)) return;
15601         void* _res_ptr = untag_ptr(_res);
15602         CHECK_ACCESS(_res_ptr);
15603         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
15604         FREE(untag_ptr(_res));
15605         COption_HTLCDestinationZ_free(_res_conv);
15606 }
15607
15608 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
15609         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15610         *ret_copy = COption_HTLCDestinationZ_clone(arg);
15611         int64_t ret_ref = tag_ptr(ret_copy, true);
15612         return ret_ref;
15613 }
15614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15615         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
15616         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
15617         return ret_conv;
15618 }
15619
15620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15621         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
15622         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15623         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
15624         int64_t ret_ref = tag_ptr(ret_copy, true);
15625         return ret_ref;
15626 }
15627
15628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15629         void* o_ptr = untag_ptr(o);
15630         CHECK_ACCESS(o_ptr);
15631         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
15632         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
15633         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15634         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
15635         return tag_ptr(ret_conv, true);
15636 }
15637
15638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15639         LDKDecodeError e_conv;
15640         e_conv.inner = untag_ptr(e);
15641         e_conv.is_owned = ptr_is_owned(e);
15642         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15643         e_conv = DecodeError_clone(&e_conv);
15644         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15645         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
15646         return tag_ptr(ret_conv, true);
15647 }
15648
15649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15650         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
15651         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
15652         return ret_conv;
15653 }
15654
15655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15656         if (!ptr_is_owned(_res)) return;
15657         void* _res_ptr = untag_ptr(_res);
15658         CHECK_ACCESS(_res_ptr);
15659         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
15660         FREE(untag_ptr(_res));
15661         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
15662 }
15663
15664 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
15665         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15666         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
15667         return tag_ptr(ret_conv, true);
15668 }
15669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15670         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
15671         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
15672         return ret_conv;
15673 }
15674
15675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15676         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
15677         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15678         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
15679         return tag_ptr(ret_conv, true);
15680 }
15681
15682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15683         void* o_ptr = untag_ptr(o);
15684         CHECK_ACCESS(o_ptr);
15685         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
15686         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
15687         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15688         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
15689         int64_t ret_ref = tag_ptr(ret_copy, true);
15690         return ret_ref;
15691 }
15692
15693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
15694         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15695         *ret_copy = COption_NetworkUpdateZ_none();
15696         int64_t ret_ref = tag_ptr(ret_copy, true);
15697         return ret_ref;
15698 }
15699
15700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15701         if (!ptr_is_owned(_res)) return;
15702         void* _res_ptr = untag_ptr(_res);
15703         CHECK_ACCESS(_res_ptr);
15704         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
15705         FREE(untag_ptr(_res));
15706         COption_NetworkUpdateZ_free(_res_conv);
15707 }
15708
15709 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
15710         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15711         *ret_copy = COption_NetworkUpdateZ_clone(arg);
15712         int64_t ret_ref = tag_ptr(ret_copy, true);
15713         return ret_ref;
15714 }
15715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15716         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
15717         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
15718         return ret_conv;
15719 }
15720
15721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15722         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
15723         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15724         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
15725         int64_t ret_ref = tag_ptr(ret_copy, true);
15726         return ret_ref;
15727 }
15728
15729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15730         LDKCVec_SpendableOutputDescriptorZ _res_constr;
15731         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15732         if (_res_constr.datalen > 0)
15733                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15734         else
15735                 _res_constr.data = NULL;
15736         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15737         for (size_t b = 0; b < _res_constr.datalen; b++) {
15738                 int64_t _res_conv_27 = _res_vals[b];
15739                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
15740                 CHECK_ACCESS(_res_conv_27_ptr);
15741                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15742                 FREE(untag_ptr(_res_conv_27));
15743                 _res_constr.data[b] = _res_conv_27_conv;
15744         }
15745         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15746         CVec_SpendableOutputDescriptorZ_free(_res_constr);
15747 }
15748
15749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15750         void* o_ptr = untag_ptr(o);
15751         CHECK_ACCESS(o_ptr);
15752         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
15753         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
15754         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15755         *ret_copy = COption_EventZ_some(o_conv);
15756         int64_t ret_ref = tag_ptr(ret_copy, true);
15757         return ret_ref;
15758 }
15759
15760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
15761         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15762         *ret_copy = COption_EventZ_none();
15763         int64_t ret_ref = tag_ptr(ret_copy, true);
15764         return ret_ref;
15765 }
15766
15767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15768         if (!ptr_is_owned(_res)) return;
15769         void* _res_ptr = untag_ptr(_res);
15770         CHECK_ACCESS(_res_ptr);
15771         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
15772         FREE(untag_ptr(_res));
15773         COption_EventZ_free(_res_conv);
15774 }
15775
15776 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
15777         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15778         *ret_copy = COption_EventZ_clone(arg);
15779         int64_t ret_ref = tag_ptr(ret_copy, true);
15780         return ret_ref;
15781 }
15782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15783         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
15784         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
15785         return ret_conv;
15786 }
15787
15788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15789         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
15790         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15791         *ret_copy = COption_EventZ_clone(orig_conv);
15792         int64_t ret_ref = tag_ptr(ret_copy, true);
15793         return ret_ref;
15794 }
15795
15796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15797         void* o_ptr = untag_ptr(o);
15798         CHECK_ACCESS(o_ptr);
15799         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
15800         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
15801         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15802         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
15803         return tag_ptr(ret_conv, true);
15804 }
15805
15806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15807         LDKDecodeError e_conv;
15808         e_conv.inner = untag_ptr(e);
15809         e_conv.is_owned = ptr_is_owned(e);
15810         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15811         e_conv = DecodeError_clone(&e_conv);
15812         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15813         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
15814         return tag_ptr(ret_conv, true);
15815 }
15816
15817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15818         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
15819         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
15820         return ret_conv;
15821 }
15822
15823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15824         if (!ptr_is_owned(_res)) return;
15825         void* _res_ptr = untag_ptr(_res);
15826         CHECK_ACCESS(_res_ptr);
15827         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
15828         FREE(untag_ptr(_res));
15829         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
15830 }
15831
15832 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
15833         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15834         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
15835         return tag_ptr(ret_conv, true);
15836 }
15837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15838         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
15839         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
15840         return ret_conv;
15841 }
15842
15843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15844         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
15845         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15846         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
15847         return tag_ptr(ret_conv, true);
15848 }
15849
15850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15851         LDKCVec_MessageSendEventZ _res_constr;
15852         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15853         if (_res_constr.datalen > 0)
15854                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15855         else
15856                 _res_constr.data = NULL;
15857         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15858         for (size_t s = 0; s < _res_constr.datalen; s++) {
15859                 int64_t _res_conv_18 = _res_vals[s];
15860                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
15861                 CHECK_ACCESS(_res_conv_18_ptr);
15862                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
15863                 FREE(untag_ptr(_res_conv_18));
15864                 _res_constr.data[s] = _res_conv_18_conv;
15865         }
15866         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15867         CVec_MessageSendEventZ_free(_res_constr);
15868 }
15869
15870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15871         void* o_ptr = untag_ptr(o);
15872         CHECK_ACCESS(o_ptr);
15873         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
15874         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
15875         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15876         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
15877         return tag_ptr(ret_conv, true);
15878 }
15879
15880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15881         LDKAccessError e_conv = LDKAccessError_from_java(env, e);
15882         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15883         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
15884         return tag_ptr(ret_conv, true);
15885 }
15886
15887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15888         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
15889         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
15890         return ret_conv;
15891 }
15892
15893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15894         if (!ptr_is_owned(_res)) return;
15895         void* _res_ptr = untag_ptr(_res);
15896         CHECK_ACCESS(_res_ptr);
15897         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
15898         FREE(untag_ptr(_res));
15899         CResult_TxOutAccessErrorZ_free(_res_conv);
15900 }
15901
15902 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
15903         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15904         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
15905         return tag_ptr(ret_conv, true);
15906 }
15907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15908         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
15909         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
15910         return ret_conv;
15911 }
15912
15913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15914         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
15915         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15916         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
15917         return tag_ptr(ret_conv, true);
15918 }
15919
15920 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
15921         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15922         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
15923         return tag_ptr(ret_conv, true);
15924 }
15925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15926         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
15927         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
15928         return ret_conv;
15929 }
15930
15931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15932         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
15933         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15934         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
15935         return tag_ptr(ret_conv, true);
15936 }
15937
15938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
15939         LDKTransaction b_ref;
15940         b_ref.datalen = (*env)->GetArrayLength(env, b);
15941         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
15942         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
15943         b_ref.data_is_owned = true;
15944         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15945         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
15946         return tag_ptr(ret_conv, true);
15947 }
15948
15949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15950         if (!ptr_is_owned(_res)) return;
15951         void* _res_ptr = untag_ptr(_res);
15952         CHECK_ACCESS(_res_ptr);
15953         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
15954         FREE(untag_ptr(_res));
15955         C2Tuple_usizeTransactionZ_free(_res_conv);
15956 }
15957
15958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15959         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
15960         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15961         if (_res_constr.datalen > 0)
15962                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15963         else
15964                 _res_constr.data = NULL;
15965         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15966         for (size_t c = 0; c < _res_constr.datalen; c++) {
15967                 int64_t _res_conv_28 = _res_vals[c];
15968                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
15969                 CHECK_ACCESS(_res_conv_28_ptr);
15970                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
15971                 FREE(untag_ptr(_res_conv_28));
15972                 _res_constr.data[c] = _res_conv_28_conv;
15973         }
15974         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15975         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
15976 }
15977
15978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15979         LDKCVec_TxidZ _res_constr;
15980         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15981         if (_res_constr.datalen > 0)
15982                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
15983         else
15984                 _res_constr.data = NULL;
15985         for (size_t i = 0; i < _res_constr.datalen; i++) {
15986                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15987                 LDKThirtyTwoBytes _res_conv_8_ref;
15988                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
15989                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
15990                 _res_constr.data[i] = _res_conv_8_ref;
15991         }
15992         CVec_TxidZ_free(_res_constr);
15993 }
15994
15995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
15996         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15997         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
15998         return tag_ptr(ret_conv, true);
15999 }
16000
16001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
16002         LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
16003         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16004         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
16005         return tag_ptr(ret_conv, true);
16006 }
16007
16008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16009         LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(o);
16010         jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
16011         return ret_conv;
16012 }
16013
16014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16015         if (!ptr_is_owned(_res)) return;
16016         void* _res_ptr = untag_ptr(_res);
16017         CHECK_ACCESS(_res_ptr);
16018         LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
16019         FREE(untag_ptr(_res));
16020         CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
16021 }
16022
16023 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
16024         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16025         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
16026         return tag_ptr(ret_conv, true);
16027 }
16028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16029         LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(arg);
16030         int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
16031         return ret_conv;
16032 }
16033
16034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16035         LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(orig);
16036         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16037         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
16038         return tag_ptr(ret_conv, true);
16039 }
16040
16041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16042         LDKCVec_MonitorEventZ _res_constr;
16043         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16044         if (_res_constr.datalen > 0)
16045                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
16046         else
16047                 _res_constr.data = NULL;
16048         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16049         for (size_t o = 0; o < _res_constr.datalen; o++) {
16050                 int64_t _res_conv_14 = _res_vals[o];
16051                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
16052                 CHECK_ACCESS(_res_conv_14_ptr);
16053                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
16054                 FREE(untag_ptr(_res_conv_14));
16055                 _res_constr.data[o] = _res_conv_14_conv;
16056         }
16057         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16058         CVec_MonitorEventZ_free(_res_constr);
16059 }
16060
16061 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
16062         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
16063         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
16064         return tag_ptr(ret_conv, true);
16065 }
16066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16067         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
16068         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
16069         return ret_conv;
16070 }
16071
16072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16073         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
16074         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
16075         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
16076         return tag_ptr(ret_conv, true);
16077 }
16078
16079 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) {
16080         LDKOutPoint a_conv;
16081         a_conv.inner = untag_ptr(a);
16082         a_conv.is_owned = ptr_is_owned(a);
16083         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16084         a_conv = OutPoint_clone(&a_conv);
16085         LDKCVec_MonitorEventZ b_constr;
16086         b_constr.datalen = (*env)->GetArrayLength(env, b);
16087         if (b_constr.datalen > 0)
16088                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
16089         else
16090                 b_constr.data = NULL;
16091         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
16092         for (size_t o = 0; o < b_constr.datalen; o++) {
16093                 int64_t b_conv_14 = b_vals[o];
16094                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
16095                 CHECK_ACCESS(b_conv_14_ptr);
16096                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
16097                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
16098                 b_constr.data[o] = b_conv_14_conv;
16099         }
16100         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
16101         LDKPublicKey c_ref;
16102         CHECK((*env)->GetArrayLength(env, c) == 33);
16103         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
16104         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
16105         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
16106         return tag_ptr(ret_conv, true);
16107 }
16108
16109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16110         if (!ptr_is_owned(_res)) return;
16111         void* _res_ptr = untag_ptr(_res);
16112         CHECK_ACCESS(_res_ptr);
16113         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
16114         FREE(untag_ptr(_res));
16115         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
16116 }
16117
16118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16119         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
16120         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16121         if (_res_constr.datalen > 0)
16122                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
16123         else
16124                 _res_constr.data = NULL;
16125         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16126         for (size_t x = 0; x < _res_constr.datalen; x++) {
16127                 int64_t _res_conv_49 = _res_vals[x];
16128                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
16129                 CHECK_ACCESS(_res_conv_49_ptr);
16130                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
16131                 FREE(untag_ptr(_res_conv_49));
16132                 _res_constr.data[x] = _res_conv_49_conv;
16133         }
16134         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16135         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
16136 }
16137
16138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16139         void* o_ptr = untag_ptr(o);
16140         CHECK_ACCESS(o_ptr);
16141         LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
16142         o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(o));
16143         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16144         *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
16145         int64_t ret_ref = tag_ptr(ret_copy, true);
16146         return ret_ref;
16147 }
16148
16149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
16150         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16151         *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
16152         int64_t ret_ref = tag_ptr(ret_copy, true);
16153         return ret_ref;
16154 }
16155
16156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16157         if (!ptr_is_owned(_res)) return;
16158         void* _res_ptr = untag_ptr(_res);
16159         CHECK_ACCESS(_res_ptr);
16160         LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
16161         FREE(untag_ptr(_res));
16162         COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
16163 }
16164
16165 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
16166         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16167         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
16168         int64_t ret_ref = tag_ptr(ret_copy, true);
16169         return ret_ref;
16170 }
16171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16172         LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(arg);
16173         int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
16174         return ret_conv;
16175 }
16176
16177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16178         LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(orig);
16179         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16180         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
16181         int64_t ret_ref = tag_ptr(ret_copy, true);
16182         return ret_ref;
16183 }
16184
16185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16186         LDKFixedPenaltyScorer o_conv;
16187         o_conv.inner = untag_ptr(o);
16188         o_conv.is_owned = ptr_is_owned(o);
16189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16190         o_conv = FixedPenaltyScorer_clone(&o_conv);
16191         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16192         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
16193         return tag_ptr(ret_conv, true);
16194 }
16195
16196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16197         LDKDecodeError e_conv;
16198         e_conv.inner = untag_ptr(e);
16199         e_conv.is_owned = ptr_is_owned(e);
16200         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16201         e_conv = DecodeError_clone(&e_conv);
16202         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16203         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
16204         return tag_ptr(ret_conv, true);
16205 }
16206
16207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16208         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
16209         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
16210         return ret_conv;
16211 }
16212
16213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16214         if (!ptr_is_owned(_res)) return;
16215         void* _res_ptr = untag_ptr(_res);
16216         CHECK_ACCESS(_res_ptr);
16217         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
16218         FREE(untag_ptr(_res));
16219         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
16220 }
16221
16222 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
16223         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16224         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
16225         return tag_ptr(ret_conv, true);
16226 }
16227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16228         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
16229         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
16230         return ret_conv;
16231 }
16232
16233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16234         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
16235         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16236         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
16237         return tag_ptr(ret_conv, true);
16238 }
16239
16240 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
16241         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16242         *ret_conv = C2Tuple_u64u64Z_clone(arg);
16243         return tag_ptr(ret_conv, true);
16244 }
16245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16246         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
16247         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
16248         return ret_conv;
16249 }
16250
16251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16252         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
16253         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16254         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
16255         return tag_ptr(ret_conv, true);
16256 }
16257
16258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16259         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16260         *ret_conv = C2Tuple_u64u64Z_new(a, b);
16261         return tag_ptr(ret_conv, true);
16262 }
16263
16264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
16265         if (!ptr_is_owned(_res)) return;
16266         void* _res_ptr = untag_ptr(_res);
16267         CHECK_ACCESS(_res_ptr);
16268         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
16269         FREE(untag_ptr(_res));
16270         C2Tuple_u64u64Z_free(_res_conv);
16271 }
16272
16273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16274         void* o_ptr = untag_ptr(o);
16275         CHECK_ACCESS(o_ptr);
16276         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
16277         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
16278         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16279         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
16280         int64_t ret_ref = tag_ptr(ret_copy, true);
16281         return ret_ref;
16282 }
16283
16284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
16285         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16286         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
16287         int64_t ret_ref = tag_ptr(ret_copy, true);
16288         return ret_ref;
16289 }
16290
16291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16292         if (!ptr_is_owned(_res)) return;
16293         void* _res_ptr = untag_ptr(_res);
16294         CHECK_ACCESS(_res_ptr);
16295         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
16296         FREE(untag_ptr(_res));
16297         COption_C2Tuple_u64u64ZZ_free(_res_conv);
16298 }
16299
16300 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
16301         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16302         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
16303         int64_t ret_ref = tag_ptr(ret_copy, true);
16304         return ret_ref;
16305 }
16306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16307         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
16308         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
16309         return ret_conv;
16310 }
16311
16312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16313         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
16314         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16315         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
16316         int64_t ret_ref = tag_ptr(ret_copy, true);
16317         return ret_ref;
16318 }
16319
16320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16321         LDKCVec_NodeIdZ _res_constr;
16322         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16323         if (_res_constr.datalen > 0)
16324                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
16325         else
16326                 _res_constr.data = NULL;
16327         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16328         for (size_t i = 0; i < _res_constr.datalen; i++) {
16329                 int64_t _res_conv_8 = _res_vals[i];
16330                 LDKNodeId _res_conv_8_conv;
16331                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
16332                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
16333                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
16334                 _res_constr.data[i] = _res_conv_8_conv;
16335         }
16336         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16337         CVec_NodeIdZ_free(_res_constr);
16338 }
16339
16340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16341         LDKProbabilisticScorer o_conv;
16342         o_conv.inner = untag_ptr(o);
16343         o_conv.is_owned = ptr_is_owned(o);
16344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16345         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
16346         
16347         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16348         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
16349         return tag_ptr(ret_conv, true);
16350 }
16351
16352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16353         LDKDecodeError e_conv;
16354         e_conv.inner = untag_ptr(e);
16355         e_conv.is_owned = ptr_is_owned(e);
16356         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16357         e_conv = DecodeError_clone(&e_conv);
16358         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16359         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
16360         return tag_ptr(ret_conv, true);
16361 }
16362
16363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16364         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
16365         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
16366         return ret_conv;
16367 }
16368
16369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16370         if (!ptr_is_owned(_res)) return;
16371         void* _res_ptr = untag_ptr(_res);
16372         CHECK_ACCESS(_res_ptr);
16373         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
16374         FREE(untag_ptr(_res));
16375         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
16376 }
16377
16378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16379         LDKInitFeatures o_conv;
16380         o_conv.inner = untag_ptr(o);
16381         o_conv.is_owned = ptr_is_owned(o);
16382         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16383         o_conv = InitFeatures_clone(&o_conv);
16384         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16385         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
16386         return tag_ptr(ret_conv, true);
16387 }
16388
16389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16390         LDKDecodeError e_conv;
16391         e_conv.inner = untag_ptr(e);
16392         e_conv.is_owned = ptr_is_owned(e);
16393         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16394         e_conv = DecodeError_clone(&e_conv);
16395         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16396         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
16397         return tag_ptr(ret_conv, true);
16398 }
16399
16400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16401         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
16402         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
16403         return ret_conv;
16404 }
16405
16406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16407         if (!ptr_is_owned(_res)) return;
16408         void* _res_ptr = untag_ptr(_res);
16409         CHECK_ACCESS(_res_ptr);
16410         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
16411         FREE(untag_ptr(_res));
16412         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
16413 }
16414
16415 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16416         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16417         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
16418         return tag_ptr(ret_conv, true);
16419 }
16420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16421         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
16422         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16423         return ret_conv;
16424 }
16425
16426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16427         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
16428         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16429         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
16430         return tag_ptr(ret_conv, true);
16431 }
16432
16433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16434         LDKChannelFeatures o_conv;
16435         o_conv.inner = untag_ptr(o);
16436         o_conv.is_owned = ptr_is_owned(o);
16437         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16438         o_conv = ChannelFeatures_clone(&o_conv);
16439         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16440         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
16441         return tag_ptr(ret_conv, true);
16442 }
16443
16444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16445         LDKDecodeError e_conv;
16446         e_conv.inner = untag_ptr(e);
16447         e_conv.is_owned = ptr_is_owned(e);
16448         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16449         e_conv = DecodeError_clone(&e_conv);
16450         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16451         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
16452         return tag_ptr(ret_conv, true);
16453 }
16454
16455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16456         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
16457         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
16458         return ret_conv;
16459 }
16460
16461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16462         if (!ptr_is_owned(_res)) return;
16463         void* _res_ptr = untag_ptr(_res);
16464         CHECK_ACCESS(_res_ptr);
16465         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
16466         FREE(untag_ptr(_res));
16467         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
16468 }
16469
16470 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16471         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16472         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
16473         return tag_ptr(ret_conv, true);
16474 }
16475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16476         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
16477         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16478         return ret_conv;
16479 }
16480
16481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16482         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
16483         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16484         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
16485         return tag_ptr(ret_conv, true);
16486 }
16487
16488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16489         LDKNodeFeatures o_conv;
16490         o_conv.inner = untag_ptr(o);
16491         o_conv.is_owned = ptr_is_owned(o);
16492         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16493         o_conv = NodeFeatures_clone(&o_conv);
16494         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16495         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
16496         return tag_ptr(ret_conv, true);
16497 }
16498
16499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16500         LDKDecodeError e_conv;
16501         e_conv.inner = untag_ptr(e);
16502         e_conv.is_owned = ptr_is_owned(e);
16503         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16504         e_conv = DecodeError_clone(&e_conv);
16505         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16506         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
16507         return tag_ptr(ret_conv, true);
16508 }
16509
16510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16511         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
16512         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
16513         return ret_conv;
16514 }
16515
16516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16517         if (!ptr_is_owned(_res)) return;
16518         void* _res_ptr = untag_ptr(_res);
16519         CHECK_ACCESS(_res_ptr);
16520         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
16521         FREE(untag_ptr(_res));
16522         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
16523 }
16524
16525 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16526         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16527         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
16528         return tag_ptr(ret_conv, true);
16529 }
16530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16531         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
16532         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16533         return ret_conv;
16534 }
16535
16536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16537         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
16538         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16539         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
16540         return tag_ptr(ret_conv, true);
16541 }
16542
16543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16544         LDKInvoiceFeatures o_conv;
16545         o_conv.inner = untag_ptr(o);
16546         o_conv.is_owned = ptr_is_owned(o);
16547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16548         o_conv = InvoiceFeatures_clone(&o_conv);
16549         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16550         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
16551         return tag_ptr(ret_conv, true);
16552 }
16553
16554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16555         LDKDecodeError e_conv;
16556         e_conv.inner = untag_ptr(e);
16557         e_conv.is_owned = ptr_is_owned(e);
16558         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16559         e_conv = DecodeError_clone(&e_conv);
16560         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16561         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
16562         return tag_ptr(ret_conv, true);
16563 }
16564
16565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16566         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
16567         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
16568         return ret_conv;
16569 }
16570
16571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16572         if (!ptr_is_owned(_res)) return;
16573         void* _res_ptr = untag_ptr(_res);
16574         CHECK_ACCESS(_res_ptr);
16575         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
16576         FREE(untag_ptr(_res));
16577         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
16578 }
16579
16580 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16581         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16582         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
16583         return tag_ptr(ret_conv, true);
16584 }
16585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16586         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
16587         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16588         return ret_conv;
16589 }
16590
16591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16592         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
16593         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16594         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
16595         return tag_ptr(ret_conv, true);
16596 }
16597
16598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16599         LDKChannelTypeFeatures o_conv;
16600         o_conv.inner = untag_ptr(o);
16601         o_conv.is_owned = ptr_is_owned(o);
16602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16603         o_conv = ChannelTypeFeatures_clone(&o_conv);
16604         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16605         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
16606         return tag_ptr(ret_conv, true);
16607 }
16608
16609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16610         LDKDecodeError e_conv;
16611         e_conv.inner = untag_ptr(e);
16612         e_conv.is_owned = ptr_is_owned(e);
16613         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16614         e_conv = DecodeError_clone(&e_conv);
16615         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16616         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
16617         return tag_ptr(ret_conv, true);
16618 }
16619
16620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16621         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
16622         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
16623         return ret_conv;
16624 }
16625
16626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16627         if (!ptr_is_owned(_res)) return;
16628         void* _res_ptr = untag_ptr(_res);
16629         CHECK_ACCESS(_res_ptr);
16630         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
16631         FREE(untag_ptr(_res));
16632         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
16633 }
16634
16635 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16636         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16637         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
16638         return tag_ptr(ret_conv, true);
16639 }
16640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16641         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
16642         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16643         return ret_conv;
16644 }
16645
16646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16647         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
16648         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16649         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
16650         return tag_ptr(ret_conv, true);
16651 }
16652
16653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16654         LDKNodeId o_conv;
16655         o_conv.inner = untag_ptr(o);
16656         o_conv.is_owned = ptr_is_owned(o);
16657         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16658         o_conv = NodeId_clone(&o_conv);
16659         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16660         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
16661         return tag_ptr(ret_conv, true);
16662 }
16663
16664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16665         LDKDecodeError e_conv;
16666         e_conv.inner = untag_ptr(e);
16667         e_conv.is_owned = ptr_is_owned(e);
16668         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16669         e_conv = DecodeError_clone(&e_conv);
16670         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16671         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
16672         return tag_ptr(ret_conv, true);
16673 }
16674
16675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16676         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
16677         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
16678         return ret_conv;
16679 }
16680
16681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16682         if (!ptr_is_owned(_res)) return;
16683         void* _res_ptr = untag_ptr(_res);
16684         CHECK_ACCESS(_res_ptr);
16685         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
16686         FREE(untag_ptr(_res));
16687         CResult_NodeIdDecodeErrorZ_free(_res_conv);
16688 }
16689
16690 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
16691         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16692         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
16693         return tag_ptr(ret_conv, true);
16694 }
16695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16696         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
16697         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
16698         return ret_conv;
16699 }
16700
16701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16702         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
16703         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16704         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
16705         return tag_ptr(ret_conv, true);
16706 }
16707
16708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16709         void* o_ptr = untag_ptr(o);
16710         CHECK_ACCESS(o_ptr);
16711         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
16712         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
16713         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16714         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
16715         return tag_ptr(ret_conv, true);
16716 }
16717
16718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16719         LDKDecodeError e_conv;
16720         e_conv.inner = untag_ptr(e);
16721         e_conv.is_owned = ptr_is_owned(e);
16722         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16723         e_conv = DecodeError_clone(&e_conv);
16724         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16725         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
16726         return tag_ptr(ret_conv, true);
16727 }
16728
16729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16730         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
16731         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
16732         return ret_conv;
16733 }
16734
16735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16736         if (!ptr_is_owned(_res)) return;
16737         void* _res_ptr = untag_ptr(_res);
16738         CHECK_ACCESS(_res_ptr);
16739         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
16740         FREE(untag_ptr(_res));
16741         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
16742 }
16743
16744 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
16745         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16746         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
16747         return tag_ptr(ret_conv, true);
16748 }
16749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16750         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
16751         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
16752         return ret_conv;
16753 }
16754
16755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16756         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
16757         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16758         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
16759         return tag_ptr(ret_conv, true);
16760 }
16761
16762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16763         void* o_ptr = untag_ptr(o);
16764         CHECK_ACCESS(o_ptr);
16765         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
16766         if (o_conv.free == LDKAccess_JCalls_free) {
16767                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16768                 LDKAccess_JCalls_cloned(&o_conv);
16769         }
16770         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16771         *ret_copy = COption_AccessZ_some(o_conv);
16772         int64_t ret_ref = tag_ptr(ret_copy, true);
16773         return ret_ref;
16774 }
16775
16776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
16777         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16778         *ret_copy = COption_AccessZ_none();
16779         int64_t ret_ref = tag_ptr(ret_copy, true);
16780         return ret_ref;
16781 }
16782
16783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16784         if (!ptr_is_owned(_res)) return;
16785         void* _res_ptr = untag_ptr(_res);
16786         CHECK_ACCESS(_res_ptr);
16787         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
16788         FREE(untag_ptr(_res));
16789         COption_AccessZ_free(_res_conv);
16790 }
16791
16792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
16793         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16794         *ret_conv = CResult_boolLightningErrorZ_ok(o);
16795         return tag_ptr(ret_conv, true);
16796 }
16797
16798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16799         LDKLightningError e_conv;
16800         e_conv.inner = untag_ptr(e);
16801         e_conv.is_owned = ptr_is_owned(e);
16802         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16803         e_conv = LightningError_clone(&e_conv);
16804         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16805         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
16806         return tag_ptr(ret_conv, true);
16807 }
16808
16809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16810         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
16811         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
16812         return ret_conv;
16813 }
16814
16815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16816         if (!ptr_is_owned(_res)) return;
16817         void* _res_ptr = untag_ptr(_res);
16818         CHECK_ACCESS(_res_ptr);
16819         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
16820         FREE(untag_ptr(_res));
16821         CResult_boolLightningErrorZ_free(_res_conv);
16822 }
16823
16824 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
16825         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16826         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
16827         return tag_ptr(ret_conv, true);
16828 }
16829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16830         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
16831         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
16832         return ret_conv;
16833 }
16834
16835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16836         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
16837         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16838         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
16839         return tag_ptr(ret_conv, true);
16840 }
16841
16842 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
16843         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16844         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
16845         return tag_ptr(ret_conv, true);
16846 }
16847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16848         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
16849         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
16850         return ret_conv;
16851 }
16852
16853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16854         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
16855         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16856         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
16857         return tag_ptr(ret_conv, true);
16858 }
16859
16860 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) {
16861         LDKChannelAnnouncement a_conv;
16862         a_conv.inner = untag_ptr(a);
16863         a_conv.is_owned = ptr_is_owned(a);
16864         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16865         a_conv = ChannelAnnouncement_clone(&a_conv);
16866         LDKChannelUpdate b_conv;
16867         b_conv.inner = untag_ptr(b);
16868         b_conv.is_owned = ptr_is_owned(b);
16869         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16870         b_conv = ChannelUpdate_clone(&b_conv);
16871         LDKChannelUpdate c_conv;
16872         c_conv.inner = untag_ptr(c);
16873         c_conv.is_owned = ptr_is_owned(c);
16874         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16875         c_conv = ChannelUpdate_clone(&c_conv);
16876         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16877         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
16878         return tag_ptr(ret_conv, true);
16879 }
16880
16881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16882         if (!ptr_is_owned(_res)) return;
16883         void* _res_ptr = untag_ptr(_res);
16884         CHECK_ACCESS(_res_ptr);
16885         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
16886         FREE(untag_ptr(_res));
16887         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
16888 }
16889
16890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16891         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
16892         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16893         if (_res_constr.datalen > 0)
16894                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
16895         else
16896                 _res_constr.data = NULL;
16897         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16898         for (size_t h = 0; h < _res_constr.datalen; h++) {
16899                 int64_t _res_conv_59 = _res_vals[h];
16900                 void* _res_conv_59_ptr = untag_ptr(_res_conv_59);
16901                 CHECK_ACCESS(_res_conv_59_ptr);
16902                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
16903                 FREE(untag_ptr(_res_conv_59));
16904                 _res_constr.data[h] = _res_conv_59_conv;
16905         }
16906         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16907         CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
16908 }
16909
16910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16911         LDKCVec_NodeAnnouncementZ _res_constr;
16912         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16913         if (_res_constr.datalen > 0)
16914                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
16915         else
16916                 _res_constr.data = NULL;
16917         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16918         for (size_t s = 0; s < _res_constr.datalen; s++) {
16919                 int64_t _res_conv_18 = _res_vals[s];
16920                 LDKNodeAnnouncement _res_conv_18_conv;
16921                 _res_conv_18_conv.inner = untag_ptr(_res_conv_18);
16922                 _res_conv_18_conv.is_owned = ptr_is_owned(_res_conv_18);
16923                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
16924                 _res_constr.data[s] = _res_conv_18_conv;
16925         }
16926         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16927         CVec_NodeAnnouncementZ_free(_res_constr);
16928 }
16929
16930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
16931         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16932         *ret_conv = CResult_NoneLightningErrorZ_ok();
16933         return tag_ptr(ret_conv, true);
16934 }
16935
16936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16937         LDKLightningError e_conv;
16938         e_conv.inner = untag_ptr(e);
16939         e_conv.is_owned = ptr_is_owned(e);
16940         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16941         e_conv = LightningError_clone(&e_conv);
16942         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16943         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
16944         return tag_ptr(ret_conv, true);
16945 }
16946
16947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16948         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
16949         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
16950         return ret_conv;
16951 }
16952
16953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16954         if (!ptr_is_owned(_res)) return;
16955         void* _res_ptr = untag_ptr(_res);
16956         CHECK_ACCESS(_res_ptr);
16957         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
16958         FREE(untag_ptr(_res));
16959         CResult_NoneLightningErrorZ_free(_res_conv);
16960 }
16961
16962 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
16963         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16964         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
16965         return tag_ptr(ret_conv, true);
16966 }
16967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16968         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
16969         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
16970         return ret_conv;
16971 }
16972
16973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16974         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
16975         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16976         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
16977         return tag_ptr(ret_conv, true);
16978 }
16979
16980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16981         LDKChannelUpdateInfo o_conv;
16982         o_conv.inner = untag_ptr(o);
16983         o_conv.is_owned = ptr_is_owned(o);
16984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16985         o_conv = ChannelUpdateInfo_clone(&o_conv);
16986         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16987         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
16988         return tag_ptr(ret_conv, true);
16989 }
16990
16991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16992         LDKDecodeError e_conv;
16993         e_conv.inner = untag_ptr(e);
16994         e_conv.is_owned = ptr_is_owned(e);
16995         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16996         e_conv = DecodeError_clone(&e_conv);
16997         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16998         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
16999         return tag_ptr(ret_conv, true);
17000 }
17001
17002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17003         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
17004         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
17005         return ret_conv;
17006 }
17007
17008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17009         if (!ptr_is_owned(_res)) return;
17010         void* _res_ptr = untag_ptr(_res);
17011         CHECK_ACCESS(_res_ptr);
17012         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
17013         FREE(untag_ptr(_res));
17014         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
17015 }
17016
17017 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
17018         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17019         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
17020         return tag_ptr(ret_conv, true);
17021 }
17022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17023         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
17024         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
17025         return ret_conv;
17026 }
17027
17028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17029         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
17030         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17031         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
17032         return tag_ptr(ret_conv, true);
17033 }
17034
17035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17036         LDKChannelInfo o_conv;
17037         o_conv.inner = untag_ptr(o);
17038         o_conv.is_owned = ptr_is_owned(o);
17039         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17040         o_conv = ChannelInfo_clone(&o_conv);
17041         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17042         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
17043         return tag_ptr(ret_conv, true);
17044 }
17045
17046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17047         LDKDecodeError e_conv;
17048         e_conv.inner = untag_ptr(e);
17049         e_conv.is_owned = ptr_is_owned(e);
17050         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17051         e_conv = DecodeError_clone(&e_conv);
17052         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17053         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
17054         return tag_ptr(ret_conv, true);
17055 }
17056
17057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17058         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
17059         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
17060         return ret_conv;
17061 }
17062
17063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17064         if (!ptr_is_owned(_res)) return;
17065         void* _res_ptr = untag_ptr(_res);
17066         CHECK_ACCESS(_res_ptr);
17067         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
17068         FREE(untag_ptr(_res));
17069         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
17070 }
17071
17072 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
17073         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17074         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
17075         return tag_ptr(ret_conv, true);
17076 }
17077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17078         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
17079         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
17080         return ret_conv;
17081 }
17082
17083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17084         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
17085         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17086         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
17087         return tag_ptr(ret_conv, true);
17088 }
17089
17090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17091         LDKRoutingFees o_conv;
17092         o_conv.inner = untag_ptr(o);
17093         o_conv.is_owned = ptr_is_owned(o);
17094         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17095         o_conv = RoutingFees_clone(&o_conv);
17096         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17097         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
17098         return tag_ptr(ret_conv, true);
17099 }
17100
17101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17102         LDKDecodeError e_conv;
17103         e_conv.inner = untag_ptr(e);
17104         e_conv.is_owned = ptr_is_owned(e);
17105         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17106         e_conv = DecodeError_clone(&e_conv);
17107         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17108         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
17109         return tag_ptr(ret_conv, true);
17110 }
17111
17112 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17113         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
17114         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
17115         return ret_conv;
17116 }
17117
17118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17119         if (!ptr_is_owned(_res)) return;
17120         void* _res_ptr = untag_ptr(_res);
17121         CHECK_ACCESS(_res_ptr);
17122         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
17123         FREE(untag_ptr(_res));
17124         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
17125 }
17126
17127 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
17128         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17129         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
17130         return tag_ptr(ret_conv, true);
17131 }
17132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17133         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
17134         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
17135         return ret_conv;
17136 }
17137
17138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17139         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
17140         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17141         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
17142         return tag_ptr(ret_conv, true);
17143 }
17144
17145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17146         LDKCVec_NetAddressZ _res_constr;
17147         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17148         if (_res_constr.datalen > 0)
17149                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17150         else
17151                 _res_constr.data = NULL;
17152         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17153         for (size_t m = 0; m < _res_constr.datalen; m++) {
17154                 int64_t _res_conv_12 = _res_vals[m];
17155                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
17156                 CHECK_ACCESS(_res_conv_12_ptr);
17157                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
17158                 FREE(untag_ptr(_res_conv_12));
17159                 _res_constr.data[m] = _res_conv_12_conv;
17160         }
17161         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17162         CVec_NetAddressZ_free(_res_constr);
17163 }
17164
17165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17166         LDKNodeAnnouncementInfo o_conv;
17167         o_conv.inner = untag_ptr(o);
17168         o_conv.is_owned = ptr_is_owned(o);
17169         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17170         o_conv = NodeAnnouncementInfo_clone(&o_conv);
17171         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17172         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
17173         return tag_ptr(ret_conv, true);
17174 }
17175
17176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17177         LDKDecodeError e_conv;
17178         e_conv.inner = untag_ptr(e);
17179         e_conv.is_owned = ptr_is_owned(e);
17180         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17181         e_conv = DecodeError_clone(&e_conv);
17182         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17183         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
17184         return tag_ptr(ret_conv, true);
17185 }
17186
17187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17188         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
17189         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
17190         return ret_conv;
17191 }
17192
17193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17194         if (!ptr_is_owned(_res)) return;
17195         void* _res_ptr = untag_ptr(_res);
17196         CHECK_ACCESS(_res_ptr);
17197         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
17198         FREE(untag_ptr(_res));
17199         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
17200 }
17201
17202 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
17203         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17204         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
17205         return tag_ptr(ret_conv, true);
17206 }
17207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17208         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
17209         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
17210         return ret_conv;
17211 }
17212
17213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17214         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
17215         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17216         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
17217         return tag_ptr(ret_conv, true);
17218 }
17219
17220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17221         LDKNodeAlias o_conv;
17222         o_conv.inner = untag_ptr(o);
17223         o_conv.is_owned = ptr_is_owned(o);
17224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17225         o_conv = NodeAlias_clone(&o_conv);
17226         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17227         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
17228         return tag_ptr(ret_conv, true);
17229 }
17230
17231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17232         LDKDecodeError e_conv;
17233         e_conv.inner = untag_ptr(e);
17234         e_conv.is_owned = ptr_is_owned(e);
17235         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17236         e_conv = DecodeError_clone(&e_conv);
17237         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17238         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
17239         return tag_ptr(ret_conv, true);
17240 }
17241
17242 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17243         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
17244         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
17245         return ret_conv;
17246 }
17247
17248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17249         if (!ptr_is_owned(_res)) return;
17250         void* _res_ptr = untag_ptr(_res);
17251         CHECK_ACCESS(_res_ptr);
17252         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
17253         FREE(untag_ptr(_res));
17254         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
17255 }
17256
17257 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
17258         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17259         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
17260         return tag_ptr(ret_conv, true);
17261 }
17262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17263         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
17264         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
17265         return ret_conv;
17266 }
17267
17268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17269         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
17270         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17271         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
17272         return tag_ptr(ret_conv, true);
17273 }
17274
17275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17276         LDKNodeInfo o_conv;
17277         o_conv.inner = untag_ptr(o);
17278         o_conv.is_owned = ptr_is_owned(o);
17279         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17280         o_conv = NodeInfo_clone(&o_conv);
17281         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17282         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
17283         return tag_ptr(ret_conv, true);
17284 }
17285
17286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17287         LDKDecodeError e_conv;
17288         e_conv.inner = untag_ptr(e);
17289         e_conv.is_owned = ptr_is_owned(e);
17290         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17291         e_conv = DecodeError_clone(&e_conv);
17292         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17293         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
17294         return tag_ptr(ret_conv, true);
17295 }
17296
17297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17298         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
17299         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
17300         return ret_conv;
17301 }
17302
17303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17304         if (!ptr_is_owned(_res)) return;
17305         void* _res_ptr = untag_ptr(_res);
17306         CHECK_ACCESS(_res_ptr);
17307         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
17308         FREE(untag_ptr(_res));
17309         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
17310 }
17311
17312 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
17313         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17314         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
17315         return tag_ptr(ret_conv, true);
17316 }
17317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17318         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
17319         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
17320         return ret_conv;
17321 }
17322
17323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17324         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
17325         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17326         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
17327         return tag_ptr(ret_conv, true);
17328 }
17329
17330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17331         LDKNetworkGraph o_conv;
17332         o_conv.inner = untag_ptr(o);
17333         o_conv.is_owned = ptr_is_owned(o);
17334         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17335         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
17336         
17337         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17338         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
17339         return tag_ptr(ret_conv, true);
17340 }
17341
17342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17343         LDKDecodeError e_conv;
17344         e_conv.inner = untag_ptr(e);
17345         e_conv.is_owned = ptr_is_owned(e);
17346         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17347         e_conv = DecodeError_clone(&e_conv);
17348         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17349         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
17350         return tag_ptr(ret_conv, true);
17351 }
17352
17353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17354         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
17355         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
17356         return ret_conv;
17357 }
17358
17359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17360         if (!ptr_is_owned(_res)) return;
17361         void* _res_ptr = untag_ptr(_res);
17362         CHECK_ACCESS(_res_ptr);
17363         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
17364         FREE(untag_ptr(_res));
17365         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
17366 }
17367
17368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
17369         LDKCVec_NetAddressZ o_constr;
17370         o_constr.datalen = (*env)->GetArrayLength(env, o);
17371         if (o_constr.datalen > 0)
17372                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17373         else
17374                 o_constr.data = NULL;
17375         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17376         for (size_t m = 0; m < o_constr.datalen; m++) {
17377                 int64_t o_conv_12 = o_vals[m];
17378                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
17379                 CHECK_ACCESS(o_conv_12_ptr);
17380                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
17381                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
17382                 o_constr.data[m] = o_conv_12_conv;
17383         }
17384         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17385         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17386         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
17387         int64_t ret_ref = tag_ptr(ret_copy, true);
17388         return ret_ref;
17389 }
17390
17391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
17392         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17393         *ret_copy = COption_CVec_NetAddressZZ_none();
17394         int64_t ret_ref = tag_ptr(ret_copy, true);
17395         return ret_ref;
17396 }
17397
17398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17399         if (!ptr_is_owned(_res)) return;
17400         void* _res_ptr = untag_ptr(_res);
17401         CHECK_ACCESS(_res_ptr);
17402         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
17403         FREE(untag_ptr(_res));
17404         COption_CVec_NetAddressZZ_free(_res_conv);
17405 }
17406
17407 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
17408         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17409         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
17410         int64_t ret_ref = tag_ptr(ret_copy, true);
17411         return ret_ref;
17412 }
17413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17414         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
17415         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
17416         return ret_conv;
17417 }
17418
17419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17420         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
17421         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17422         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
17423         int64_t ret_ref = tag_ptr(ret_copy, true);
17424         return ret_ref;
17425 }
17426
17427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17428         LDKDelayedPaymentOutputDescriptor o_conv;
17429         o_conv.inner = untag_ptr(o);
17430         o_conv.is_owned = ptr_is_owned(o);
17431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17432         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
17433         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17434         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17435         return tag_ptr(ret_conv, true);
17436 }
17437
17438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17439         LDKDecodeError e_conv;
17440         e_conv.inner = untag_ptr(e);
17441         e_conv.is_owned = ptr_is_owned(e);
17442         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17443         e_conv = DecodeError_clone(&e_conv);
17444         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17445         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17446         return tag_ptr(ret_conv, true);
17447 }
17448
17449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17450         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17451         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17452         return ret_conv;
17453 }
17454
17455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17456         if (!ptr_is_owned(_res)) return;
17457         void* _res_ptr = untag_ptr(_res);
17458         CHECK_ACCESS(_res_ptr);
17459         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17460         FREE(untag_ptr(_res));
17461         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17462 }
17463
17464 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17465         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17466         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17467         return tag_ptr(ret_conv, true);
17468 }
17469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17470         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17471         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17472         return ret_conv;
17473 }
17474
17475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17476         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17477         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17478         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17479         return tag_ptr(ret_conv, true);
17480 }
17481
17482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17483         LDKStaticPaymentOutputDescriptor o_conv;
17484         o_conv.inner = untag_ptr(o);
17485         o_conv.is_owned = ptr_is_owned(o);
17486         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17487         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
17488         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17489         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17490         return tag_ptr(ret_conv, true);
17491 }
17492
17493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17494         LDKDecodeError e_conv;
17495         e_conv.inner = untag_ptr(e);
17496         e_conv.is_owned = ptr_is_owned(e);
17497         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17498         e_conv = DecodeError_clone(&e_conv);
17499         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17500         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17501         return tag_ptr(ret_conv, true);
17502 }
17503
17504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17505         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17506         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17507         return ret_conv;
17508 }
17509
17510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17511         if (!ptr_is_owned(_res)) return;
17512         void* _res_ptr = untag_ptr(_res);
17513         CHECK_ACCESS(_res_ptr);
17514         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17515         FREE(untag_ptr(_res));
17516         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17517 }
17518
17519 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17520         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17521         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17522         return tag_ptr(ret_conv, true);
17523 }
17524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17525         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17526         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17527         return ret_conv;
17528 }
17529
17530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17531         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17532         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17533         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17534         return tag_ptr(ret_conv, true);
17535 }
17536
17537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17538         void* o_ptr = untag_ptr(o);
17539         CHECK_ACCESS(o_ptr);
17540         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
17541         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
17542         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17543         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
17544         return tag_ptr(ret_conv, true);
17545 }
17546
17547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17548         LDKDecodeError e_conv;
17549         e_conv.inner = untag_ptr(e);
17550         e_conv.is_owned = ptr_is_owned(e);
17551         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17552         e_conv = DecodeError_clone(&e_conv);
17553         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17554         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
17555         return tag_ptr(ret_conv, true);
17556 }
17557
17558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17559         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17560         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17561         return ret_conv;
17562 }
17563
17564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17565         if (!ptr_is_owned(_res)) return;
17566         void* _res_ptr = untag_ptr(_res);
17567         CHECK_ACCESS(_res_ptr);
17568         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
17569         FREE(untag_ptr(_res));
17570         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
17571 }
17572
17573 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17574         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17575         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
17576         return tag_ptr(ret_conv, true);
17577 }
17578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17579         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17580         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17581         return ret_conv;
17582 }
17583
17584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17585         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17586         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17587         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
17588         return tag_ptr(ret_conv, true);
17589 }
17590
17591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17592         LDKCVec_PaymentPreimageZ _res_constr;
17593         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17594         if (_res_constr.datalen > 0)
17595                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
17596         else
17597                 _res_constr.data = NULL;
17598         for (size_t i = 0; i < _res_constr.datalen; i++) {
17599                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17600                 LDKThirtyTwoBytes _res_conv_8_ref;
17601                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
17602                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
17603                 _res_constr.data[i] = _res_conv_8_ref;
17604         }
17605         CVec_PaymentPreimageZ_free(_res_constr);
17606 }
17607
17608 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
17609         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17610         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
17611         return tag_ptr(ret_conv, true);
17612 }
17613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17614         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
17615         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
17616         return ret_conv;
17617 }
17618
17619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17620         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
17621         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17622         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
17623         return tag_ptr(ret_conv, true);
17624 }
17625
17626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
17627         LDKSignature a_ref;
17628         CHECK((*env)->GetArrayLength(env, a) == 64);
17629         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
17630         LDKCVec_SignatureZ b_constr;
17631         b_constr.datalen = (*env)->GetArrayLength(env, b);
17632         if (b_constr.datalen > 0)
17633                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17634         else
17635                 b_constr.data = NULL;
17636         for (size_t i = 0; i < b_constr.datalen; i++) {
17637                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
17638                 LDKSignature b_conv_8_ref;
17639                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
17640                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
17641                 b_constr.data[i] = b_conv_8_ref;
17642         }
17643         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17644         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
17645         return tag_ptr(ret_conv, true);
17646 }
17647
17648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17649         if (!ptr_is_owned(_res)) return;
17650         void* _res_ptr = untag_ptr(_res);
17651         CHECK_ACCESS(_res_ptr);
17652         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
17653         FREE(untag_ptr(_res));
17654         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
17655 }
17656
17657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17658         void* o_ptr = untag_ptr(o);
17659         CHECK_ACCESS(o_ptr);
17660         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
17661         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
17662         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17663         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
17664         return tag_ptr(ret_conv, true);
17665 }
17666
17667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
17668         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17669         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
17670         return tag_ptr(ret_conv, true);
17671 }
17672
17673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17674         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
17675         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
17676         return ret_conv;
17677 }
17678
17679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17680         if (!ptr_is_owned(_res)) return;
17681         void* _res_ptr = untag_ptr(_res);
17682         CHECK_ACCESS(_res_ptr);
17683         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
17684         FREE(untag_ptr(_res));
17685         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
17686 }
17687
17688 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
17689         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17690         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
17691         return tag_ptr(ret_conv, true);
17692 }
17693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17694         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
17695         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
17696         return ret_conv;
17697 }
17698
17699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17700         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
17701         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17702         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
17703         return tag_ptr(ret_conv, true);
17704 }
17705
17706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17707         LDKSignature o_ref;
17708         CHECK((*env)->GetArrayLength(env, o) == 64);
17709         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
17710         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17711         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
17712         return tag_ptr(ret_conv, true);
17713 }
17714
17715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
17716         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17717         *ret_conv = CResult_SignatureNoneZ_err();
17718         return tag_ptr(ret_conv, true);
17719 }
17720
17721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17722         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
17723         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
17724         return ret_conv;
17725 }
17726
17727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17728         if (!ptr_is_owned(_res)) return;
17729         void* _res_ptr = untag_ptr(_res);
17730         CHECK_ACCESS(_res_ptr);
17731         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
17732         FREE(untag_ptr(_res));
17733         CResult_SignatureNoneZ_free(_res_conv);
17734 }
17735
17736 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
17737         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17738         *ret_conv = CResult_SignatureNoneZ_clone(arg);
17739         return tag_ptr(ret_conv, true);
17740 }
17741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17742         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
17743         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
17744         return ret_conv;
17745 }
17746
17747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17748         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
17749         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17750         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
17751         return tag_ptr(ret_conv, true);
17752 }
17753
17754 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
17755         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17756         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
17757         return tag_ptr(ret_conv, true);
17758 }
17759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17760         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
17761         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
17762         return ret_conv;
17763 }
17764
17765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17766         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
17767         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17768         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
17769         return tag_ptr(ret_conv, true);
17770 }
17771
17772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17773         LDKSignature a_ref;
17774         CHECK((*env)->GetArrayLength(env, a) == 64);
17775         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
17776         LDKSignature b_ref;
17777         CHECK((*env)->GetArrayLength(env, b) == 64);
17778         (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
17779         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17780         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
17781         return tag_ptr(ret_conv, true);
17782 }
17783
17784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17785         if (!ptr_is_owned(_res)) return;
17786         void* _res_ptr = untag_ptr(_res);
17787         CHECK_ACCESS(_res_ptr);
17788         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
17789         FREE(untag_ptr(_res));
17790         C2Tuple_SignatureSignatureZ_free(_res_conv);
17791 }
17792
17793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17794         void* o_ptr = untag_ptr(o);
17795         CHECK_ACCESS(o_ptr);
17796         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
17797         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
17798         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17799         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
17800         return tag_ptr(ret_conv, true);
17801 }
17802
17803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
17804         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17805         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
17806         return tag_ptr(ret_conv, true);
17807 }
17808
17809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17810         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
17811         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
17812         return ret_conv;
17813 }
17814
17815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17816         if (!ptr_is_owned(_res)) return;
17817         void* _res_ptr = untag_ptr(_res);
17818         CHECK_ACCESS(_res_ptr);
17819         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
17820         FREE(untag_ptr(_res));
17821         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
17822 }
17823
17824 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
17825         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17826         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
17827         return tag_ptr(ret_conv, true);
17828 }
17829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17830         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
17831         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
17832         return ret_conv;
17833 }
17834
17835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17836         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
17837         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17838         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
17839         return tag_ptr(ret_conv, true);
17840 }
17841
17842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17843         LDKSecretKey o_ref;
17844         CHECK((*env)->GetArrayLength(env, o) == 32);
17845         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
17846         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17847         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
17848         return tag_ptr(ret_conv, true);
17849 }
17850
17851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
17852         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17853         *ret_conv = CResult_SecretKeyNoneZ_err();
17854         return tag_ptr(ret_conv, true);
17855 }
17856
17857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17858         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
17859         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
17860         return ret_conv;
17861 }
17862
17863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17864         if (!ptr_is_owned(_res)) return;
17865         void* _res_ptr = untag_ptr(_res);
17866         CHECK_ACCESS(_res_ptr);
17867         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
17868         FREE(untag_ptr(_res));
17869         CResult_SecretKeyNoneZ_free(_res_conv);
17870 }
17871
17872 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
17873         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17874         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
17875         return tag_ptr(ret_conv, true);
17876 }
17877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17878         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
17879         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
17880         return ret_conv;
17881 }
17882
17883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17884         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
17885         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17886         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
17887         return tag_ptr(ret_conv, true);
17888 }
17889
17890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17891         void* o_ptr = untag_ptr(o);
17892         CHECK_ACCESS(o_ptr);
17893         LDKSign o_conv = *(LDKSign*)(o_ptr);
17894         if (o_conv.free == LDKSign_JCalls_free) {
17895                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17896                 LDKSign_JCalls_cloned(&o_conv);
17897         }
17898         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17899         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
17900         return tag_ptr(ret_conv, true);
17901 }
17902
17903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17904         LDKDecodeError e_conv;
17905         e_conv.inner = untag_ptr(e);
17906         e_conv.is_owned = ptr_is_owned(e);
17907         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17908         e_conv = DecodeError_clone(&e_conv);
17909         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17910         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
17911         return tag_ptr(ret_conv, true);
17912 }
17913
17914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17915         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
17916         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
17917         return ret_conv;
17918 }
17919
17920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17921         if (!ptr_is_owned(_res)) return;
17922         void* _res_ptr = untag_ptr(_res);
17923         CHECK_ACCESS(_res_ptr);
17924         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
17925         FREE(untag_ptr(_res));
17926         CResult_SignDecodeErrorZ_free(_res_conv);
17927 }
17928
17929 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
17930         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17931         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
17932         return tag_ptr(ret_conv, true);
17933 }
17934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17935         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
17936         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
17937         return ret_conv;
17938 }
17939
17940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17941         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
17942         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17943         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
17944         return tag_ptr(ret_conv, true);
17945 }
17946
17947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17948         LDKCVec_u5Z _res_constr;
17949         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17950         if (_res_constr.datalen > 0)
17951                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
17952         else
17953                 _res_constr.data = NULL;
17954         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
17955         for (size_t h = 0; h < _res_constr.datalen; h++) {
17956                 int8_t _res_conv_7 = _res_vals[h];
17957                 
17958                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
17959         }
17960         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
17961         CVec_u5Z_free(_res_constr);
17962 }
17963
17964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17965         LDKRecoverableSignature o_ref;
17966         CHECK((*env)->GetArrayLength(env, o) == 68);
17967         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
17968         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17969         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
17970         return tag_ptr(ret_conv, true);
17971 }
17972
17973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
17974         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17975         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
17976         return tag_ptr(ret_conv, true);
17977 }
17978
17979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17980         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
17981         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
17982         return ret_conv;
17983 }
17984
17985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17986         if (!ptr_is_owned(_res)) return;
17987         void* _res_ptr = untag_ptr(_res);
17988         CHECK_ACCESS(_res_ptr);
17989         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
17990         FREE(untag_ptr(_res));
17991         CResult_RecoverableSignatureNoneZ_free(_res_conv);
17992 }
17993
17994 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
17995         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17996         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
17997         return tag_ptr(ret_conv, true);
17998 }
17999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18000         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
18001         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
18002         return ret_conv;
18003 }
18004
18005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18006         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
18007         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18008         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
18009         return tag_ptr(ret_conv, true);
18010 }
18011
18012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
18013         LDKCVec_u8Z _res_ref;
18014         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
18015         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18016         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
18017         CVec_u8Z_free(_res_ref);
18018 }
18019
18020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18021         LDKCVec_CVec_u8ZZ _res_constr;
18022         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18023         if (_res_constr.datalen > 0)
18024                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
18025         else
18026                 _res_constr.data = NULL;
18027         for (size_t i = 0; i < _res_constr.datalen; i++) {
18028                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18029                 LDKCVec_u8Z _res_conv_8_ref;
18030                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
18031                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
18032                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
18033                 _res_constr.data[i] = _res_conv_8_ref;
18034         }
18035         CVec_CVec_u8ZZ_free(_res_constr);
18036 }
18037
18038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
18039         LDKCVec_CVec_u8ZZ o_constr;
18040         o_constr.datalen = (*env)->GetArrayLength(env, o);
18041         if (o_constr.datalen > 0)
18042                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
18043         else
18044                 o_constr.data = NULL;
18045         for (size_t i = 0; i < o_constr.datalen; i++) {
18046                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
18047                 LDKCVec_u8Z o_conv_8_ref;
18048                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
18049                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
18050                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
18051                 o_constr.data[i] = o_conv_8_ref;
18052         }
18053         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18054         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
18055         return tag_ptr(ret_conv, true);
18056 }
18057
18058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
18059         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18060         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
18061         return tag_ptr(ret_conv, true);
18062 }
18063
18064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18065         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
18066         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
18067         return ret_conv;
18068 }
18069
18070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18071         if (!ptr_is_owned(_res)) return;
18072         void* _res_ptr = untag_ptr(_res);
18073         CHECK_ACCESS(_res_ptr);
18074         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
18075         FREE(untag_ptr(_res));
18076         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
18077 }
18078
18079 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
18080         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18081         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
18082         return tag_ptr(ret_conv, true);
18083 }
18084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18085         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
18086         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
18087         return ret_conv;
18088 }
18089
18090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18091         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
18092         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18093         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
18094         return tag_ptr(ret_conv, true);
18095 }
18096
18097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18098         LDKInMemorySigner o_conv;
18099         o_conv.inner = untag_ptr(o);
18100         o_conv.is_owned = ptr_is_owned(o);
18101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18102         o_conv = InMemorySigner_clone(&o_conv);
18103         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18104         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
18105         return tag_ptr(ret_conv, true);
18106 }
18107
18108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18109         LDKDecodeError e_conv;
18110         e_conv.inner = untag_ptr(e);
18111         e_conv.is_owned = ptr_is_owned(e);
18112         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18113         e_conv = DecodeError_clone(&e_conv);
18114         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18115         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
18116         return tag_ptr(ret_conv, true);
18117 }
18118
18119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18120         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
18121         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
18122         return ret_conv;
18123 }
18124
18125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18126         if (!ptr_is_owned(_res)) return;
18127         void* _res_ptr = untag_ptr(_res);
18128         CHECK_ACCESS(_res_ptr);
18129         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
18130         FREE(untag_ptr(_res));
18131         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
18132 }
18133
18134 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
18135         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18136         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
18137         return tag_ptr(ret_conv, true);
18138 }
18139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18140         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
18141         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
18142         return ret_conv;
18143 }
18144
18145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18146         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
18147         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18148         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
18149         return tag_ptr(ret_conv, true);
18150 }
18151
18152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18153         LDKCVec_TxOutZ _res_constr;
18154         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18155         if (_res_constr.datalen > 0)
18156                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18157         else
18158                 _res_constr.data = NULL;
18159         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18160         for (size_t h = 0; h < _res_constr.datalen; h++) {
18161                 int64_t _res_conv_7 = _res_vals[h];
18162                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18163                 CHECK_ACCESS(_res_conv_7_ptr);
18164                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
18165                 FREE(untag_ptr(_res_conv_7));
18166                 _res_constr.data[h] = _res_conv_7_conv;
18167         }
18168         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18169         CVec_TxOutZ_free(_res_constr);
18170 }
18171
18172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18173         LDKTransaction o_ref;
18174         o_ref.datalen = (*env)->GetArrayLength(env, o);
18175         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
18176         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
18177         o_ref.data_is_owned = true;
18178         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18179         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
18180         return tag_ptr(ret_conv, true);
18181 }
18182
18183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
18184         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18185         *ret_conv = CResult_TransactionNoneZ_err();
18186         return tag_ptr(ret_conv, true);
18187 }
18188
18189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18190         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
18191         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
18192         return ret_conv;
18193 }
18194
18195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18196         if (!ptr_is_owned(_res)) return;
18197         void* _res_ptr = untag_ptr(_res);
18198         CHECK_ACCESS(_res_ptr);
18199         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
18200         FREE(untag_ptr(_res));
18201         CResult_TransactionNoneZ_free(_res_conv);
18202 }
18203
18204 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18205         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18206         *ret_conv = CResult_TransactionNoneZ_clone(arg);
18207         return tag_ptr(ret_conv, true);
18208 }
18209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18210         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
18211         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18212         return ret_conv;
18213 }
18214
18215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18216         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
18217         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18218         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18219         return tag_ptr(ret_conv, true);
18220 }
18221
18222 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18223         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18224         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18225         return tag_ptr(ret_conv, true);
18226 }
18227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18228         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18229         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18230         return ret_conv;
18231 }
18232
18233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18234         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18235         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18236         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18237         return tag_ptr(ret_conv, true);
18238 }
18239
18240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18241         LDKThirtyTwoBytes a_ref;
18242         CHECK((*env)->GetArrayLength(env, a) == 32);
18243         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18244         LDKChannelMonitor b_conv;
18245         b_conv.inner = untag_ptr(b);
18246         b_conv.is_owned = ptr_is_owned(b);
18247         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18248         b_conv = ChannelMonitor_clone(&b_conv);
18249         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18250         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18251         return tag_ptr(ret_conv, true);
18252 }
18253
18254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18255         if (!ptr_is_owned(_res)) return;
18256         void* _res_ptr = untag_ptr(_res);
18257         CHECK_ACCESS(_res_ptr);
18258         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18259         FREE(untag_ptr(_res));
18260         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18261 }
18262
18263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18264         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
18265         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18266         if (_res_constr.datalen > 0)
18267                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18268         else
18269                 _res_constr.data = NULL;
18270         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18271         for (size_t j = 0; j < _res_constr.datalen; j++) {
18272                 int64_t _res_conv_35 = _res_vals[j];
18273                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
18274                 CHECK_ACCESS(_res_conv_35_ptr);
18275                 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
18276                 FREE(untag_ptr(_res_conv_35));
18277                 _res_constr.data[j] = _res_conv_35_conv;
18278         }
18279         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18280         CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
18281 }
18282
18283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
18284         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
18285         o_constr.datalen = (*env)->GetArrayLength(env, o);
18286         if (o_constr.datalen > 0)
18287                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18288         else
18289                 o_constr.data = NULL;
18290         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18291         for (size_t j = 0; j < o_constr.datalen; j++) {
18292                 int64_t o_conv_35 = o_vals[j];
18293                 void* o_conv_35_ptr = untag_ptr(o_conv_35);
18294                 CHECK_ACCESS(o_conv_35_ptr);
18295                 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
18296                 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o_conv_35));
18297                 o_constr.data[j] = o_conv_35_conv;
18298         }
18299         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18300         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18301         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
18302         return tag_ptr(ret_conv, true);
18303 }
18304
18305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18306         LDKIOError e_conv = LDKIOError_from_java(env, e);
18307         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18308         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
18309         return tag_ptr(ret_conv, true);
18310 }
18311
18312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18313         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(o);
18314         jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
18315         return ret_conv;
18316 }
18317
18318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18319         if (!ptr_is_owned(_res)) return;
18320         void* _res_ptr = untag_ptr(_res);
18321         CHECK_ACCESS(_res_ptr);
18322         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
18323         FREE(untag_ptr(_res));
18324         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
18325 }
18326
18327 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
18328         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18329         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
18330         return tag_ptr(ret_conv, true);
18331 }
18332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18333         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(arg);
18334         int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
18335         return ret_conv;
18336 }
18337
18338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18339         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(orig);
18340         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18341         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
18342         return tag_ptr(ret_conv, true);
18343 }
18344
18345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
18346         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18347         *ret_copy = COption_u16Z_some(o);
18348         int64_t ret_ref = tag_ptr(ret_copy, true);
18349         return ret_ref;
18350 }
18351
18352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
18353         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18354         *ret_copy = COption_u16Z_none();
18355         int64_t ret_ref = tag_ptr(ret_copy, true);
18356         return ret_ref;
18357 }
18358
18359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
18360         if (!ptr_is_owned(_res)) return;
18361         void* _res_ptr = untag_ptr(_res);
18362         CHECK_ACCESS(_res_ptr);
18363         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
18364         FREE(untag_ptr(_res));
18365         COption_u16Z_free(_res_conv);
18366 }
18367
18368 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
18369         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18370         *ret_copy = COption_u16Z_clone(arg);
18371         int64_t ret_ref = tag_ptr(ret_copy, true);
18372         return ret_ref;
18373 }
18374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18375         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
18376         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
18377         return ret_conv;
18378 }
18379
18380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18381         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
18382         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18383         *ret_copy = COption_u16Z_clone(orig_conv);
18384         int64_t ret_ref = tag_ptr(ret_copy, true);
18385         return ret_ref;
18386 }
18387
18388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
18389         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18390         *ret_conv = CResult_NoneAPIErrorZ_ok();
18391         return tag_ptr(ret_conv, true);
18392 }
18393
18394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18395         void* e_ptr = untag_ptr(e);
18396         CHECK_ACCESS(e_ptr);
18397         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18398         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18399         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18400         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18401         return tag_ptr(ret_conv, true);
18402 }
18403
18404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18405         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
18406         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18407         return ret_conv;
18408 }
18409
18410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18411         if (!ptr_is_owned(_res)) return;
18412         void* _res_ptr = untag_ptr(_res);
18413         CHECK_ACCESS(_res_ptr);
18414         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18415         FREE(untag_ptr(_res));
18416         CResult_NoneAPIErrorZ_free(_res_conv);
18417 }
18418
18419 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18420         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18421         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18422         return tag_ptr(ret_conv, true);
18423 }
18424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18425         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
18426         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18427         return ret_conv;
18428 }
18429
18430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18431         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
18432         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18433         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18434         return tag_ptr(ret_conv, true);
18435 }
18436
18437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18438         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18439         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18440         if (_res_constr.datalen > 0)
18441                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18442         else
18443                 _res_constr.data = NULL;
18444         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18445         for (size_t w = 0; w < _res_constr.datalen; w++) {
18446                 int64_t _res_conv_22 = _res_vals[w];
18447                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
18448                 CHECK_ACCESS(_res_conv_22_ptr);
18449                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18450                 FREE(untag_ptr(_res_conv_22));
18451                 _res_constr.data[w] = _res_conv_22_conv;
18452         }
18453         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18454         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18455 }
18456
18457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18458         LDKCVec_APIErrorZ _res_constr;
18459         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18460         if (_res_constr.datalen > 0)
18461                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18462         else
18463                 _res_constr.data = NULL;
18464         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18465         for (size_t k = 0; k < _res_constr.datalen; k++) {
18466                 int64_t _res_conv_10 = _res_vals[k];
18467                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
18468                 CHECK_ACCESS(_res_conv_10_ptr);
18469                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18470                 FREE(untag_ptr(_res_conv_10));
18471                 _res_constr.data[k] = _res_conv_10_conv;
18472         }
18473         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18474         CVec_APIErrorZ_free(_res_constr);
18475 }
18476
18477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18478         LDKThirtyTwoBytes o_ref;
18479         CHECK((*env)->GetArrayLength(env, o) == 32);
18480         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18481         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18482         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
18483         return tag_ptr(ret_conv, true);
18484 }
18485
18486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18487         void* e_ptr = untag_ptr(e);
18488         CHECK_ACCESS(e_ptr);
18489         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18490         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18491         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18492         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
18493         return tag_ptr(ret_conv, true);
18494 }
18495
18496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18497         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
18498         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
18499         return ret_conv;
18500 }
18501
18502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18503         if (!ptr_is_owned(_res)) return;
18504         void* _res_ptr = untag_ptr(_res);
18505         CHECK_ACCESS(_res_ptr);
18506         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
18507         FREE(untag_ptr(_res));
18508         CResult__u832APIErrorZ_free(_res_conv);
18509 }
18510
18511 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
18512         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18513         *ret_conv = CResult__u832APIErrorZ_clone(arg);
18514         return tag_ptr(ret_conv, true);
18515 }
18516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18517         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
18518         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
18519         return ret_conv;
18520 }
18521
18522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18523         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
18524         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18525         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
18526         return tag_ptr(ret_conv, true);
18527 }
18528
18529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18530         LDKThirtyTwoBytes o_ref;
18531         CHECK((*env)->GetArrayLength(env, o) == 32);
18532         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18533         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18534         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
18535         return tag_ptr(ret_conv, true);
18536 }
18537
18538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18539         void* e_ptr = untag_ptr(e);
18540         CHECK_ACCESS(e_ptr);
18541         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18542         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18543         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18544         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
18545         return tag_ptr(ret_conv, true);
18546 }
18547
18548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18549         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
18550         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
18551         return ret_conv;
18552 }
18553
18554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18555         if (!ptr_is_owned(_res)) return;
18556         void* _res_ptr = untag_ptr(_res);
18557         CHECK_ACCESS(_res_ptr);
18558         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
18559         FREE(untag_ptr(_res));
18560         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
18561 }
18562
18563 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
18564         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18565         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
18566         return tag_ptr(ret_conv, true);
18567 }
18568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18569         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
18570         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
18571         return ret_conv;
18572 }
18573
18574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18575         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
18576         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18577         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
18578         return tag_ptr(ret_conv, true);
18579 }
18580
18581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
18582         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18583         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
18584         return tag_ptr(ret_conv, true);
18585 }
18586
18587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18588         void* e_ptr = untag_ptr(e);
18589         CHECK_ACCESS(e_ptr);
18590         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18591         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18592         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18593         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
18594         return tag_ptr(ret_conv, true);
18595 }
18596
18597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18598         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
18599         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
18600         return ret_conv;
18601 }
18602
18603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18604         if (!ptr_is_owned(_res)) return;
18605         void* _res_ptr = untag_ptr(_res);
18606         CHECK_ACCESS(_res_ptr);
18607         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
18608         FREE(untag_ptr(_res));
18609         CResult_NonePaymentSendFailureZ_free(_res_conv);
18610 }
18611
18612 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
18613         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18614         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
18615         return tag_ptr(ret_conv, true);
18616 }
18617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18618         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
18619         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
18620         return ret_conv;
18621 }
18622
18623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18624         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
18625         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18626         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
18627         return tag_ptr(ret_conv, true);
18628 }
18629
18630 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
18631         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18632         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
18633         return tag_ptr(ret_conv, true);
18634 }
18635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18636         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
18637         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
18638         return ret_conv;
18639 }
18640
18641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18642         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
18643         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18644         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
18645         return tag_ptr(ret_conv, true);
18646 }
18647
18648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18649         LDKThirtyTwoBytes a_ref;
18650         CHECK((*env)->GetArrayLength(env, a) == 32);
18651         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18652         LDKThirtyTwoBytes b_ref;
18653         CHECK((*env)->GetArrayLength(env, b) == 32);
18654         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18655         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18656         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
18657         return tag_ptr(ret_conv, true);
18658 }
18659
18660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18661         if (!ptr_is_owned(_res)) return;
18662         void* _res_ptr = untag_ptr(_res);
18663         CHECK_ACCESS(_res_ptr);
18664         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
18665         FREE(untag_ptr(_res));
18666         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
18667 }
18668
18669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18670         void* o_ptr = untag_ptr(o);
18671         CHECK_ACCESS(o_ptr);
18672         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
18673         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
18674         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18675         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
18676         return tag_ptr(ret_conv, true);
18677 }
18678
18679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18680         void* e_ptr = untag_ptr(e);
18681         CHECK_ACCESS(e_ptr);
18682         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18683         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18684         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18685         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
18686         return tag_ptr(ret_conv, true);
18687 }
18688
18689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18690         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
18691         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
18692         return ret_conv;
18693 }
18694
18695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18696         if (!ptr_is_owned(_res)) return;
18697         void* _res_ptr = untag_ptr(_res);
18698         CHECK_ACCESS(_res_ptr);
18699         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
18700         FREE(untag_ptr(_res));
18701         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
18702 }
18703
18704 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
18705         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18706         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
18707         return tag_ptr(ret_conv, true);
18708 }
18709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18710         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
18711         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
18712         return ret_conv;
18713 }
18714
18715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18716         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
18717         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18718         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
18719         return tag_ptr(ret_conv, true);
18720 }
18721
18722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18723         LDKCVec_ThirtyTwoBytesZ _res_constr;
18724         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18725         if (_res_constr.datalen > 0)
18726                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
18727         else
18728                 _res_constr.data = NULL;
18729         for (size_t i = 0; i < _res_constr.datalen; i++) {
18730                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18731                 LDKThirtyTwoBytes _res_conv_8_ref;
18732                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
18733                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
18734                 _res_constr.data[i] = _res_conv_8_ref;
18735         }
18736         CVec_ThirtyTwoBytesZ_free(_res_constr);
18737 }
18738
18739 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
18740         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18741         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
18742         return tag_ptr(ret_conv, true);
18743 }
18744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18745         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
18746         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
18747         return ret_conv;
18748 }
18749
18750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18751         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
18752         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18753         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
18754         return tag_ptr(ret_conv, true);
18755 }
18756
18757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18758         LDKThirtyTwoBytes a_ref;
18759         CHECK((*env)->GetArrayLength(env, a) == 32);
18760         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18761         LDKThirtyTwoBytes b_ref;
18762         CHECK((*env)->GetArrayLength(env, b) == 32);
18763         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18764         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18765         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
18766         return tag_ptr(ret_conv, true);
18767 }
18768
18769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18770         if (!ptr_is_owned(_res)) return;
18771         void* _res_ptr = untag_ptr(_res);
18772         CHECK_ACCESS(_res_ptr);
18773         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
18774         FREE(untag_ptr(_res));
18775         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
18776 }
18777
18778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18779         void* o_ptr = untag_ptr(o);
18780         CHECK_ACCESS(o_ptr);
18781         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
18782         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
18783         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18784         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
18785         return tag_ptr(ret_conv, true);
18786 }
18787
18788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
18789         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18790         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
18791         return tag_ptr(ret_conv, true);
18792 }
18793
18794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18795         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
18796         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
18797         return ret_conv;
18798 }
18799
18800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18801         if (!ptr_is_owned(_res)) return;
18802         void* _res_ptr = untag_ptr(_res);
18803         CHECK_ACCESS(_res_ptr);
18804         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
18805         FREE(untag_ptr(_res));
18806         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
18807 }
18808
18809 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
18810         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18811         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
18812         return tag_ptr(ret_conv, true);
18813 }
18814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18815         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
18816         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
18817         return ret_conv;
18818 }
18819
18820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18821         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
18822         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18823         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
18824         return tag_ptr(ret_conv, true);
18825 }
18826
18827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18828         void* o_ptr = untag_ptr(o);
18829         CHECK_ACCESS(o_ptr);
18830         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
18831         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
18832         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18833         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
18834         return tag_ptr(ret_conv, true);
18835 }
18836
18837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18838         void* e_ptr = untag_ptr(e);
18839         CHECK_ACCESS(e_ptr);
18840         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18841         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18842         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18843         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
18844         return tag_ptr(ret_conv, true);
18845 }
18846
18847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18848         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
18849         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
18850         return ret_conv;
18851 }
18852
18853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18854         if (!ptr_is_owned(_res)) return;
18855         void* _res_ptr = untag_ptr(_res);
18856         CHECK_ACCESS(_res_ptr);
18857         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
18858         FREE(untag_ptr(_res));
18859         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
18860 }
18861
18862 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
18863         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18864         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
18865         return tag_ptr(ret_conv, true);
18866 }
18867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18868         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
18869         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
18870         return ret_conv;
18871 }
18872
18873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18874         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
18875         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18876         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
18877         return tag_ptr(ret_conv, true);
18878 }
18879
18880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18881         LDKThirtyTwoBytes o_ref;
18882         CHECK((*env)->GetArrayLength(env, o) == 32);
18883         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18884         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18885         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
18886         return tag_ptr(ret_conv, true);
18887 }
18888
18889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
18890         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18891         *ret_conv = CResult_PaymentSecretNoneZ_err();
18892         return tag_ptr(ret_conv, true);
18893 }
18894
18895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18896         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
18897         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
18898         return ret_conv;
18899 }
18900
18901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18902         if (!ptr_is_owned(_res)) return;
18903         void* _res_ptr = untag_ptr(_res);
18904         CHECK_ACCESS(_res_ptr);
18905         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
18906         FREE(untag_ptr(_res));
18907         CResult_PaymentSecretNoneZ_free(_res_conv);
18908 }
18909
18910 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
18911         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18912         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
18913         return tag_ptr(ret_conv, true);
18914 }
18915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18916         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
18917         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
18918         return ret_conv;
18919 }
18920
18921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18922         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
18923         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18924         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
18925         return tag_ptr(ret_conv, true);
18926 }
18927
18928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18929         LDKThirtyTwoBytes o_ref;
18930         CHECK((*env)->GetArrayLength(env, o) == 32);
18931         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18932         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18933         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
18934         return tag_ptr(ret_conv, true);
18935 }
18936
18937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18938         void* e_ptr = untag_ptr(e);
18939         CHECK_ACCESS(e_ptr);
18940         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18941         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18942         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18943         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
18944         return tag_ptr(ret_conv, true);
18945 }
18946
18947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18948         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
18949         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
18950         return ret_conv;
18951 }
18952
18953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18954         if (!ptr_is_owned(_res)) return;
18955         void* _res_ptr = untag_ptr(_res);
18956         CHECK_ACCESS(_res_ptr);
18957         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
18958         FREE(untag_ptr(_res));
18959         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
18960 }
18961
18962 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
18963         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18964         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
18965         return tag_ptr(ret_conv, true);
18966 }
18967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18968         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
18969         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
18970         return ret_conv;
18971 }
18972
18973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18974         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
18975         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18976         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
18977         return tag_ptr(ret_conv, true);
18978 }
18979
18980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18981         LDKThirtyTwoBytes o_ref;
18982         CHECK((*env)->GetArrayLength(env, o) == 32);
18983         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18984         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18985         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
18986         return tag_ptr(ret_conv, true);
18987 }
18988
18989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18990         void* e_ptr = untag_ptr(e);
18991         CHECK_ACCESS(e_ptr);
18992         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18993         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18994         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18995         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
18996         return tag_ptr(ret_conv, true);
18997 }
18998
18999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19000         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
19001         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
19002         return ret_conv;
19003 }
19004
19005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19006         if (!ptr_is_owned(_res)) return;
19007         void* _res_ptr = untag_ptr(_res);
19008         CHECK_ACCESS(_res_ptr);
19009         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
19010         FREE(untag_ptr(_res));
19011         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
19012 }
19013
19014 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
19015         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19016         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
19017         return tag_ptr(ret_conv, true);
19018 }
19019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19020         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
19021         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
19022         return ret_conv;
19023 }
19024
19025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19026         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
19027         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19028         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
19029         return tag_ptr(ret_conv, true);
19030 }
19031
19032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19033         LDKCounterpartyForwardingInfo o_conv;
19034         o_conv.inner = untag_ptr(o);
19035         o_conv.is_owned = ptr_is_owned(o);
19036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19037         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
19038         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19039         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
19040         return tag_ptr(ret_conv, true);
19041 }
19042
19043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19044         LDKDecodeError e_conv;
19045         e_conv.inner = untag_ptr(e);
19046         e_conv.is_owned = ptr_is_owned(e);
19047         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19048         e_conv = DecodeError_clone(&e_conv);
19049         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19050         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
19051         return tag_ptr(ret_conv, true);
19052 }
19053
19054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19055         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
19056         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
19057         return ret_conv;
19058 }
19059
19060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19061         if (!ptr_is_owned(_res)) return;
19062         void* _res_ptr = untag_ptr(_res);
19063         CHECK_ACCESS(_res_ptr);
19064         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
19065         FREE(untag_ptr(_res));
19066         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
19067 }
19068
19069 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
19070         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19071         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
19072         return tag_ptr(ret_conv, true);
19073 }
19074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19075         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
19076         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
19077         return ret_conv;
19078 }
19079
19080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19081         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
19082         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19083         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
19084         return tag_ptr(ret_conv, true);
19085 }
19086
19087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19088         LDKChannelCounterparty o_conv;
19089         o_conv.inner = untag_ptr(o);
19090         o_conv.is_owned = ptr_is_owned(o);
19091         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19092         o_conv = ChannelCounterparty_clone(&o_conv);
19093         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19094         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
19095         return tag_ptr(ret_conv, true);
19096 }
19097
19098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19099         LDKDecodeError e_conv;
19100         e_conv.inner = untag_ptr(e);
19101         e_conv.is_owned = ptr_is_owned(e);
19102         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19103         e_conv = DecodeError_clone(&e_conv);
19104         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19105         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
19106         return tag_ptr(ret_conv, true);
19107 }
19108
19109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19110         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
19111         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
19112         return ret_conv;
19113 }
19114
19115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19116         if (!ptr_is_owned(_res)) return;
19117         void* _res_ptr = untag_ptr(_res);
19118         CHECK_ACCESS(_res_ptr);
19119         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
19120         FREE(untag_ptr(_res));
19121         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
19122 }
19123
19124 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
19125         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19126         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
19127         return tag_ptr(ret_conv, true);
19128 }
19129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19130         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
19131         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
19132         return ret_conv;
19133 }
19134
19135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19136         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
19137         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19138         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
19139         return tag_ptr(ret_conv, true);
19140 }
19141
19142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19143         LDKChannelDetails o_conv;
19144         o_conv.inner = untag_ptr(o);
19145         o_conv.is_owned = ptr_is_owned(o);
19146         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19147         o_conv = ChannelDetails_clone(&o_conv);
19148         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19149         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
19150         return tag_ptr(ret_conv, true);
19151 }
19152
19153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19154         LDKDecodeError e_conv;
19155         e_conv.inner = untag_ptr(e);
19156         e_conv.is_owned = ptr_is_owned(e);
19157         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19158         e_conv = DecodeError_clone(&e_conv);
19159         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19160         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
19161         return tag_ptr(ret_conv, true);
19162 }
19163
19164 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19165         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
19166         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
19167         return ret_conv;
19168 }
19169
19170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19171         if (!ptr_is_owned(_res)) return;
19172         void* _res_ptr = untag_ptr(_res);
19173         CHECK_ACCESS(_res_ptr);
19174         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
19175         FREE(untag_ptr(_res));
19176         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
19177 }
19178
19179 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
19180         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19181         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
19182         return tag_ptr(ret_conv, true);
19183 }
19184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19185         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
19186         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
19187         return ret_conv;
19188 }
19189
19190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19191         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
19192         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19193         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
19194         return tag_ptr(ret_conv, true);
19195 }
19196
19197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19198         LDKPhantomRouteHints o_conv;
19199         o_conv.inner = untag_ptr(o);
19200         o_conv.is_owned = ptr_is_owned(o);
19201         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19202         o_conv = PhantomRouteHints_clone(&o_conv);
19203         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19204         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
19205         return tag_ptr(ret_conv, true);
19206 }
19207
19208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19209         LDKDecodeError e_conv;
19210         e_conv.inner = untag_ptr(e);
19211         e_conv.is_owned = ptr_is_owned(e);
19212         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19213         e_conv = DecodeError_clone(&e_conv);
19214         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19215         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
19216         return tag_ptr(ret_conv, true);
19217 }
19218
19219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19220         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
19221         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
19222         return ret_conv;
19223 }
19224
19225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19226         if (!ptr_is_owned(_res)) return;
19227         void* _res_ptr = untag_ptr(_res);
19228         CHECK_ACCESS(_res_ptr);
19229         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
19230         FREE(untag_ptr(_res));
19231         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
19232 }
19233
19234 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
19235         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19236         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
19237         return tag_ptr(ret_conv, true);
19238 }
19239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19240         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
19241         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
19242         return ret_conv;
19243 }
19244
19245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19246         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
19247         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19248         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
19249         return tag_ptr(ret_conv, true);
19250 }
19251
19252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19253         LDKCVec_ChannelMonitorZ _res_constr;
19254         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19255         if (_res_constr.datalen > 0)
19256                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19257         else
19258                 _res_constr.data = NULL;
19259         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19260         for (size_t q = 0; q < _res_constr.datalen; q++) {
19261                 int64_t _res_conv_16 = _res_vals[q];
19262                 LDKChannelMonitor _res_conv_16_conv;
19263                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19264                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19265                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19266                 _res_constr.data[q] = _res_conv_16_conv;
19267         }
19268         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19269         CVec_ChannelMonitorZ_free(_res_constr);
19270 }
19271
19272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19273         LDKThirtyTwoBytes a_ref;
19274         CHECK((*env)->GetArrayLength(env, a) == 32);
19275         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19276         LDKChannelManager b_conv;
19277         b_conv.inner = untag_ptr(b);
19278         b_conv.is_owned = ptr_is_owned(b);
19279         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19280         // WARNING: we need a move here but no clone is available for LDKChannelManager
19281         
19282         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
19283         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
19284         return tag_ptr(ret_conv, true);
19285 }
19286
19287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19288         if (!ptr_is_owned(_res)) return;
19289         void* _res_ptr = untag_ptr(_res);
19290         CHECK_ACCESS(_res_ptr);
19291         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
19292         FREE(untag_ptr(_res));
19293         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
19294 }
19295
19296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19297         void* o_ptr = untag_ptr(o);
19298         CHECK_ACCESS(o_ptr);
19299         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
19300         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
19301         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19302         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
19303         return tag_ptr(ret_conv, true);
19304 }
19305
19306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19307         LDKDecodeError e_conv;
19308         e_conv.inner = untag_ptr(e);
19309         e_conv.is_owned = ptr_is_owned(e);
19310         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19311         e_conv = DecodeError_clone(&e_conv);
19312         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19313         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
19314         return tag_ptr(ret_conv, true);
19315 }
19316
19317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19318         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
19319         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
19320         return ret_conv;
19321 }
19322
19323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19324         if (!ptr_is_owned(_res)) return;
19325         void* _res_ptr = untag_ptr(_res);
19326         CHECK_ACCESS(_res_ptr);
19327         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
19328         FREE(untag_ptr(_res));
19329         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
19330 }
19331
19332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19333         LDKChannelConfig o_conv;
19334         o_conv.inner = untag_ptr(o);
19335         o_conv.is_owned = ptr_is_owned(o);
19336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19337         o_conv = ChannelConfig_clone(&o_conv);
19338         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19339         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
19340         return tag_ptr(ret_conv, true);
19341 }
19342
19343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19344         LDKDecodeError e_conv;
19345         e_conv.inner = untag_ptr(e);
19346         e_conv.is_owned = ptr_is_owned(e);
19347         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19348         e_conv = DecodeError_clone(&e_conv);
19349         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19350         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
19351         return tag_ptr(ret_conv, true);
19352 }
19353
19354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19355         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
19356         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
19357         return ret_conv;
19358 }
19359
19360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19361         if (!ptr_is_owned(_res)) return;
19362         void* _res_ptr = untag_ptr(_res);
19363         CHECK_ACCESS(_res_ptr);
19364         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
19365         FREE(untag_ptr(_res));
19366         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
19367 }
19368
19369 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
19370         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19371         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
19372         return tag_ptr(ret_conv, true);
19373 }
19374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19375         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
19376         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
19377         return ret_conv;
19378 }
19379
19380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19381         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
19382         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19383         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
19384         return tag_ptr(ret_conv, true);
19385 }
19386
19387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19388         LDKOutPoint o_conv;
19389         o_conv.inner = untag_ptr(o);
19390         o_conv.is_owned = ptr_is_owned(o);
19391         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19392         o_conv = OutPoint_clone(&o_conv);
19393         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19394         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
19395         return tag_ptr(ret_conv, true);
19396 }
19397
19398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19399         LDKDecodeError e_conv;
19400         e_conv.inner = untag_ptr(e);
19401         e_conv.is_owned = ptr_is_owned(e);
19402         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19403         e_conv = DecodeError_clone(&e_conv);
19404         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19405         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
19406         return tag_ptr(ret_conv, true);
19407 }
19408
19409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19410         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
19411         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
19412         return ret_conv;
19413 }
19414
19415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19416         if (!ptr_is_owned(_res)) return;
19417         void* _res_ptr = untag_ptr(_res);
19418         CHECK_ACCESS(_res_ptr);
19419         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
19420         FREE(untag_ptr(_res));
19421         CResult_OutPointDecodeErrorZ_free(_res_conv);
19422 }
19423
19424 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
19425         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19426         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
19427         return tag_ptr(ret_conv, true);
19428 }
19429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19430         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
19431         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
19432         return ret_conv;
19433 }
19434
19435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19436         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
19437         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19438         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
19439         return tag_ptr(ret_conv, true);
19440 }
19441
19442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19443         void* o_ptr = untag_ptr(o);
19444         CHECK_ACCESS(o_ptr);
19445         LDKType o_conv = *(LDKType*)(o_ptr);
19446         if (o_conv.free == LDKType_JCalls_free) {
19447                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19448                 LDKType_JCalls_cloned(&o_conv);
19449         }
19450         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19451         *ret_copy = COption_TypeZ_some(o_conv);
19452         int64_t ret_ref = tag_ptr(ret_copy, true);
19453         return ret_ref;
19454 }
19455
19456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
19457         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19458         *ret_copy = COption_TypeZ_none();
19459         int64_t ret_ref = tag_ptr(ret_copy, true);
19460         return ret_ref;
19461 }
19462
19463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19464         if (!ptr_is_owned(_res)) return;
19465         void* _res_ptr = untag_ptr(_res);
19466         CHECK_ACCESS(_res_ptr);
19467         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
19468         FREE(untag_ptr(_res));
19469         COption_TypeZ_free(_res_conv);
19470 }
19471
19472 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
19473         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19474         *ret_copy = COption_TypeZ_clone(arg);
19475         int64_t ret_ref = tag_ptr(ret_copy, true);
19476         return ret_ref;
19477 }
19478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19479         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
19480         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
19481         return ret_conv;
19482 }
19483
19484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19485         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
19486         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19487         *ret_copy = COption_TypeZ_clone(orig_conv);
19488         int64_t ret_ref = tag_ptr(ret_copy, true);
19489         return ret_ref;
19490 }
19491
19492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19493         void* o_ptr = untag_ptr(o);
19494         CHECK_ACCESS(o_ptr);
19495         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
19496         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
19497         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19498         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
19499         return tag_ptr(ret_conv, true);
19500 }
19501
19502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19503         LDKDecodeError e_conv;
19504         e_conv.inner = untag_ptr(e);
19505         e_conv.is_owned = ptr_is_owned(e);
19506         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19507         e_conv = DecodeError_clone(&e_conv);
19508         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19509         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
19510         return tag_ptr(ret_conv, true);
19511 }
19512
19513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19514         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
19515         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
19516         return ret_conv;
19517 }
19518
19519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19520         if (!ptr_is_owned(_res)) return;
19521         void* _res_ptr = untag_ptr(_res);
19522         CHECK_ACCESS(_res_ptr);
19523         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
19524         FREE(untag_ptr(_res));
19525         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
19526 }
19527
19528 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
19529         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19530         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
19531         return tag_ptr(ret_conv, true);
19532 }
19533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19534         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
19535         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
19536         return ret_conv;
19537 }
19538
19539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19540         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
19541         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19542         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
19543         return tag_ptr(ret_conv, true);
19544 }
19545
19546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19547         LDKThirtyTwoBytes o_ref;
19548         CHECK((*env)->GetArrayLength(env, o) == 32);
19549         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19550         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19551         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
19552         return tag_ptr(ret_conv, true);
19553 }
19554
19555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19556         void* e_ptr = untag_ptr(e);
19557         CHECK_ACCESS(e_ptr);
19558         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
19559         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
19560         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19561         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
19562         return tag_ptr(ret_conv, true);
19563 }
19564
19565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19566         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
19567         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
19568         return ret_conv;
19569 }
19570
19571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19572         if (!ptr_is_owned(_res)) return;
19573         void* _res_ptr = untag_ptr(_res);
19574         CHECK_ACCESS(_res_ptr);
19575         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
19576         FREE(untag_ptr(_res));
19577         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
19578 }
19579
19580 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
19581         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19582         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
19583         return tag_ptr(ret_conv, true);
19584 }
19585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19586         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
19587         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
19588         return ret_conv;
19589 }
19590
19591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19592         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
19593         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19594         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
19595         return tag_ptr(ret_conv, true);
19596 }
19597
19598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
19599         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
19600         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19601         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
19602         return tag_ptr(ret_conv, true);
19603 }
19604
19605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19606         void* e_ptr = untag_ptr(e);
19607         CHECK_ACCESS(e_ptr);
19608         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19609         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19610         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19611         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
19612         return tag_ptr(ret_conv, true);
19613 }
19614
19615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19616         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
19617         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
19618         return ret_conv;
19619 }
19620
19621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19622         if (!ptr_is_owned(_res)) return;
19623         void* _res_ptr = untag_ptr(_res);
19624         CHECK_ACCESS(_res_ptr);
19625         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
19626         FREE(untag_ptr(_res));
19627         CResult_SiPrefixParseErrorZ_free(_res_conv);
19628 }
19629
19630 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
19631         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19632         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
19633         return tag_ptr(ret_conv, true);
19634 }
19635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19636         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
19637         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
19638         return ret_conv;
19639 }
19640
19641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19642         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
19643         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19644         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
19645         return tag_ptr(ret_conv, true);
19646 }
19647
19648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19649         LDKInvoice o_conv;
19650         o_conv.inner = untag_ptr(o);
19651         o_conv.is_owned = ptr_is_owned(o);
19652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19653         o_conv = Invoice_clone(&o_conv);
19654         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19655         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
19656         return tag_ptr(ret_conv, true);
19657 }
19658
19659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19660         void* e_ptr = untag_ptr(e);
19661         CHECK_ACCESS(e_ptr);
19662         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
19663         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
19664         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19665         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
19666         return tag_ptr(ret_conv, true);
19667 }
19668
19669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19670         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
19671         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
19672         return ret_conv;
19673 }
19674
19675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19676         if (!ptr_is_owned(_res)) return;
19677         void* _res_ptr = untag_ptr(_res);
19678         CHECK_ACCESS(_res_ptr);
19679         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
19680         FREE(untag_ptr(_res));
19681         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
19682 }
19683
19684 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
19685         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19686         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
19687         return tag_ptr(ret_conv, true);
19688 }
19689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19690         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
19691         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
19692         return ret_conv;
19693 }
19694
19695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19696         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
19697         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19698         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
19699         return tag_ptr(ret_conv, true);
19700 }
19701
19702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19703         LDKSignedRawInvoice o_conv;
19704         o_conv.inner = untag_ptr(o);
19705         o_conv.is_owned = ptr_is_owned(o);
19706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19707         o_conv = SignedRawInvoice_clone(&o_conv);
19708         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19709         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
19710         return tag_ptr(ret_conv, true);
19711 }
19712
19713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19714         void* e_ptr = untag_ptr(e);
19715         CHECK_ACCESS(e_ptr);
19716         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19717         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19718         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19719         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
19720         return tag_ptr(ret_conv, true);
19721 }
19722
19723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19724         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
19725         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
19726         return ret_conv;
19727 }
19728
19729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19730         if (!ptr_is_owned(_res)) return;
19731         void* _res_ptr = untag_ptr(_res);
19732         CHECK_ACCESS(_res_ptr);
19733         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
19734         FREE(untag_ptr(_res));
19735         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
19736 }
19737
19738 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
19739         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19740         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
19741         return tag_ptr(ret_conv, true);
19742 }
19743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19744         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
19745         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
19746         return ret_conv;
19747 }
19748
19749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19750         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
19751         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19752         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
19753         return tag_ptr(ret_conv, true);
19754 }
19755
19756 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
19757         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19758         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
19759         return tag_ptr(ret_conv, true);
19760 }
19761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19762         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
19763         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
19764         return ret_conv;
19765 }
19766
19767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19768         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
19769         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19770         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
19771         return tag_ptr(ret_conv, true);
19772 }
19773
19774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
19775         LDKRawInvoice a_conv;
19776         a_conv.inner = untag_ptr(a);
19777         a_conv.is_owned = ptr_is_owned(a);
19778         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19779         a_conv = RawInvoice_clone(&a_conv);
19780         LDKThirtyTwoBytes b_ref;
19781         CHECK((*env)->GetArrayLength(env, b) == 32);
19782         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19783         LDKInvoiceSignature c_conv;
19784         c_conv.inner = untag_ptr(c);
19785         c_conv.is_owned = ptr_is_owned(c);
19786         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19787         c_conv = InvoiceSignature_clone(&c_conv);
19788         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19789         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
19790         return tag_ptr(ret_conv, true);
19791 }
19792
19793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19794         if (!ptr_is_owned(_res)) return;
19795         void* _res_ptr = untag_ptr(_res);
19796         CHECK_ACCESS(_res_ptr);
19797         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
19798         FREE(untag_ptr(_res));
19799         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
19800 }
19801
19802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19803         LDKPayeePubKey o_conv;
19804         o_conv.inner = untag_ptr(o);
19805         o_conv.is_owned = ptr_is_owned(o);
19806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19807         o_conv = PayeePubKey_clone(&o_conv);
19808         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19809         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
19810         return tag_ptr(ret_conv, true);
19811 }
19812
19813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19814         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
19815         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19816         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
19817         return tag_ptr(ret_conv, true);
19818 }
19819
19820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19821         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
19822         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
19823         return ret_conv;
19824 }
19825
19826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19827         if (!ptr_is_owned(_res)) return;
19828         void* _res_ptr = untag_ptr(_res);
19829         CHECK_ACCESS(_res_ptr);
19830         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
19831         FREE(untag_ptr(_res));
19832         CResult_PayeePubKeyErrorZ_free(_res_conv);
19833 }
19834
19835 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
19836         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19837         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
19838         return tag_ptr(ret_conv, true);
19839 }
19840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19841         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
19842         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19843         return ret_conv;
19844 }
19845
19846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19847         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
19848         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19849         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19850         return tag_ptr(ret_conv, true);
19851 }
19852
19853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19854         LDKCVec_PrivateRouteZ _res_constr;
19855         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19856         if (_res_constr.datalen > 0)
19857                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19858         else
19859                 _res_constr.data = NULL;
19860         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19861         for (size_t o = 0; o < _res_constr.datalen; o++) {
19862                 int64_t _res_conv_14 = _res_vals[o];
19863                 LDKPrivateRoute _res_conv_14_conv;
19864                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19865                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19866                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19867                 _res_constr.data[o] = _res_conv_14_conv;
19868         }
19869         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19870         CVec_PrivateRouteZ_free(_res_constr);
19871 }
19872
19873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19874         LDKPositiveTimestamp o_conv;
19875         o_conv.inner = untag_ptr(o);
19876         o_conv.is_owned = ptr_is_owned(o);
19877         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19878         o_conv = PositiveTimestamp_clone(&o_conv);
19879         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19880         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19881         return tag_ptr(ret_conv, true);
19882 }
19883
19884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19885         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19886         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19887         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19888         return tag_ptr(ret_conv, true);
19889 }
19890
19891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19892         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
19893         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19894         return ret_conv;
19895 }
19896
19897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19898         if (!ptr_is_owned(_res)) return;
19899         void* _res_ptr = untag_ptr(_res);
19900         CHECK_ACCESS(_res_ptr);
19901         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19902         FREE(untag_ptr(_res));
19903         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19904 }
19905
19906 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19907         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19908         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19909         return tag_ptr(ret_conv, true);
19910 }
19911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19912         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
19913         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19914         return ret_conv;
19915 }
19916
19917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19918         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
19919         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19920         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19921         return tag_ptr(ret_conv, true);
19922 }
19923
19924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
19925         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19926         *ret_conv = CResult_NoneSemanticErrorZ_ok();
19927         return tag_ptr(ret_conv, true);
19928 }
19929
19930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19931         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19932         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19933         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19934         return tag_ptr(ret_conv, true);
19935 }
19936
19937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19938         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
19939         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19940         return ret_conv;
19941 }
19942
19943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19944         if (!ptr_is_owned(_res)) return;
19945         void* _res_ptr = untag_ptr(_res);
19946         CHECK_ACCESS(_res_ptr);
19947         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19948         FREE(untag_ptr(_res));
19949         CResult_NoneSemanticErrorZ_free(_res_conv);
19950 }
19951
19952 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19953         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19954         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19955         return tag_ptr(ret_conv, true);
19956 }
19957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19958         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
19959         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19960         return ret_conv;
19961 }
19962
19963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19964         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
19965         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19966         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19967         return tag_ptr(ret_conv, true);
19968 }
19969
19970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19971         LDKInvoice o_conv;
19972         o_conv.inner = untag_ptr(o);
19973         o_conv.is_owned = ptr_is_owned(o);
19974         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19975         o_conv = Invoice_clone(&o_conv);
19976         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19977         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19978         return tag_ptr(ret_conv, true);
19979 }
19980
19981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19982         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19983         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19984         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19985         return tag_ptr(ret_conv, true);
19986 }
19987
19988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19989         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
19990         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19991         return ret_conv;
19992 }
19993
19994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19995         if (!ptr_is_owned(_res)) return;
19996         void* _res_ptr = untag_ptr(_res);
19997         CHECK_ACCESS(_res_ptr);
19998         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19999         FREE(untag_ptr(_res));
20000         CResult_InvoiceSemanticErrorZ_free(_res_conv);
20001 }
20002
20003 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
20004         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20005         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
20006         return tag_ptr(ret_conv, true);
20007 }
20008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20009         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
20010         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
20011         return ret_conv;
20012 }
20013
20014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20015         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
20016         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20017         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
20018         return tag_ptr(ret_conv, true);
20019 }
20020
20021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20022         LDKDescription o_conv;
20023         o_conv.inner = untag_ptr(o);
20024         o_conv.is_owned = ptr_is_owned(o);
20025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20026         o_conv = Description_clone(&o_conv);
20027         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20028         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
20029         return tag_ptr(ret_conv, true);
20030 }
20031
20032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20033         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20034         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20035         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
20036         return tag_ptr(ret_conv, true);
20037 }
20038
20039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20040         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
20041         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
20042         return ret_conv;
20043 }
20044
20045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20046         if (!ptr_is_owned(_res)) return;
20047         void* _res_ptr = untag_ptr(_res);
20048         CHECK_ACCESS(_res_ptr);
20049         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
20050         FREE(untag_ptr(_res));
20051         CResult_DescriptionCreationErrorZ_free(_res_conv);
20052 }
20053
20054 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
20055         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20056         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
20057         return tag_ptr(ret_conv, true);
20058 }
20059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20060         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
20061         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
20062         return ret_conv;
20063 }
20064
20065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20066         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
20067         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20068         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
20069         return tag_ptr(ret_conv, true);
20070 }
20071
20072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20073         LDKPrivateRoute o_conv;
20074         o_conv.inner = untag_ptr(o);
20075         o_conv.is_owned = ptr_is_owned(o);
20076         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20077         o_conv = PrivateRoute_clone(&o_conv);
20078         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20079         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
20080         return tag_ptr(ret_conv, true);
20081 }
20082
20083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20084         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20085         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20086         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
20087         return tag_ptr(ret_conv, true);
20088 }
20089
20090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20091         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
20092         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
20093         return ret_conv;
20094 }
20095
20096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20097         if (!ptr_is_owned(_res)) return;
20098         void* _res_ptr = untag_ptr(_res);
20099         CHECK_ACCESS(_res_ptr);
20100         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
20101         FREE(untag_ptr(_res));
20102         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
20103 }
20104
20105 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
20106         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20107         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
20108         return tag_ptr(ret_conv, true);
20109 }
20110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20111         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
20112         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
20113         return ret_conv;
20114 }
20115
20116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20117         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
20118         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20119         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
20120         return tag_ptr(ret_conv, true);
20121 }
20122
20123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
20124         LDKStr o_conv = java_to_owned_str(env, o);
20125         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20126         *ret_conv = CResult_StringErrorZ_ok(o_conv);
20127         return tag_ptr(ret_conv, true);
20128 }
20129
20130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20131         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
20132         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20133         *ret_conv = CResult_StringErrorZ_err(e_conv);
20134         return tag_ptr(ret_conv, true);
20135 }
20136
20137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20138         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
20139         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
20140         return ret_conv;
20141 }
20142
20143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20144         if (!ptr_is_owned(_res)) return;
20145         void* _res_ptr = untag_ptr(_res);
20146         CHECK_ACCESS(_res_ptr);
20147         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
20148         FREE(untag_ptr(_res));
20149         CResult_StringErrorZ_free(_res_conv);
20150 }
20151
20152 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
20153         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20154         *ret_conv = CResult_StringErrorZ_clone(arg);
20155         return tag_ptr(ret_conv, true);
20156 }
20157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20158         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
20159         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
20160         return ret_conv;
20161 }
20162
20163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20164         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
20165         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20166         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
20167         return tag_ptr(ret_conv, true);
20168 }
20169
20170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20171         LDKChannelMonitorUpdate o_conv;
20172         o_conv.inner = untag_ptr(o);
20173         o_conv.is_owned = ptr_is_owned(o);
20174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20175         o_conv = ChannelMonitorUpdate_clone(&o_conv);
20176         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20177         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
20178         return tag_ptr(ret_conv, true);
20179 }
20180
20181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20182         LDKDecodeError e_conv;
20183         e_conv.inner = untag_ptr(e);
20184         e_conv.is_owned = ptr_is_owned(e);
20185         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20186         e_conv = DecodeError_clone(&e_conv);
20187         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20188         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
20189         return tag_ptr(ret_conv, true);
20190 }
20191
20192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20193         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
20194         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
20195         return ret_conv;
20196 }
20197
20198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20199         if (!ptr_is_owned(_res)) return;
20200         void* _res_ptr = untag_ptr(_res);
20201         CHECK_ACCESS(_res_ptr);
20202         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
20203         FREE(untag_ptr(_res));
20204         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
20205 }
20206
20207 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
20208         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20209         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
20210         return tag_ptr(ret_conv, true);
20211 }
20212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20213         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
20214         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
20215         return ret_conv;
20216 }
20217
20218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20219         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
20220         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20221         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
20222         return tag_ptr(ret_conv, true);
20223 }
20224
20225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20226         void* o_ptr = untag_ptr(o);
20227         CHECK_ACCESS(o_ptr);
20228         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
20229         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
20230         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20231         *ret_copy = COption_MonitorEventZ_some(o_conv);
20232         int64_t ret_ref = tag_ptr(ret_copy, true);
20233         return ret_ref;
20234 }
20235
20236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
20237         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20238         *ret_copy = COption_MonitorEventZ_none();
20239         int64_t ret_ref = tag_ptr(ret_copy, true);
20240         return ret_ref;
20241 }
20242
20243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20244         if (!ptr_is_owned(_res)) return;
20245         void* _res_ptr = untag_ptr(_res);
20246         CHECK_ACCESS(_res_ptr);
20247         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
20248         FREE(untag_ptr(_res));
20249         COption_MonitorEventZ_free(_res_conv);
20250 }
20251
20252 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
20253         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20254         *ret_copy = COption_MonitorEventZ_clone(arg);
20255         int64_t ret_ref = tag_ptr(ret_copy, true);
20256         return ret_ref;
20257 }
20258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20259         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
20260         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
20261         return ret_conv;
20262 }
20263
20264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20265         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
20266         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20267         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
20268         int64_t ret_ref = tag_ptr(ret_copy, true);
20269         return ret_ref;
20270 }
20271
20272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20273         void* o_ptr = untag_ptr(o);
20274         CHECK_ACCESS(o_ptr);
20275         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
20276         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
20277         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20278         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
20279         return tag_ptr(ret_conv, true);
20280 }
20281
20282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20283         LDKDecodeError e_conv;
20284         e_conv.inner = untag_ptr(e);
20285         e_conv.is_owned = ptr_is_owned(e);
20286         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20287         e_conv = DecodeError_clone(&e_conv);
20288         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20289         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
20290         return tag_ptr(ret_conv, true);
20291 }
20292
20293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20294         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
20295         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
20296         return ret_conv;
20297 }
20298
20299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20300         if (!ptr_is_owned(_res)) return;
20301         void* _res_ptr = untag_ptr(_res);
20302         CHECK_ACCESS(_res_ptr);
20303         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
20304         FREE(untag_ptr(_res));
20305         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
20306 }
20307
20308 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
20309         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20310         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
20311         return tag_ptr(ret_conv, true);
20312 }
20313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20314         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
20315         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
20316         return ret_conv;
20317 }
20318
20319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20320         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
20321         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20322         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
20323         return tag_ptr(ret_conv, true);
20324 }
20325
20326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20327         LDKHTLCUpdate o_conv;
20328         o_conv.inner = untag_ptr(o);
20329         o_conv.is_owned = ptr_is_owned(o);
20330         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20331         o_conv = HTLCUpdate_clone(&o_conv);
20332         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20333         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
20334         return tag_ptr(ret_conv, true);
20335 }
20336
20337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20338         LDKDecodeError e_conv;
20339         e_conv.inner = untag_ptr(e);
20340         e_conv.is_owned = ptr_is_owned(e);
20341         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20342         e_conv = DecodeError_clone(&e_conv);
20343         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20344         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
20345         return tag_ptr(ret_conv, true);
20346 }
20347
20348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20349         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
20350         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
20351         return ret_conv;
20352 }
20353
20354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20355         if (!ptr_is_owned(_res)) return;
20356         void* _res_ptr = untag_ptr(_res);
20357         CHECK_ACCESS(_res_ptr);
20358         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
20359         FREE(untag_ptr(_res));
20360         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
20361 }
20362
20363 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
20364         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20365         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
20366         return tag_ptr(ret_conv, true);
20367 }
20368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20369         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
20370         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
20371         return ret_conv;
20372 }
20373
20374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20375         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
20376         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20377         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
20378         return tag_ptr(ret_conv, true);
20379 }
20380
20381 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
20382         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20383         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
20384         return tag_ptr(ret_conv, true);
20385 }
20386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20387         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
20388         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
20389         return ret_conv;
20390 }
20391
20392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20393         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
20394         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20395         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
20396         return tag_ptr(ret_conv, true);
20397 }
20398
20399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
20400         LDKOutPoint a_conv;
20401         a_conv.inner = untag_ptr(a);
20402         a_conv.is_owned = ptr_is_owned(a);
20403         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20404         a_conv = OutPoint_clone(&a_conv);
20405         LDKCVec_u8Z b_ref;
20406         b_ref.datalen = (*env)->GetArrayLength(env, b);
20407         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20408         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20409         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20410         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
20411         return tag_ptr(ret_conv, true);
20412 }
20413
20414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20415         if (!ptr_is_owned(_res)) return;
20416         void* _res_ptr = untag_ptr(_res);
20417         CHECK_ACCESS(_res_ptr);
20418         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
20419         FREE(untag_ptr(_res));
20420         C2Tuple_OutPointScriptZ_free(_res_conv);
20421 }
20422
20423 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
20424         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20425         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
20426         return tag_ptr(ret_conv, true);
20427 }
20428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20429         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
20430         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
20431         return ret_conv;
20432 }
20433
20434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20435         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
20436         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20437         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
20438         return tag_ptr(ret_conv, true);
20439 }
20440
20441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
20442         LDKCVec_u8Z b_ref;
20443         b_ref.datalen = (*env)->GetArrayLength(env, b);
20444         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20445         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20446         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20447         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
20448         return tag_ptr(ret_conv, true);
20449 }
20450
20451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20452         if (!ptr_is_owned(_res)) return;
20453         void* _res_ptr = untag_ptr(_res);
20454         CHECK_ACCESS(_res_ptr);
20455         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
20456         FREE(untag_ptr(_res));
20457         C2Tuple_u32ScriptZ_free(_res_conv);
20458 }
20459
20460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20461         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
20462         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20463         if (_res_constr.datalen > 0)
20464                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
20465         else
20466                 _res_constr.data = NULL;
20467         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20468         for (size_t v = 0; v < _res_constr.datalen; v++) {
20469                 int64_t _res_conv_21 = _res_vals[v];
20470                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
20471                 CHECK_ACCESS(_res_conv_21_ptr);
20472                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
20473                 FREE(untag_ptr(_res_conv_21));
20474                 _res_constr.data[v] = _res_conv_21_conv;
20475         }
20476         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20477         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
20478 }
20479
20480 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
20481         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20482         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
20483         return tag_ptr(ret_conv, true);
20484 }
20485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20486         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
20487         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
20488         return ret_conv;
20489 }
20490
20491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20492         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
20493         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20494         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
20495         return tag_ptr(ret_conv, true);
20496 }
20497
20498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
20499         LDKThirtyTwoBytes a_ref;
20500         CHECK((*env)->GetArrayLength(env, a) == 32);
20501         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20502         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
20503         b_constr.datalen = (*env)->GetArrayLength(env, b);
20504         if (b_constr.datalen > 0)
20505                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
20506         else
20507                 b_constr.data = NULL;
20508         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
20509         for (size_t v = 0; v < b_constr.datalen; v++) {
20510                 int64_t b_conv_21 = b_vals[v];
20511                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
20512                 CHECK_ACCESS(b_conv_21_ptr);
20513                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
20514                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
20515                 b_constr.data[v] = b_conv_21_conv;
20516         }
20517         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
20518         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20519         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
20520         return tag_ptr(ret_conv, true);
20521 }
20522
20523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20524         if (!ptr_is_owned(_res)) return;
20525         void* _res_ptr = untag_ptr(_res);
20526         CHECK_ACCESS(_res_ptr);
20527         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
20528         FREE(untag_ptr(_res));
20529         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
20530 }
20531
20532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20533         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
20534         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20535         if (_res_constr.datalen > 0)
20536                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
20537         else
20538                 _res_constr.data = NULL;
20539         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20540         for (size_t o = 0; o < _res_constr.datalen; o++) {
20541                 int64_t _res_conv_40 = _res_vals[o];
20542                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
20543                 CHECK_ACCESS(_res_conv_40_ptr);
20544                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
20545                 FREE(untag_ptr(_res_conv_40));
20546                 _res_constr.data[o] = _res_conv_40_conv;
20547         }
20548         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20549         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
20550 }
20551
20552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20553         LDKCVec_EventZ _res_constr;
20554         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20555         if (_res_constr.datalen > 0)
20556                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
20557         else
20558                 _res_constr.data = NULL;
20559         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20560         for (size_t h = 0; h < _res_constr.datalen; h++) {
20561                 int64_t _res_conv_7 = _res_vals[h];
20562                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
20563                 CHECK_ACCESS(_res_conv_7_ptr);
20564                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
20565                 FREE(untag_ptr(_res_conv_7));
20566                 _res_constr.data[h] = _res_conv_7_conv;
20567         }
20568         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20569         CVec_EventZ_free(_res_constr);
20570 }
20571
20572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20573         LDKCVec_TransactionZ _res_constr;
20574         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20575         if (_res_constr.datalen > 0)
20576                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
20577         else
20578                 _res_constr.data = NULL;
20579         for (size_t i = 0; i < _res_constr.datalen; i++) {
20580                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20581                 LDKTransaction _res_conv_8_ref;
20582                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
20583                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
20584                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
20585                 _res_conv_8_ref.data_is_owned = true;
20586                 _res_constr.data[i] = _res_conv_8_ref;
20587         }
20588         CVec_TransactionZ_free(_res_constr);
20589 }
20590
20591 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
20592         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20593         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
20594         return tag_ptr(ret_conv, true);
20595 }
20596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20597         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
20598         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
20599         return ret_conv;
20600 }
20601
20602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20603         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
20604         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20605         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
20606         return tag_ptr(ret_conv, true);
20607 }
20608
20609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
20610         void* b_ptr = untag_ptr(b);
20611         CHECK_ACCESS(b_ptr);
20612         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
20613         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
20614         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20615         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
20616         return tag_ptr(ret_conv, true);
20617 }
20618
20619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20620         if (!ptr_is_owned(_res)) return;
20621         void* _res_ptr = untag_ptr(_res);
20622         CHECK_ACCESS(_res_ptr);
20623         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
20624         FREE(untag_ptr(_res));
20625         C2Tuple_u32TxOutZ_free(_res_conv);
20626 }
20627
20628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20629         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
20630         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20631         if (_res_constr.datalen > 0)
20632                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
20633         else
20634                 _res_constr.data = NULL;
20635         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20636         for (size_t u = 0; u < _res_constr.datalen; u++) {
20637                 int64_t _res_conv_20 = _res_vals[u];
20638                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
20639                 CHECK_ACCESS(_res_conv_20_ptr);
20640                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
20641                 FREE(untag_ptr(_res_conv_20));
20642                 _res_constr.data[u] = _res_conv_20_conv;
20643         }
20644         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20645         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
20646 }
20647
20648 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
20649         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20650         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
20651         return tag_ptr(ret_conv, true);
20652 }
20653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20654         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
20655         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
20656         return ret_conv;
20657 }
20658
20659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20660         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
20661         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20662         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
20663         return tag_ptr(ret_conv, true);
20664 }
20665
20666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
20667         LDKThirtyTwoBytes a_ref;
20668         CHECK((*env)->GetArrayLength(env, a) == 32);
20669         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20670         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
20671         b_constr.datalen = (*env)->GetArrayLength(env, b);
20672         if (b_constr.datalen > 0)
20673                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
20674         else
20675                 b_constr.data = NULL;
20676         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
20677         for (size_t u = 0; u < b_constr.datalen; u++) {
20678                 int64_t b_conv_20 = b_vals[u];
20679                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
20680                 CHECK_ACCESS(b_conv_20_ptr);
20681                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
20682                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
20683                 b_constr.data[u] = b_conv_20_conv;
20684         }
20685         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
20686         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20687         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
20688         return tag_ptr(ret_conv, true);
20689 }
20690
20691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20692         if (!ptr_is_owned(_res)) return;
20693         void* _res_ptr = untag_ptr(_res);
20694         CHECK_ACCESS(_res_ptr);
20695         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
20696         FREE(untag_ptr(_res));
20697         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
20698 }
20699
20700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20701         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
20702         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20703         if (_res_constr.datalen > 0)
20704                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
20705         else
20706                 _res_constr.data = NULL;
20707         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20708         for (size_t n = 0; n < _res_constr.datalen; n++) {
20709                 int64_t _res_conv_39 = _res_vals[n];
20710                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
20711                 CHECK_ACCESS(_res_conv_39_ptr);
20712                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
20713                 FREE(untag_ptr(_res_conv_39));
20714                 _res_constr.data[n] = _res_conv_39_conv;
20715         }
20716         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20717         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
20718 }
20719
20720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20721         LDKCVec_BalanceZ _res_constr;
20722         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20723         if (_res_constr.datalen > 0)
20724                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
20725         else
20726                 _res_constr.data = NULL;
20727         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20728         for (size_t j = 0; j < _res_constr.datalen; j++) {
20729                 int64_t _res_conv_9 = _res_vals[j];
20730                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
20731                 CHECK_ACCESS(_res_conv_9_ptr);
20732                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
20733                 FREE(untag_ptr(_res_conv_9));
20734                 _res_constr.data[j] = _res_conv_9_conv;
20735         }
20736         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20737         CVec_BalanceZ_free(_res_constr);
20738 }
20739
20740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20741         void* o_ptr = untag_ptr(o);
20742         CHECK_ACCESS(o_ptr);
20743         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
20744         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
20745         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20746         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
20747         return tag_ptr(ret_conv, true);
20748 }
20749
20750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20751         LDKDecodeError e_conv;
20752         e_conv.inner = untag_ptr(e);
20753         e_conv.is_owned = ptr_is_owned(e);
20754         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20755         e_conv = DecodeError_clone(&e_conv);
20756         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20757         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
20758         return tag_ptr(ret_conv, true);
20759 }
20760
20761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20762         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
20763         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
20764         return ret_conv;
20765 }
20766
20767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20768         if (!ptr_is_owned(_res)) return;
20769         void* _res_ptr = untag_ptr(_res);
20770         CHECK_ACCESS(_res_ptr);
20771         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
20772         FREE(untag_ptr(_res));
20773         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
20774 }
20775
20776 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
20777         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20778         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
20779         return tag_ptr(ret_conv, true);
20780 }
20781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20782         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
20783         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
20784         return ret_conv;
20785 }
20786
20787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20788         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
20789         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20790         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
20791         return tag_ptr(ret_conv, true);
20792 }
20793
20794 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
20795         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20796         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
20797         return tag_ptr(ret_conv, true);
20798 }
20799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20800         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
20801         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
20802         return ret_conv;
20803 }
20804
20805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20806         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
20807         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20808         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
20809         return tag_ptr(ret_conv, true);
20810 }
20811
20812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20813         LDKPublicKey a_ref;
20814         CHECK((*env)->GetArrayLength(env, a) == 33);
20815         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
20816         void* b_ptr = untag_ptr(b);
20817         CHECK_ACCESS(b_ptr);
20818         LDKType b_conv = *(LDKType*)(b_ptr);
20819         if (b_conv.free == LDKType_JCalls_free) {
20820                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20821                 LDKType_JCalls_cloned(&b_conv);
20822         }
20823         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20824         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
20825         return tag_ptr(ret_conv, true);
20826 }
20827
20828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20829         if (!ptr_is_owned(_res)) return;
20830         void* _res_ptr = untag_ptr(_res);
20831         CHECK_ACCESS(_res_ptr);
20832         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
20833         FREE(untag_ptr(_res));
20834         C2Tuple_PublicKeyTypeZ_free(_res_conv);
20835 }
20836
20837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20838         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
20839         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20840         if (_res_constr.datalen > 0)
20841                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
20842         else
20843                 _res_constr.data = NULL;
20844         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20845         for (size_t z = 0; z < _res_constr.datalen; z++) {
20846                 int64_t _res_conv_25 = _res_vals[z];
20847                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
20848                 CHECK_ACCESS(_res_conv_25_ptr);
20849                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
20850                 FREE(untag_ptr(_res_conv_25));
20851                 _res_constr.data[z] = _res_conv_25_conv;
20852         }
20853         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20854         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
20855 }
20856
20857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20858         void* o_ptr = untag_ptr(o);
20859         CHECK_ACCESS(o_ptr);
20860         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20861         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
20862         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20863         *ret_copy = COption_NetAddressZ_some(o_conv);
20864         int64_t ret_ref = tag_ptr(ret_copy, true);
20865         return ret_ref;
20866 }
20867
20868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
20869         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20870         *ret_copy = COption_NetAddressZ_none();
20871         int64_t ret_ref = tag_ptr(ret_copy, true);
20872         return ret_ref;
20873 }
20874
20875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20876         if (!ptr_is_owned(_res)) return;
20877         void* _res_ptr = untag_ptr(_res);
20878         CHECK_ACCESS(_res_ptr);
20879         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
20880         FREE(untag_ptr(_res));
20881         COption_NetAddressZ_free(_res_conv);
20882 }
20883
20884 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
20885         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20886         *ret_copy = COption_NetAddressZ_clone(arg);
20887         int64_t ret_ref = tag_ptr(ret_copy, true);
20888         return ret_ref;
20889 }
20890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20891         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
20892         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
20893         return ret_conv;
20894 }
20895
20896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20897         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
20898         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20899         *ret_copy = COption_NetAddressZ_clone(orig_conv);
20900         int64_t ret_ref = tag_ptr(ret_copy, true);
20901         return ret_ref;
20902 }
20903
20904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20905         LDKCVec_u8Z o_ref;
20906         o_ref.datalen = (*env)->GetArrayLength(env, o);
20907         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20908         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20909         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20910         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
20911         return tag_ptr(ret_conv, true);
20912 }
20913
20914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20915         LDKPeerHandleError e_conv;
20916         e_conv.inner = untag_ptr(e);
20917         e_conv.is_owned = ptr_is_owned(e);
20918         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20919         e_conv = PeerHandleError_clone(&e_conv);
20920         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20921         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
20922         return tag_ptr(ret_conv, true);
20923 }
20924
20925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20926         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
20927         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
20928         return ret_conv;
20929 }
20930
20931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20932         if (!ptr_is_owned(_res)) return;
20933         void* _res_ptr = untag_ptr(_res);
20934         CHECK_ACCESS(_res_ptr);
20935         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
20936         FREE(untag_ptr(_res));
20937         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
20938 }
20939
20940 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
20941         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20942         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
20943         return tag_ptr(ret_conv, true);
20944 }
20945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20946         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
20947         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
20948         return ret_conv;
20949 }
20950
20951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20952         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
20953         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20954         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
20955         return tag_ptr(ret_conv, true);
20956 }
20957
20958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
20959         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20960         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
20961         return tag_ptr(ret_conv, true);
20962 }
20963
20964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20965         LDKPeerHandleError e_conv;
20966         e_conv.inner = untag_ptr(e);
20967         e_conv.is_owned = ptr_is_owned(e);
20968         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20969         e_conv = PeerHandleError_clone(&e_conv);
20970         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20971         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
20972         return tag_ptr(ret_conv, true);
20973 }
20974
20975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20976         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
20977         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
20978         return ret_conv;
20979 }
20980
20981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20982         if (!ptr_is_owned(_res)) return;
20983         void* _res_ptr = untag_ptr(_res);
20984         CHECK_ACCESS(_res_ptr);
20985         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
20986         FREE(untag_ptr(_res));
20987         CResult_NonePeerHandleErrorZ_free(_res_conv);
20988 }
20989
20990 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
20991         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20992         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
20993         return tag_ptr(ret_conv, true);
20994 }
20995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20996         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
20997         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
20998         return ret_conv;
20999 }
21000
21001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21002         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
21003         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21004         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
21005         return tag_ptr(ret_conv, true);
21006 }
21007
21008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
21009         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21010         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
21011         return tag_ptr(ret_conv, true);
21012 }
21013
21014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21015         LDKPeerHandleError e_conv;
21016         e_conv.inner = untag_ptr(e);
21017         e_conv.is_owned = ptr_is_owned(e);
21018         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21019         e_conv = PeerHandleError_clone(&e_conv);
21020         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21021         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
21022         return tag_ptr(ret_conv, true);
21023 }
21024
21025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21026         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
21027         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
21028         return ret_conv;
21029 }
21030
21031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21032         if (!ptr_is_owned(_res)) return;
21033         void* _res_ptr = untag_ptr(_res);
21034         CHECK_ACCESS(_res_ptr);
21035         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
21036         FREE(untag_ptr(_res));
21037         CResult_boolPeerHandleErrorZ_free(_res_conv);
21038 }
21039
21040 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
21041         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21042         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
21043         return tag_ptr(ret_conv, true);
21044 }
21045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21046         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
21047         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
21048         return ret_conv;
21049 }
21050
21051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21052         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
21053         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21054         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
21055         return tag_ptr(ret_conv, true);
21056 }
21057
21058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
21059         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
21060         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
21061         return tag_ptr(ret_conv, true);
21062 }
21063
21064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21065         void* e_ptr = untag_ptr(e);
21066         CHECK_ACCESS(e_ptr);
21067         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
21068         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
21069         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
21070         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
21071         return tag_ptr(ret_conv, true);
21072 }
21073
21074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21075         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
21076         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
21077         return ret_conv;
21078 }
21079
21080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21081         if (!ptr_is_owned(_res)) return;
21082         void* _res_ptr = untag_ptr(_res);
21083         CHECK_ACCESS(_res_ptr);
21084         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
21085         FREE(untag_ptr(_res));
21086         CResult_u32GraphSyncErrorZ_free(_res_conv);
21087 }
21088
21089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21090         void* o_ptr = untag_ptr(o);
21091         CHECK_ACCESS(o_ptr);
21092         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21093         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
21094         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21095         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
21096         return tag_ptr(ret_conv, true);
21097 }
21098
21099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21100         LDKDecodeError e_conv;
21101         e_conv.inner = untag_ptr(e);
21102         e_conv.is_owned = ptr_is_owned(e);
21103         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21104         e_conv = DecodeError_clone(&e_conv);
21105         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21106         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
21107         return tag_ptr(ret_conv, true);
21108 }
21109
21110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21111         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
21112         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
21113         return ret_conv;
21114 }
21115
21116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21117         if (!ptr_is_owned(_res)) return;
21118         void* _res_ptr = untag_ptr(_res);
21119         CHECK_ACCESS(_res_ptr);
21120         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
21121         FREE(untag_ptr(_res));
21122         CResult_NetAddressDecodeErrorZ_free(_res_conv);
21123 }
21124
21125 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
21126         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21127         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
21128         return tag_ptr(ret_conv, true);
21129 }
21130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21131         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
21132         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
21133         return ret_conv;
21134 }
21135
21136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21137         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
21138         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21139         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
21140         return tag_ptr(ret_conv, true);
21141 }
21142
21143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21144         LDKCVec_UpdateAddHTLCZ _res_constr;
21145         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21146         if (_res_constr.datalen > 0)
21147                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21148         else
21149                 _res_constr.data = NULL;
21150         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21151         for (size_t p = 0; p < _res_constr.datalen; p++) {
21152                 int64_t _res_conv_15 = _res_vals[p];
21153                 LDKUpdateAddHTLC _res_conv_15_conv;
21154                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
21155                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
21156                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
21157                 _res_constr.data[p] = _res_conv_15_conv;
21158         }
21159         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21160         CVec_UpdateAddHTLCZ_free(_res_constr);
21161 }
21162
21163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21164         LDKCVec_UpdateFulfillHTLCZ _res_constr;
21165         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21166         if (_res_constr.datalen > 0)
21167                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21168         else
21169                 _res_constr.data = NULL;
21170         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21171         for (size_t t = 0; t < _res_constr.datalen; t++) {
21172                 int64_t _res_conv_19 = _res_vals[t];
21173                 LDKUpdateFulfillHTLC _res_conv_19_conv;
21174                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
21175                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
21176                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
21177                 _res_constr.data[t] = _res_conv_19_conv;
21178         }
21179         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21180         CVec_UpdateFulfillHTLCZ_free(_res_constr);
21181 }
21182
21183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21184         LDKCVec_UpdateFailHTLCZ _res_constr;
21185         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21186         if (_res_constr.datalen > 0)
21187                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21188         else
21189                 _res_constr.data = NULL;
21190         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21191         for (size_t q = 0; q < _res_constr.datalen; q++) {
21192                 int64_t _res_conv_16 = _res_vals[q];
21193                 LDKUpdateFailHTLC _res_conv_16_conv;
21194                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21195                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21196                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21197                 _res_constr.data[q] = _res_conv_16_conv;
21198         }
21199         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21200         CVec_UpdateFailHTLCZ_free(_res_constr);
21201 }
21202
21203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21204         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
21205         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21206         if (_res_constr.datalen > 0)
21207                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21208         else
21209                 _res_constr.data = NULL;
21210         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21211         for (size_t z = 0; z < _res_constr.datalen; z++) {
21212                 int64_t _res_conv_25 = _res_vals[z];
21213                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
21214                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
21215                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
21216                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
21217                 _res_constr.data[z] = _res_conv_25_conv;
21218         }
21219         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21220         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
21221 }
21222
21223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21224         LDKAcceptChannel o_conv;
21225         o_conv.inner = untag_ptr(o);
21226         o_conv.is_owned = ptr_is_owned(o);
21227         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21228         o_conv = AcceptChannel_clone(&o_conv);
21229         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21230         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
21231         return tag_ptr(ret_conv, true);
21232 }
21233
21234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21235         LDKDecodeError e_conv;
21236         e_conv.inner = untag_ptr(e);
21237         e_conv.is_owned = ptr_is_owned(e);
21238         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21239         e_conv = DecodeError_clone(&e_conv);
21240         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21241         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
21242         return tag_ptr(ret_conv, true);
21243 }
21244
21245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21246         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
21247         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
21248         return ret_conv;
21249 }
21250
21251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21252         if (!ptr_is_owned(_res)) return;
21253         void* _res_ptr = untag_ptr(_res);
21254         CHECK_ACCESS(_res_ptr);
21255         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
21256         FREE(untag_ptr(_res));
21257         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
21258 }
21259
21260 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
21261         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21262         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
21263         return tag_ptr(ret_conv, true);
21264 }
21265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21266         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
21267         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
21268         return ret_conv;
21269 }
21270
21271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21272         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
21273         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21274         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
21275         return tag_ptr(ret_conv, true);
21276 }
21277
21278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21279         LDKAnnouncementSignatures o_conv;
21280         o_conv.inner = untag_ptr(o);
21281         o_conv.is_owned = ptr_is_owned(o);
21282         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21283         o_conv = AnnouncementSignatures_clone(&o_conv);
21284         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21285         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
21286         return tag_ptr(ret_conv, true);
21287 }
21288
21289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21290         LDKDecodeError e_conv;
21291         e_conv.inner = untag_ptr(e);
21292         e_conv.is_owned = ptr_is_owned(e);
21293         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21294         e_conv = DecodeError_clone(&e_conv);
21295         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21296         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
21297         return tag_ptr(ret_conv, true);
21298 }
21299
21300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21301         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
21302         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
21303         return ret_conv;
21304 }
21305
21306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21307         if (!ptr_is_owned(_res)) return;
21308         void* _res_ptr = untag_ptr(_res);
21309         CHECK_ACCESS(_res_ptr);
21310         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
21311         FREE(untag_ptr(_res));
21312         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
21313 }
21314
21315 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
21316         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21317         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
21318         return tag_ptr(ret_conv, true);
21319 }
21320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21321         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
21322         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
21323         return ret_conv;
21324 }
21325
21326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21327         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
21328         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21329         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
21330         return tag_ptr(ret_conv, true);
21331 }
21332
21333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21334         LDKChannelReestablish o_conv;
21335         o_conv.inner = untag_ptr(o);
21336         o_conv.is_owned = ptr_is_owned(o);
21337         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21338         o_conv = ChannelReestablish_clone(&o_conv);
21339         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21340         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
21341         return tag_ptr(ret_conv, true);
21342 }
21343
21344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21345         LDKDecodeError e_conv;
21346         e_conv.inner = untag_ptr(e);
21347         e_conv.is_owned = ptr_is_owned(e);
21348         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21349         e_conv = DecodeError_clone(&e_conv);
21350         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21351         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
21352         return tag_ptr(ret_conv, true);
21353 }
21354
21355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21356         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
21357         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
21358         return ret_conv;
21359 }
21360
21361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21362         if (!ptr_is_owned(_res)) return;
21363         void* _res_ptr = untag_ptr(_res);
21364         CHECK_ACCESS(_res_ptr);
21365         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
21366         FREE(untag_ptr(_res));
21367         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
21368 }
21369
21370 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
21371         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21372         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
21373         return tag_ptr(ret_conv, true);
21374 }
21375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21376         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
21377         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
21378         return ret_conv;
21379 }
21380
21381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21382         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
21383         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21384         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
21385         return tag_ptr(ret_conv, true);
21386 }
21387
21388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21389         LDKClosingSigned o_conv;
21390         o_conv.inner = untag_ptr(o);
21391         o_conv.is_owned = ptr_is_owned(o);
21392         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21393         o_conv = ClosingSigned_clone(&o_conv);
21394         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21395         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
21396         return tag_ptr(ret_conv, true);
21397 }
21398
21399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21400         LDKDecodeError e_conv;
21401         e_conv.inner = untag_ptr(e);
21402         e_conv.is_owned = ptr_is_owned(e);
21403         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21404         e_conv = DecodeError_clone(&e_conv);
21405         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21406         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
21407         return tag_ptr(ret_conv, true);
21408 }
21409
21410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21411         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
21412         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
21413         return ret_conv;
21414 }
21415
21416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21417         if (!ptr_is_owned(_res)) return;
21418         void* _res_ptr = untag_ptr(_res);
21419         CHECK_ACCESS(_res_ptr);
21420         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
21421         FREE(untag_ptr(_res));
21422         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
21423 }
21424
21425 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
21426         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21427         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
21428         return tag_ptr(ret_conv, true);
21429 }
21430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21431         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
21432         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
21433         return ret_conv;
21434 }
21435
21436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21437         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
21438         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21439         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
21440         return tag_ptr(ret_conv, true);
21441 }
21442
21443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21444         LDKClosingSignedFeeRange o_conv;
21445         o_conv.inner = untag_ptr(o);
21446         o_conv.is_owned = ptr_is_owned(o);
21447         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21448         o_conv = ClosingSignedFeeRange_clone(&o_conv);
21449         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21450         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
21451         return tag_ptr(ret_conv, true);
21452 }
21453
21454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21455         LDKDecodeError e_conv;
21456         e_conv.inner = untag_ptr(e);
21457         e_conv.is_owned = ptr_is_owned(e);
21458         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21459         e_conv = DecodeError_clone(&e_conv);
21460         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21461         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
21462         return tag_ptr(ret_conv, true);
21463 }
21464
21465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21466         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
21467         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
21468         return ret_conv;
21469 }
21470
21471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21472         if (!ptr_is_owned(_res)) return;
21473         void* _res_ptr = untag_ptr(_res);
21474         CHECK_ACCESS(_res_ptr);
21475         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
21476         FREE(untag_ptr(_res));
21477         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
21478 }
21479
21480 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
21481         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21482         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
21483         return tag_ptr(ret_conv, true);
21484 }
21485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21486         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
21487         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
21488         return ret_conv;
21489 }
21490
21491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21492         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
21493         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21494         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
21495         return tag_ptr(ret_conv, true);
21496 }
21497
21498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21499         LDKCommitmentSigned o_conv;
21500         o_conv.inner = untag_ptr(o);
21501         o_conv.is_owned = ptr_is_owned(o);
21502         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21503         o_conv = CommitmentSigned_clone(&o_conv);
21504         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21505         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
21506         return tag_ptr(ret_conv, true);
21507 }
21508
21509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21510         LDKDecodeError e_conv;
21511         e_conv.inner = untag_ptr(e);
21512         e_conv.is_owned = ptr_is_owned(e);
21513         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21514         e_conv = DecodeError_clone(&e_conv);
21515         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21516         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
21517         return tag_ptr(ret_conv, true);
21518 }
21519
21520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21521         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
21522         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
21523         return ret_conv;
21524 }
21525
21526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21527         if (!ptr_is_owned(_res)) return;
21528         void* _res_ptr = untag_ptr(_res);
21529         CHECK_ACCESS(_res_ptr);
21530         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
21531         FREE(untag_ptr(_res));
21532         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
21533 }
21534
21535 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
21536         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21537         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
21538         return tag_ptr(ret_conv, true);
21539 }
21540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21541         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
21542         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
21543         return ret_conv;
21544 }
21545
21546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21547         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
21548         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21549         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
21550         return tag_ptr(ret_conv, true);
21551 }
21552
21553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21554         LDKFundingCreated o_conv;
21555         o_conv.inner = untag_ptr(o);
21556         o_conv.is_owned = ptr_is_owned(o);
21557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21558         o_conv = FundingCreated_clone(&o_conv);
21559         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21560         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
21561         return tag_ptr(ret_conv, true);
21562 }
21563
21564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21565         LDKDecodeError e_conv;
21566         e_conv.inner = untag_ptr(e);
21567         e_conv.is_owned = ptr_is_owned(e);
21568         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21569         e_conv = DecodeError_clone(&e_conv);
21570         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21571         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
21572         return tag_ptr(ret_conv, true);
21573 }
21574
21575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21576         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
21577         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
21578         return ret_conv;
21579 }
21580
21581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21582         if (!ptr_is_owned(_res)) return;
21583         void* _res_ptr = untag_ptr(_res);
21584         CHECK_ACCESS(_res_ptr);
21585         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
21586         FREE(untag_ptr(_res));
21587         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
21588 }
21589
21590 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
21591         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21592         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
21593         return tag_ptr(ret_conv, true);
21594 }
21595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21596         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
21597         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
21598         return ret_conv;
21599 }
21600
21601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21602         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
21603         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21604         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
21605         return tag_ptr(ret_conv, true);
21606 }
21607
21608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21609         LDKFundingSigned o_conv;
21610         o_conv.inner = untag_ptr(o);
21611         o_conv.is_owned = ptr_is_owned(o);
21612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21613         o_conv = FundingSigned_clone(&o_conv);
21614         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21615         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
21616         return tag_ptr(ret_conv, true);
21617 }
21618
21619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21620         LDKDecodeError e_conv;
21621         e_conv.inner = untag_ptr(e);
21622         e_conv.is_owned = ptr_is_owned(e);
21623         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21624         e_conv = DecodeError_clone(&e_conv);
21625         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21626         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
21627         return tag_ptr(ret_conv, true);
21628 }
21629
21630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21631         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
21632         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
21633         return ret_conv;
21634 }
21635
21636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21637         if (!ptr_is_owned(_res)) return;
21638         void* _res_ptr = untag_ptr(_res);
21639         CHECK_ACCESS(_res_ptr);
21640         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
21641         FREE(untag_ptr(_res));
21642         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
21643 }
21644
21645 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
21646         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21647         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
21648         return tag_ptr(ret_conv, true);
21649 }
21650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21651         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
21652         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
21653         return ret_conv;
21654 }
21655
21656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21657         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
21658         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21659         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
21660         return tag_ptr(ret_conv, true);
21661 }
21662
21663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21664         LDKChannelReady o_conv;
21665         o_conv.inner = untag_ptr(o);
21666         o_conv.is_owned = ptr_is_owned(o);
21667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21668         o_conv = ChannelReady_clone(&o_conv);
21669         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21670         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
21671         return tag_ptr(ret_conv, true);
21672 }
21673
21674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21675         LDKDecodeError e_conv;
21676         e_conv.inner = untag_ptr(e);
21677         e_conv.is_owned = ptr_is_owned(e);
21678         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21679         e_conv = DecodeError_clone(&e_conv);
21680         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21681         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
21682         return tag_ptr(ret_conv, true);
21683 }
21684
21685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21686         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
21687         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
21688         return ret_conv;
21689 }
21690
21691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21692         if (!ptr_is_owned(_res)) return;
21693         void* _res_ptr = untag_ptr(_res);
21694         CHECK_ACCESS(_res_ptr);
21695         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
21696         FREE(untag_ptr(_res));
21697         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
21698 }
21699
21700 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
21701         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21702         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
21703         return tag_ptr(ret_conv, true);
21704 }
21705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21706         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
21707         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
21708         return ret_conv;
21709 }
21710
21711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21712         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
21713         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21714         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
21715         return tag_ptr(ret_conv, true);
21716 }
21717
21718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21719         LDKInit o_conv;
21720         o_conv.inner = untag_ptr(o);
21721         o_conv.is_owned = ptr_is_owned(o);
21722         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21723         o_conv = Init_clone(&o_conv);
21724         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21725         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
21726         return tag_ptr(ret_conv, true);
21727 }
21728
21729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21730         LDKDecodeError e_conv;
21731         e_conv.inner = untag_ptr(e);
21732         e_conv.is_owned = ptr_is_owned(e);
21733         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21734         e_conv = DecodeError_clone(&e_conv);
21735         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21736         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
21737         return tag_ptr(ret_conv, true);
21738 }
21739
21740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21741         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
21742         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
21743         return ret_conv;
21744 }
21745
21746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21747         if (!ptr_is_owned(_res)) return;
21748         void* _res_ptr = untag_ptr(_res);
21749         CHECK_ACCESS(_res_ptr);
21750         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
21751         FREE(untag_ptr(_res));
21752         CResult_InitDecodeErrorZ_free(_res_conv);
21753 }
21754
21755 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
21756         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21757         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
21758         return tag_ptr(ret_conv, true);
21759 }
21760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21761         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
21762         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
21763         return ret_conv;
21764 }
21765
21766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21767         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
21768         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21769         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
21770         return tag_ptr(ret_conv, true);
21771 }
21772
21773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21774         LDKOpenChannel o_conv;
21775         o_conv.inner = untag_ptr(o);
21776         o_conv.is_owned = ptr_is_owned(o);
21777         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21778         o_conv = OpenChannel_clone(&o_conv);
21779         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21780         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
21781         return tag_ptr(ret_conv, true);
21782 }
21783
21784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21785         LDKDecodeError e_conv;
21786         e_conv.inner = untag_ptr(e);
21787         e_conv.is_owned = ptr_is_owned(e);
21788         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21789         e_conv = DecodeError_clone(&e_conv);
21790         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21791         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
21792         return tag_ptr(ret_conv, true);
21793 }
21794
21795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21796         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
21797         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
21798         return ret_conv;
21799 }
21800
21801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21802         if (!ptr_is_owned(_res)) return;
21803         void* _res_ptr = untag_ptr(_res);
21804         CHECK_ACCESS(_res_ptr);
21805         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
21806         FREE(untag_ptr(_res));
21807         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
21808 }
21809
21810 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
21811         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21812         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
21813         return tag_ptr(ret_conv, true);
21814 }
21815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21816         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
21817         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
21818         return ret_conv;
21819 }
21820
21821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21822         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
21823         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21824         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
21825         return tag_ptr(ret_conv, true);
21826 }
21827
21828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21829         LDKRevokeAndACK o_conv;
21830         o_conv.inner = untag_ptr(o);
21831         o_conv.is_owned = ptr_is_owned(o);
21832         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21833         o_conv = RevokeAndACK_clone(&o_conv);
21834         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21835         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
21836         return tag_ptr(ret_conv, true);
21837 }
21838
21839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21840         LDKDecodeError e_conv;
21841         e_conv.inner = untag_ptr(e);
21842         e_conv.is_owned = ptr_is_owned(e);
21843         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21844         e_conv = DecodeError_clone(&e_conv);
21845         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21846         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
21847         return tag_ptr(ret_conv, true);
21848 }
21849
21850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21851         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
21852         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
21853         return ret_conv;
21854 }
21855
21856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21857         if (!ptr_is_owned(_res)) return;
21858         void* _res_ptr = untag_ptr(_res);
21859         CHECK_ACCESS(_res_ptr);
21860         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
21861         FREE(untag_ptr(_res));
21862         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
21863 }
21864
21865 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
21866         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21867         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
21868         return tag_ptr(ret_conv, true);
21869 }
21870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21871         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
21872         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
21873         return ret_conv;
21874 }
21875
21876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21877         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
21878         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21879         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
21880         return tag_ptr(ret_conv, true);
21881 }
21882
21883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21884         LDKShutdown o_conv;
21885         o_conv.inner = untag_ptr(o);
21886         o_conv.is_owned = ptr_is_owned(o);
21887         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21888         o_conv = Shutdown_clone(&o_conv);
21889         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21890         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
21891         return tag_ptr(ret_conv, true);
21892 }
21893
21894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21895         LDKDecodeError e_conv;
21896         e_conv.inner = untag_ptr(e);
21897         e_conv.is_owned = ptr_is_owned(e);
21898         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21899         e_conv = DecodeError_clone(&e_conv);
21900         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21901         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
21902         return tag_ptr(ret_conv, true);
21903 }
21904
21905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21906         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
21907         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
21908         return ret_conv;
21909 }
21910
21911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21912         if (!ptr_is_owned(_res)) return;
21913         void* _res_ptr = untag_ptr(_res);
21914         CHECK_ACCESS(_res_ptr);
21915         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
21916         FREE(untag_ptr(_res));
21917         CResult_ShutdownDecodeErrorZ_free(_res_conv);
21918 }
21919
21920 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
21921         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21922         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
21923         return tag_ptr(ret_conv, true);
21924 }
21925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21926         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
21927         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
21928         return ret_conv;
21929 }
21930
21931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21932         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
21933         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21934         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
21935         return tag_ptr(ret_conv, true);
21936 }
21937
21938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21939         LDKUpdateFailHTLC o_conv;
21940         o_conv.inner = untag_ptr(o);
21941         o_conv.is_owned = ptr_is_owned(o);
21942         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21943         o_conv = UpdateFailHTLC_clone(&o_conv);
21944         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21945         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
21946         return tag_ptr(ret_conv, true);
21947 }
21948
21949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21950         LDKDecodeError e_conv;
21951         e_conv.inner = untag_ptr(e);
21952         e_conv.is_owned = ptr_is_owned(e);
21953         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21954         e_conv = DecodeError_clone(&e_conv);
21955         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21956         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
21957         return tag_ptr(ret_conv, true);
21958 }
21959
21960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21961         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
21962         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
21963         return ret_conv;
21964 }
21965
21966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21967         if (!ptr_is_owned(_res)) return;
21968         void* _res_ptr = untag_ptr(_res);
21969         CHECK_ACCESS(_res_ptr);
21970         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
21971         FREE(untag_ptr(_res));
21972         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
21973 }
21974
21975 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
21976         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21977         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
21978         return tag_ptr(ret_conv, true);
21979 }
21980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21981         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
21982         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
21983         return ret_conv;
21984 }
21985
21986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21987         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
21988         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21989         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
21990         return tag_ptr(ret_conv, true);
21991 }
21992
21993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21994         LDKUpdateFailMalformedHTLC o_conv;
21995         o_conv.inner = untag_ptr(o);
21996         o_conv.is_owned = ptr_is_owned(o);
21997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21998         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
21999         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22000         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
22001         return tag_ptr(ret_conv, true);
22002 }
22003
22004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22005         LDKDecodeError e_conv;
22006         e_conv.inner = untag_ptr(e);
22007         e_conv.is_owned = ptr_is_owned(e);
22008         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22009         e_conv = DecodeError_clone(&e_conv);
22010         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22011         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
22012         return tag_ptr(ret_conv, true);
22013 }
22014
22015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22016         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
22017         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
22018         return ret_conv;
22019 }
22020
22021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22022         if (!ptr_is_owned(_res)) return;
22023         void* _res_ptr = untag_ptr(_res);
22024         CHECK_ACCESS(_res_ptr);
22025         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
22026         FREE(untag_ptr(_res));
22027         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
22028 }
22029
22030 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
22031         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22032         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
22033         return tag_ptr(ret_conv, true);
22034 }
22035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22036         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
22037         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
22038         return ret_conv;
22039 }
22040
22041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22042         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
22043         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22044         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
22045         return tag_ptr(ret_conv, true);
22046 }
22047
22048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22049         LDKUpdateFee o_conv;
22050         o_conv.inner = untag_ptr(o);
22051         o_conv.is_owned = ptr_is_owned(o);
22052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22053         o_conv = UpdateFee_clone(&o_conv);
22054         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22055         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
22056         return tag_ptr(ret_conv, true);
22057 }
22058
22059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22060         LDKDecodeError e_conv;
22061         e_conv.inner = untag_ptr(e);
22062         e_conv.is_owned = ptr_is_owned(e);
22063         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22064         e_conv = DecodeError_clone(&e_conv);
22065         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22066         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
22067         return tag_ptr(ret_conv, true);
22068 }
22069
22070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22071         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
22072         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
22073         return ret_conv;
22074 }
22075
22076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22077         if (!ptr_is_owned(_res)) return;
22078         void* _res_ptr = untag_ptr(_res);
22079         CHECK_ACCESS(_res_ptr);
22080         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
22081         FREE(untag_ptr(_res));
22082         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
22083 }
22084
22085 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
22086         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22087         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
22088         return tag_ptr(ret_conv, true);
22089 }
22090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22091         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
22092         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
22093         return ret_conv;
22094 }
22095
22096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22097         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
22098         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22099         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
22100         return tag_ptr(ret_conv, true);
22101 }
22102
22103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22104         LDKUpdateFulfillHTLC o_conv;
22105         o_conv.inner = untag_ptr(o);
22106         o_conv.is_owned = ptr_is_owned(o);
22107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22108         o_conv = UpdateFulfillHTLC_clone(&o_conv);
22109         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22110         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
22111         return tag_ptr(ret_conv, true);
22112 }
22113
22114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22115         LDKDecodeError e_conv;
22116         e_conv.inner = untag_ptr(e);
22117         e_conv.is_owned = ptr_is_owned(e);
22118         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22119         e_conv = DecodeError_clone(&e_conv);
22120         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22121         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
22122         return tag_ptr(ret_conv, true);
22123 }
22124
22125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22126         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
22127         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
22128         return ret_conv;
22129 }
22130
22131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22132         if (!ptr_is_owned(_res)) return;
22133         void* _res_ptr = untag_ptr(_res);
22134         CHECK_ACCESS(_res_ptr);
22135         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
22136         FREE(untag_ptr(_res));
22137         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
22138 }
22139
22140 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
22141         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22142         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
22143         return tag_ptr(ret_conv, true);
22144 }
22145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22146         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
22147         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
22148         return ret_conv;
22149 }
22150
22151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22152         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
22153         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22154         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
22155         return tag_ptr(ret_conv, true);
22156 }
22157
22158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22159         LDKUpdateAddHTLC o_conv;
22160         o_conv.inner = untag_ptr(o);
22161         o_conv.is_owned = ptr_is_owned(o);
22162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22163         o_conv = UpdateAddHTLC_clone(&o_conv);
22164         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22165         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
22166         return tag_ptr(ret_conv, true);
22167 }
22168
22169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22170         LDKDecodeError e_conv;
22171         e_conv.inner = untag_ptr(e);
22172         e_conv.is_owned = ptr_is_owned(e);
22173         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22174         e_conv = DecodeError_clone(&e_conv);
22175         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22176         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
22177         return tag_ptr(ret_conv, true);
22178 }
22179
22180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22181         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
22182         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
22183         return ret_conv;
22184 }
22185
22186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22187         if (!ptr_is_owned(_res)) return;
22188         void* _res_ptr = untag_ptr(_res);
22189         CHECK_ACCESS(_res_ptr);
22190         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
22191         FREE(untag_ptr(_res));
22192         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
22193 }
22194
22195 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
22196         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22197         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
22198         return tag_ptr(ret_conv, true);
22199 }
22200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22201         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
22202         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
22203         return ret_conv;
22204 }
22205
22206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22207         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
22208         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22209         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
22210         return tag_ptr(ret_conv, true);
22211 }
22212
22213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22214         LDKPing o_conv;
22215         o_conv.inner = untag_ptr(o);
22216         o_conv.is_owned = ptr_is_owned(o);
22217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22218         o_conv = Ping_clone(&o_conv);
22219         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22220         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
22221         return tag_ptr(ret_conv, true);
22222 }
22223
22224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22225         LDKDecodeError e_conv;
22226         e_conv.inner = untag_ptr(e);
22227         e_conv.is_owned = ptr_is_owned(e);
22228         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22229         e_conv = DecodeError_clone(&e_conv);
22230         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22231         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
22232         return tag_ptr(ret_conv, true);
22233 }
22234
22235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22236         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
22237         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
22238         return ret_conv;
22239 }
22240
22241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22242         if (!ptr_is_owned(_res)) return;
22243         void* _res_ptr = untag_ptr(_res);
22244         CHECK_ACCESS(_res_ptr);
22245         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
22246         FREE(untag_ptr(_res));
22247         CResult_PingDecodeErrorZ_free(_res_conv);
22248 }
22249
22250 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
22251         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22252         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
22253         return tag_ptr(ret_conv, true);
22254 }
22255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22256         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
22257         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
22258         return ret_conv;
22259 }
22260
22261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22262         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
22263         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22264         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
22265         return tag_ptr(ret_conv, true);
22266 }
22267
22268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22269         LDKPong o_conv;
22270         o_conv.inner = untag_ptr(o);
22271         o_conv.is_owned = ptr_is_owned(o);
22272         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22273         o_conv = Pong_clone(&o_conv);
22274         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22275         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
22276         return tag_ptr(ret_conv, true);
22277 }
22278
22279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22280         LDKDecodeError e_conv;
22281         e_conv.inner = untag_ptr(e);
22282         e_conv.is_owned = ptr_is_owned(e);
22283         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22284         e_conv = DecodeError_clone(&e_conv);
22285         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22286         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
22287         return tag_ptr(ret_conv, true);
22288 }
22289
22290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22291         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
22292         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
22293         return ret_conv;
22294 }
22295
22296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22297         if (!ptr_is_owned(_res)) return;
22298         void* _res_ptr = untag_ptr(_res);
22299         CHECK_ACCESS(_res_ptr);
22300         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
22301         FREE(untag_ptr(_res));
22302         CResult_PongDecodeErrorZ_free(_res_conv);
22303 }
22304
22305 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
22306         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22307         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
22308         return tag_ptr(ret_conv, true);
22309 }
22310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22311         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
22312         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
22313         return ret_conv;
22314 }
22315
22316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22317         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
22318         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22319         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
22320         return tag_ptr(ret_conv, true);
22321 }
22322
22323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22324         LDKUnsignedChannelAnnouncement o_conv;
22325         o_conv.inner = untag_ptr(o);
22326         o_conv.is_owned = ptr_is_owned(o);
22327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22328         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
22329         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22330         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
22331         return tag_ptr(ret_conv, true);
22332 }
22333
22334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22335         LDKDecodeError e_conv;
22336         e_conv.inner = untag_ptr(e);
22337         e_conv.is_owned = ptr_is_owned(e);
22338         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22339         e_conv = DecodeError_clone(&e_conv);
22340         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22341         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
22342         return tag_ptr(ret_conv, true);
22343 }
22344
22345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22346         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
22347         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22348         return ret_conv;
22349 }
22350
22351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22352         if (!ptr_is_owned(_res)) return;
22353         void* _res_ptr = untag_ptr(_res);
22354         CHECK_ACCESS(_res_ptr);
22355         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22356         FREE(untag_ptr(_res));
22357         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
22358 }
22359
22360 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22361         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22362         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
22363         return tag_ptr(ret_conv, true);
22364 }
22365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22366         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
22367         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22368         return ret_conv;
22369 }
22370
22371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22372         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
22373         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22374         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22375         return tag_ptr(ret_conv, true);
22376 }
22377
22378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22379         LDKChannelAnnouncement o_conv;
22380         o_conv.inner = untag_ptr(o);
22381         o_conv.is_owned = ptr_is_owned(o);
22382         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22383         o_conv = ChannelAnnouncement_clone(&o_conv);
22384         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22385         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
22386         return tag_ptr(ret_conv, true);
22387 }
22388
22389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22390         LDKDecodeError e_conv;
22391         e_conv.inner = untag_ptr(e);
22392         e_conv.is_owned = ptr_is_owned(e);
22393         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22394         e_conv = DecodeError_clone(&e_conv);
22395         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22396         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
22397         return tag_ptr(ret_conv, true);
22398 }
22399
22400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22401         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
22402         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22403         return ret_conv;
22404 }
22405
22406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22407         if (!ptr_is_owned(_res)) return;
22408         void* _res_ptr = untag_ptr(_res);
22409         CHECK_ACCESS(_res_ptr);
22410         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22411         FREE(untag_ptr(_res));
22412         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
22413 }
22414
22415 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22416         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22417         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
22418         return tag_ptr(ret_conv, true);
22419 }
22420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22421         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
22422         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22423         return ret_conv;
22424 }
22425
22426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22427         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
22428         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22429         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22430         return tag_ptr(ret_conv, true);
22431 }
22432
22433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22434         LDKUnsignedChannelUpdate o_conv;
22435         o_conv.inner = untag_ptr(o);
22436         o_conv.is_owned = ptr_is_owned(o);
22437         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22438         o_conv = UnsignedChannelUpdate_clone(&o_conv);
22439         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22440         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
22441         return tag_ptr(ret_conv, true);
22442 }
22443
22444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22445         LDKDecodeError e_conv;
22446         e_conv.inner = untag_ptr(e);
22447         e_conv.is_owned = ptr_is_owned(e);
22448         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22449         e_conv = DecodeError_clone(&e_conv);
22450         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22451         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
22452         return tag_ptr(ret_conv, true);
22453 }
22454
22455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22456         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
22457         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
22458         return ret_conv;
22459 }
22460
22461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22462         if (!ptr_is_owned(_res)) return;
22463         void* _res_ptr = untag_ptr(_res);
22464         CHECK_ACCESS(_res_ptr);
22465         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
22466         FREE(untag_ptr(_res));
22467         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
22468 }
22469
22470 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22471         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22472         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
22473         return tag_ptr(ret_conv, true);
22474 }
22475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22476         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
22477         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22478         return ret_conv;
22479 }
22480
22481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22482         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
22483         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22484         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
22485         return tag_ptr(ret_conv, true);
22486 }
22487
22488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22489         LDKChannelUpdate o_conv;
22490         o_conv.inner = untag_ptr(o);
22491         o_conv.is_owned = ptr_is_owned(o);
22492         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22493         o_conv = ChannelUpdate_clone(&o_conv);
22494         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22495         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
22496         return tag_ptr(ret_conv, true);
22497 }
22498
22499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22500         LDKDecodeError e_conv;
22501         e_conv.inner = untag_ptr(e);
22502         e_conv.is_owned = ptr_is_owned(e);
22503         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22504         e_conv = DecodeError_clone(&e_conv);
22505         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22506         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
22507         return tag_ptr(ret_conv, true);
22508 }
22509
22510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22511         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
22512         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
22513         return ret_conv;
22514 }
22515
22516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22517         if (!ptr_is_owned(_res)) return;
22518         void* _res_ptr = untag_ptr(_res);
22519         CHECK_ACCESS(_res_ptr);
22520         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
22521         FREE(untag_ptr(_res));
22522         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
22523 }
22524
22525 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22526         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22527         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
22528         return tag_ptr(ret_conv, true);
22529 }
22530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22531         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
22532         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22533         return ret_conv;
22534 }
22535
22536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22537         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
22538         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22539         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
22540         return tag_ptr(ret_conv, true);
22541 }
22542
22543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22544         LDKErrorMessage o_conv;
22545         o_conv.inner = untag_ptr(o);
22546         o_conv.is_owned = ptr_is_owned(o);
22547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22548         o_conv = ErrorMessage_clone(&o_conv);
22549         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22550         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
22551         return tag_ptr(ret_conv, true);
22552 }
22553
22554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22555         LDKDecodeError e_conv;
22556         e_conv.inner = untag_ptr(e);
22557         e_conv.is_owned = ptr_is_owned(e);
22558         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22559         e_conv = DecodeError_clone(&e_conv);
22560         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22561         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
22562         return tag_ptr(ret_conv, true);
22563 }
22564
22565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22566         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
22567         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
22568         return ret_conv;
22569 }
22570
22571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22572         if (!ptr_is_owned(_res)) return;
22573         void* _res_ptr = untag_ptr(_res);
22574         CHECK_ACCESS(_res_ptr);
22575         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
22576         FREE(untag_ptr(_res));
22577         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
22578 }
22579
22580 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
22581         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22582         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
22583         return tag_ptr(ret_conv, true);
22584 }
22585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22586         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
22587         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
22588         return ret_conv;
22589 }
22590
22591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22592         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
22593         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22594         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
22595         return tag_ptr(ret_conv, true);
22596 }
22597
22598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22599         LDKWarningMessage o_conv;
22600         o_conv.inner = untag_ptr(o);
22601         o_conv.is_owned = ptr_is_owned(o);
22602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22603         o_conv = WarningMessage_clone(&o_conv);
22604         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22605         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
22606         return tag_ptr(ret_conv, true);
22607 }
22608
22609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22610         LDKDecodeError e_conv;
22611         e_conv.inner = untag_ptr(e);
22612         e_conv.is_owned = ptr_is_owned(e);
22613         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22614         e_conv = DecodeError_clone(&e_conv);
22615         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22616         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
22617         return tag_ptr(ret_conv, true);
22618 }
22619
22620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22621         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
22622         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
22623         return ret_conv;
22624 }
22625
22626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22627         if (!ptr_is_owned(_res)) return;
22628         void* _res_ptr = untag_ptr(_res);
22629         CHECK_ACCESS(_res_ptr);
22630         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
22631         FREE(untag_ptr(_res));
22632         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
22633 }
22634
22635 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
22636         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22637         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
22638         return tag_ptr(ret_conv, true);
22639 }
22640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22641         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
22642         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
22643         return ret_conv;
22644 }
22645
22646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22647         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
22648         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22649         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
22650         return tag_ptr(ret_conv, true);
22651 }
22652
22653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22654         LDKUnsignedNodeAnnouncement o_conv;
22655         o_conv.inner = untag_ptr(o);
22656         o_conv.is_owned = ptr_is_owned(o);
22657         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22658         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
22659         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22660         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
22661         return tag_ptr(ret_conv, true);
22662 }
22663
22664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22665         LDKDecodeError e_conv;
22666         e_conv.inner = untag_ptr(e);
22667         e_conv.is_owned = ptr_is_owned(e);
22668         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22669         e_conv = DecodeError_clone(&e_conv);
22670         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22671         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
22672         return tag_ptr(ret_conv, true);
22673 }
22674
22675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22676         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
22677         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22678         return ret_conv;
22679 }
22680
22681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22682         if (!ptr_is_owned(_res)) return;
22683         void* _res_ptr = untag_ptr(_res);
22684         CHECK_ACCESS(_res_ptr);
22685         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
22686         FREE(untag_ptr(_res));
22687         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
22688 }
22689
22690 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22691         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22692         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
22693         return tag_ptr(ret_conv, true);
22694 }
22695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22696         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
22697         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22698         return ret_conv;
22699 }
22700
22701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22702         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
22703         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22704         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
22705         return tag_ptr(ret_conv, true);
22706 }
22707
22708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22709         LDKNodeAnnouncement o_conv;
22710         o_conv.inner = untag_ptr(o);
22711         o_conv.is_owned = ptr_is_owned(o);
22712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22713         o_conv = NodeAnnouncement_clone(&o_conv);
22714         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22715         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
22716         return tag_ptr(ret_conv, true);
22717 }
22718
22719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22720         LDKDecodeError e_conv;
22721         e_conv.inner = untag_ptr(e);
22722         e_conv.is_owned = ptr_is_owned(e);
22723         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22724         e_conv = DecodeError_clone(&e_conv);
22725         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22726         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
22727         return tag_ptr(ret_conv, true);
22728 }
22729
22730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22731         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
22732         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22733         return ret_conv;
22734 }
22735
22736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22737         if (!ptr_is_owned(_res)) return;
22738         void* _res_ptr = untag_ptr(_res);
22739         CHECK_ACCESS(_res_ptr);
22740         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
22741         FREE(untag_ptr(_res));
22742         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
22743 }
22744
22745 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22746         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22747         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
22748         return tag_ptr(ret_conv, true);
22749 }
22750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22751         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
22752         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22753         return ret_conv;
22754 }
22755
22756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22757         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
22758         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22759         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
22760         return tag_ptr(ret_conv, true);
22761 }
22762
22763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22764         LDKQueryShortChannelIds o_conv;
22765         o_conv.inner = untag_ptr(o);
22766         o_conv.is_owned = ptr_is_owned(o);
22767         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22768         o_conv = QueryShortChannelIds_clone(&o_conv);
22769         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22770         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
22771         return tag_ptr(ret_conv, true);
22772 }
22773
22774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22775         LDKDecodeError e_conv;
22776         e_conv.inner = untag_ptr(e);
22777         e_conv.is_owned = ptr_is_owned(e);
22778         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22779         e_conv = DecodeError_clone(&e_conv);
22780         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22781         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
22782         return tag_ptr(ret_conv, true);
22783 }
22784
22785 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22786         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
22787         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
22788         return ret_conv;
22789 }
22790
22791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22792         if (!ptr_is_owned(_res)) return;
22793         void* _res_ptr = untag_ptr(_res);
22794         CHECK_ACCESS(_res_ptr);
22795         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
22796         FREE(untag_ptr(_res));
22797         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
22798 }
22799
22800 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
22801         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22802         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
22803         return tag_ptr(ret_conv, true);
22804 }
22805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22806         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
22807         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
22808         return ret_conv;
22809 }
22810
22811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22812         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
22813         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22814         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
22815         return tag_ptr(ret_conv, true);
22816 }
22817
22818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22819         LDKReplyShortChannelIdsEnd o_conv;
22820         o_conv.inner = untag_ptr(o);
22821         o_conv.is_owned = ptr_is_owned(o);
22822         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22823         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
22824         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22825         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
22826         return tag_ptr(ret_conv, true);
22827 }
22828
22829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22830         LDKDecodeError e_conv;
22831         e_conv.inner = untag_ptr(e);
22832         e_conv.is_owned = ptr_is_owned(e);
22833         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22834         e_conv = DecodeError_clone(&e_conv);
22835         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22836         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
22837         return tag_ptr(ret_conv, true);
22838 }
22839
22840 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22841         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
22842         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
22843         return ret_conv;
22844 }
22845
22846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22847         if (!ptr_is_owned(_res)) return;
22848         void* _res_ptr = untag_ptr(_res);
22849         CHECK_ACCESS(_res_ptr);
22850         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
22851         FREE(untag_ptr(_res));
22852         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
22853 }
22854
22855 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
22856         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22857         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
22858         return tag_ptr(ret_conv, true);
22859 }
22860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22861         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
22862         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
22863         return ret_conv;
22864 }
22865
22866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22867         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
22868         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22869         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
22870         return tag_ptr(ret_conv, true);
22871 }
22872
22873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22874         LDKQueryChannelRange o_conv;
22875         o_conv.inner = untag_ptr(o);
22876         o_conv.is_owned = ptr_is_owned(o);
22877         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22878         o_conv = QueryChannelRange_clone(&o_conv);
22879         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22880         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
22881         return tag_ptr(ret_conv, true);
22882 }
22883
22884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22885         LDKDecodeError e_conv;
22886         e_conv.inner = untag_ptr(e);
22887         e_conv.is_owned = ptr_is_owned(e);
22888         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22889         e_conv = DecodeError_clone(&e_conv);
22890         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22891         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
22892         return tag_ptr(ret_conv, true);
22893 }
22894
22895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22896         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
22897         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
22898         return ret_conv;
22899 }
22900
22901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22902         if (!ptr_is_owned(_res)) return;
22903         void* _res_ptr = untag_ptr(_res);
22904         CHECK_ACCESS(_res_ptr);
22905         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
22906         FREE(untag_ptr(_res));
22907         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
22908 }
22909
22910 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22911         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22912         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
22913         return tag_ptr(ret_conv, true);
22914 }
22915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22916         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
22917         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22918         return ret_conv;
22919 }
22920
22921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22922         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
22923         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22924         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
22925         return tag_ptr(ret_conv, true);
22926 }
22927
22928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22929         LDKReplyChannelRange o_conv;
22930         o_conv.inner = untag_ptr(o);
22931         o_conv.is_owned = ptr_is_owned(o);
22932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22933         o_conv = ReplyChannelRange_clone(&o_conv);
22934         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22935         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
22936         return tag_ptr(ret_conv, true);
22937 }
22938
22939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22940         LDKDecodeError e_conv;
22941         e_conv.inner = untag_ptr(e);
22942         e_conv.is_owned = ptr_is_owned(e);
22943         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22944         e_conv = DecodeError_clone(&e_conv);
22945         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22946         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
22947         return tag_ptr(ret_conv, true);
22948 }
22949
22950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22951         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
22952         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
22953         return ret_conv;
22954 }
22955
22956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22957         if (!ptr_is_owned(_res)) return;
22958         void* _res_ptr = untag_ptr(_res);
22959         CHECK_ACCESS(_res_ptr);
22960         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
22961         FREE(untag_ptr(_res));
22962         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
22963 }
22964
22965 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22966         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22967         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
22968         return tag_ptr(ret_conv, true);
22969 }
22970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22971         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
22972         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22973         return ret_conv;
22974 }
22975
22976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22977         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
22978         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22979         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
22980         return tag_ptr(ret_conv, true);
22981 }
22982
22983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22984         LDKGossipTimestampFilter o_conv;
22985         o_conv.inner = untag_ptr(o);
22986         o_conv.is_owned = ptr_is_owned(o);
22987         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22988         o_conv = GossipTimestampFilter_clone(&o_conv);
22989         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22990         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
22991         return tag_ptr(ret_conv, true);
22992 }
22993
22994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22995         LDKDecodeError e_conv;
22996         e_conv.inner = untag_ptr(e);
22997         e_conv.is_owned = ptr_is_owned(e);
22998         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22999         e_conv = DecodeError_clone(&e_conv);
23000         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23001         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
23002         return tag_ptr(ret_conv, true);
23003 }
23004
23005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23006         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
23007         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
23008         return ret_conv;
23009 }
23010
23011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23012         if (!ptr_is_owned(_res)) return;
23013         void* _res_ptr = untag_ptr(_res);
23014         CHECK_ACCESS(_res_ptr);
23015         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
23016         FREE(untag_ptr(_res));
23017         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
23018 }
23019
23020 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
23021         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23022         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
23023         return tag_ptr(ret_conv, true);
23024 }
23025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23026         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
23027         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
23028         return ret_conv;
23029 }
23030
23031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23032         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
23033         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23034         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
23035         return tag_ptr(ret_conv, true);
23036 }
23037
23038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23039         LDKCVec_PhantomRouteHintsZ _res_constr;
23040         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23041         if (_res_constr.datalen > 0)
23042                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
23043         else
23044                 _res_constr.data = NULL;
23045         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23046         for (size_t t = 0; t < _res_constr.datalen; t++) {
23047                 int64_t _res_conv_19 = _res_vals[t];
23048                 LDKPhantomRouteHints _res_conv_19_conv;
23049                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
23050                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
23051                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23052                 _res_constr.data[t] = _res_conv_19_conv;
23053         }
23054         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23055         CVec_PhantomRouteHintsZ_free(_res_constr);
23056 }
23057
23058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23059         LDKInvoice o_conv;
23060         o_conv.inner = untag_ptr(o);
23061         o_conv.is_owned = ptr_is_owned(o);
23062         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23063         o_conv = Invoice_clone(&o_conv);
23064         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23065         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
23066         return tag_ptr(ret_conv, true);
23067 }
23068
23069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23070         void* e_ptr = untag_ptr(e);
23071         CHECK_ACCESS(e_ptr);
23072         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
23073         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
23074         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23075         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
23076         return tag_ptr(ret_conv, true);
23077 }
23078
23079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23080         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
23081         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
23082         return ret_conv;
23083 }
23084
23085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23086         if (!ptr_is_owned(_res)) return;
23087         void* _res_ptr = untag_ptr(_res);
23088         CHECK_ACCESS(_res_ptr);
23089         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
23090         FREE(untag_ptr(_res));
23091         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
23092 }
23093
23094 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
23095         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23096         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
23097         return tag_ptr(ret_conv, true);
23098 }
23099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23100         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
23101         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
23102         return ret_conv;
23103 }
23104
23105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23106         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
23107         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23108         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
23109         return tag_ptr(ret_conv, true);
23110 }
23111
23112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23113         void* o_ptr = untag_ptr(o);
23114         CHECK_ACCESS(o_ptr);
23115         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
23116         if (o_conv.free == LDKFilter_JCalls_free) {
23117                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23118                 LDKFilter_JCalls_cloned(&o_conv);
23119         }
23120         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23121         *ret_copy = COption_FilterZ_some(o_conv);
23122         int64_t ret_ref = tag_ptr(ret_copy, true);
23123         return ret_ref;
23124 }
23125
23126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
23127         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23128         *ret_copy = COption_FilterZ_none();
23129         int64_t ret_ref = tag_ptr(ret_copy, true);
23130         return ret_ref;
23131 }
23132
23133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23134         if (!ptr_is_owned(_res)) return;
23135         void* _res_ptr = untag_ptr(_res);
23136         CHECK_ACCESS(_res_ptr);
23137         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
23138         FREE(untag_ptr(_res));
23139         COption_FilterZ_free(_res_conv);
23140 }
23141
23142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23143         LDKLockedChannelMonitor o_conv;
23144         o_conv.inner = untag_ptr(o);
23145         o_conv.is_owned = ptr_is_owned(o);
23146         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23147         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
23148         
23149         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23150         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
23151         return tag_ptr(ret_conv, true);
23152 }
23153
23154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
23155         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23156         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
23157         return tag_ptr(ret_conv, true);
23158 }
23159
23160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23161         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
23162         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
23163         return ret_conv;
23164 }
23165
23166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23167         if (!ptr_is_owned(_res)) return;
23168         void* _res_ptr = untag_ptr(_res);
23169         CHECK_ACCESS(_res_ptr);
23170         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
23171         FREE(untag_ptr(_res));
23172         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
23173 }
23174
23175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23176         LDKCVec_OutPointZ _res_constr;
23177         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23178         if (_res_constr.datalen > 0)
23179                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
23180         else
23181                 _res_constr.data = NULL;
23182         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23183         for (size_t k = 0; k < _res_constr.datalen; k++) {
23184                 int64_t _res_conv_10 = _res_vals[k];
23185                 LDKOutPoint _res_conv_10_conv;
23186                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
23187                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
23188                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
23189                 _res_constr.data[k] = _res_conv_10_conv;
23190         }
23191         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23192         CVec_OutPointZ_free(_res_constr);
23193 }
23194
23195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23196         if (!ptr_is_owned(this_ptr)) return;
23197         void* this_ptr_ptr = untag_ptr(this_ptr);
23198         CHECK_ACCESS(this_ptr_ptr);
23199         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
23200         FREE(untag_ptr(this_ptr));
23201         PaymentPurpose_free(this_ptr_conv);
23202 }
23203
23204 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
23205         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23206         *ret_copy = PaymentPurpose_clone(arg);
23207         int64_t ret_ref = tag_ptr(ret_copy, true);
23208         return ret_ref;
23209 }
23210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23211         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
23212         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
23213         return ret_conv;
23214 }
23215
23216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23217         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
23218         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23219         *ret_copy = PaymentPurpose_clone(orig_conv);
23220         int64_t ret_ref = tag_ptr(ret_copy, true);
23221         return ret_ref;
23222 }
23223
23224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
23225         LDKThirtyTwoBytes payment_preimage_ref;
23226         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23227         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23228         LDKThirtyTwoBytes payment_secret_ref;
23229         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
23230         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
23231         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23232         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
23233         int64_t ret_ref = tag_ptr(ret_copy, true);
23234         return ret_ref;
23235 }
23236
23237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
23238         LDKThirtyTwoBytes a_ref;
23239         CHECK((*env)->GetArrayLength(env, a) == 32);
23240         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23241         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23242         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
23243         int64_t ret_ref = tag_ptr(ret_copy, true);
23244         return ret_ref;
23245 }
23246
23247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
23248         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
23249         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
23250         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23251         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23252         CVec_u8Z_free(ret_var);
23253         return ret_arr;
23254 }
23255
23256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23257         LDKu8slice ser_ref;
23258         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23259         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23260         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
23261         *ret_conv = PaymentPurpose_read(ser_ref);
23262         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23263         return tag_ptr(ret_conv, true);
23264 }
23265
23266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23267         if (!ptr_is_owned(this_ptr)) return;
23268         void* this_ptr_ptr = untag_ptr(this_ptr);
23269         CHECK_ACCESS(this_ptr_ptr);
23270         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
23271         FREE(untag_ptr(this_ptr));
23272         ClosureReason_free(this_ptr_conv);
23273 }
23274
23275 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
23276         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23277         *ret_copy = ClosureReason_clone(arg);
23278         int64_t ret_ref = tag_ptr(ret_copy, true);
23279         return ret_ref;
23280 }
23281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23282         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
23283         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
23284         return ret_conv;
23285 }
23286
23287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23288         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
23289         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23290         *ret_copy = ClosureReason_clone(orig_conv);
23291         int64_t ret_ref = tag_ptr(ret_copy, true);
23292         return ret_ref;
23293 }
23294
23295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
23296         LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
23297         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23298         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
23299         int64_t ret_ref = tag_ptr(ret_copy, true);
23300         return ret_ref;
23301 }
23302
23303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
23304         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23305         *ret_copy = ClosureReason_holder_force_closed();
23306         int64_t ret_ref = tag_ptr(ret_copy, true);
23307         return ret_ref;
23308 }
23309
23310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
23311         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23312         *ret_copy = ClosureReason_cooperative_closure();
23313         int64_t ret_ref = tag_ptr(ret_copy, true);
23314         return ret_ref;
23315 }
23316
23317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
23318         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23319         *ret_copy = ClosureReason_commitment_tx_confirmed();
23320         int64_t ret_ref = tag_ptr(ret_copy, true);
23321         return ret_ref;
23322 }
23323
23324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
23325         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23326         *ret_copy = ClosureReason_funding_timed_out();
23327         int64_t ret_ref = tag_ptr(ret_copy, true);
23328         return ret_ref;
23329 }
23330
23331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
23332         LDKStr err_conv = java_to_owned_str(env, err);
23333         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23334         *ret_copy = ClosureReason_processing_error(err_conv);
23335         int64_t ret_ref = tag_ptr(ret_copy, true);
23336         return ret_ref;
23337 }
23338
23339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
23340         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23341         *ret_copy = ClosureReason_disconnected_peer();
23342         int64_t ret_ref = tag_ptr(ret_copy, true);
23343         return ret_ref;
23344 }
23345
23346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
23347         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23348         *ret_copy = ClosureReason_outdated_channel_manager();
23349         int64_t ret_ref = tag_ptr(ret_copy, true);
23350         return ret_ref;
23351 }
23352
23353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
23354         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
23355         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
23356         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23357         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23358         CVec_u8Z_free(ret_var);
23359         return ret_arr;
23360 }
23361
23362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23363         LDKu8slice ser_ref;
23364         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23365         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23366         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
23367         *ret_conv = ClosureReason_read(ser_ref);
23368         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23369         return tag_ptr(ret_conv, true);
23370 }
23371
23372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23373         if (!ptr_is_owned(this_ptr)) return;
23374         void* this_ptr_ptr = untag_ptr(this_ptr);
23375         CHECK_ACCESS(this_ptr_ptr);
23376         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
23377         FREE(untag_ptr(this_ptr));
23378         HTLCDestination_free(this_ptr_conv);
23379 }
23380
23381 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
23382         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23383         *ret_copy = HTLCDestination_clone(arg);
23384         int64_t ret_ref = tag_ptr(ret_copy, true);
23385         return ret_ref;
23386 }
23387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23388         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
23389         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
23390         return ret_conv;
23391 }
23392
23393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23394         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
23395         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23396         *ret_copy = HTLCDestination_clone(orig_conv);
23397         int64_t ret_ref = tag_ptr(ret_copy, true);
23398         return ret_ref;
23399 }
23400
23401 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) {
23402         LDKPublicKey node_id_ref;
23403         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23404         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23405         LDKThirtyTwoBytes channel_id_ref;
23406         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23407         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23408         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23409         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
23410         int64_t ret_ref = tag_ptr(ret_copy, true);
23411         return ret_ref;
23412 }
23413
23414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
23415         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23416         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
23417         int64_t ret_ref = tag_ptr(ret_copy, true);
23418         return ret_ref;
23419 }
23420
23421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
23422         LDKThirtyTwoBytes payment_hash_ref;
23423         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23424         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23425         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23426         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
23427         int64_t ret_ref = tag_ptr(ret_copy, true);
23428         return ret_ref;
23429 }
23430
23431 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
23432         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
23433         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
23434         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23435         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23436         CVec_u8Z_free(ret_var);
23437         return ret_arr;
23438 }
23439
23440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23441         LDKu8slice ser_ref;
23442         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23443         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23444         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
23445         *ret_conv = HTLCDestination_read(ser_ref);
23446         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23447         return tag_ptr(ret_conv, true);
23448 }
23449
23450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23451         if (!ptr_is_owned(this_ptr)) return;
23452         void* this_ptr_ptr = untag_ptr(this_ptr);
23453         CHECK_ACCESS(this_ptr_ptr);
23454         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
23455         FREE(untag_ptr(this_ptr));
23456         Event_free(this_ptr_conv);
23457 }
23458
23459 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
23460         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23461         *ret_copy = Event_clone(arg);
23462         int64_t ret_ref = tag_ptr(ret_copy, true);
23463         return ret_ref;
23464 }
23465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23466         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
23467         int64_t ret_conv = Event_clone_ptr(arg_conv);
23468         return ret_conv;
23469 }
23470
23471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23472         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
23473         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23474         *ret_copy = Event_clone(orig_conv);
23475         int64_t ret_ref = tag_ptr(ret_copy, true);
23476         return ret_ref;
23477 }
23478
23479 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, int64_t user_channel_id) {
23480         LDKThirtyTwoBytes temporary_channel_id_ref;
23481         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23482         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23483         LDKPublicKey counterparty_node_id_ref;
23484         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23485         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23486         LDKCVec_u8Z output_script_ref;
23487         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
23488         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
23489         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
23490         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23491         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
23492         int64_t ret_ref = tag_ptr(ret_copy, true);
23493         return ret_ref;
23494 }
23495
23496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose) {
23497         LDKThirtyTwoBytes payment_hash_ref;
23498         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23499         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23500         void* purpose_ptr = untag_ptr(purpose);
23501         CHECK_ACCESS(purpose_ptr);
23502         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23503         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
23504         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23505         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
23506         int64_t ret_ref = tag_ptr(ret_copy, true);
23507         return ret_ref;
23508 }
23509
23510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimed(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose) {
23511         LDKThirtyTwoBytes payment_hash_ref;
23512         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23513         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23514         void* purpose_ptr = untag_ptr(purpose);
23515         CHECK_ACCESS(purpose_ptr);
23516         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23517         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
23518         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23519         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
23520         int64_t ret_ref = tag_ptr(ret_copy, true);
23521         return ret_ref;
23522 }
23523
23524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
23525         LDKThirtyTwoBytes payment_id_ref;
23526         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23527         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23528         LDKThirtyTwoBytes payment_preimage_ref;
23529         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23530         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23531         LDKThirtyTwoBytes payment_hash_ref;
23532         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23533         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23534         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
23535         CHECK_ACCESS(fee_paid_msat_ptr);
23536         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
23537         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
23538         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23539         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
23540         int64_t ret_ref = tag_ptr(ret_copy, true);
23541         return ret_ref;
23542 }
23543
23544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
23545         LDKThirtyTwoBytes payment_id_ref;
23546         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23547         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23548         LDKThirtyTwoBytes payment_hash_ref;
23549         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23550         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23551         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23552         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
23553         int64_t ret_ref = tag_ptr(ret_copy, true);
23554         return ret_ref;
23555 }
23556
23557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) {
23558         LDKThirtyTwoBytes payment_id_ref;
23559         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23560         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23561         LDKThirtyTwoBytes payment_hash_ref;
23562         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23563         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23564         LDKCVec_RouteHopZ path_constr;
23565         path_constr.datalen = (*env)->GetArrayLength(env, path);
23566         if (path_constr.datalen > 0)
23567                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23568         else
23569                 path_constr.data = NULL;
23570         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23571         for (size_t k = 0; k < path_constr.datalen; k++) {
23572                 int64_t path_conv_10 = path_vals[k];
23573                 LDKRouteHop path_conv_10_conv;
23574                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23575                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23576                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23577                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23578                 path_constr.data[k] = path_conv_10_conv;
23579         }
23580         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23581         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23582         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
23583         int64_t ret_ref = tag_ptr(ret_copy, true);
23584         return ret_ref;
23585 }
23586
23587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) {
23588         LDKThirtyTwoBytes payment_id_ref;
23589         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23590         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23591         LDKThirtyTwoBytes payment_hash_ref;
23592         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23593         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23594         void* network_update_ptr = untag_ptr(network_update);
23595         CHECK_ACCESS(network_update_ptr);
23596         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
23597         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
23598         LDKCVec_RouteHopZ path_constr;
23599         path_constr.datalen = (*env)->GetArrayLength(env, path);
23600         if (path_constr.datalen > 0)
23601                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23602         else
23603                 path_constr.data = NULL;
23604         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23605         for (size_t k = 0; k < path_constr.datalen; k++) {
23606                 int64_t path_conv_10 = path_vals[k];
23607                 LDKRouteHop path_conv_10_conv;
23608                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23609                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23610                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23611                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23612                 path_constr.data[k] = path_conv_10_conv;
23613         }
23614         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23615         void* short_channel_id_ptr = untag_ptr(short_channel_id);
23616         CHECK_ACCESS(short_channel_id_ptr);
23617         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23618         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
23619         LDKRouteParameters retry_conv;
23620         retry_conv.inner = untag_ptr(retry);
23621         retry_conv.is_owned = ptr_is_owned(retry);
23622         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
23623         retry_conv = RouteParameters_clone(&retry_conv);
23624         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23625         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
23626         int64_t ret_ref = tag_ptr(ret_copy, true);
23627         return ret_ref;
23628 }
23629
23630 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_tArray path) {
23631         LDKThirtyTwoBytes payment_id_ref;
23632         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23633         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23634         LDKThirtyTwoBytes payment_hash_ref;
23635         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23636         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23637         LDKCVec_RouteHopZ path_constr;
23638         path_constr.datalen = (*env)->GetArrayLength(env, path);
23639         if (path_constr.datalen > 0)
23640                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23641         else
23642                 path_constr.data = NULL;
23643         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23644         for (size_t k = 0; k < path_constr.datalen; k++) {
23645                 int64_t path_conv_10 = path_vals[k];
23646                 LDKRouteHop path_conv_10_conv;
23647                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23648                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23649                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23650                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23651                 path_constr.data[k] = path_conv_10_conv;
23652         }
23653         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23654         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23655         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
23656         int64_t ret_ref = tag_ptr(ret_copy, true);
23657         return ret_ref;
23658 }
23659
23660 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_tArray path, int64_t short_channel_id) {
23661         LDKThirtyTwoBytes payment_id_ref;
23662         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23663         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23664         LDKThirtyTwoBytes payment_hash_ref;
23665         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23666         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23667         LDKCVec_RouteHopZ path_constr;
23668         path_constr.datalen = (*env)->GetArrayLength(env, path);
23669         if (path_constr.datalen > 0)
23670                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23671         else
23672                 path_constr.data = NULL;
23673         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23674         for (size_t k = 0; k < path_constr.datalen; k++) {
23675                 int64_t path_conv_10 = path_vals[k];
23676                 LDKRouteHop path_conv_10_conv;
23677                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23678                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23679                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23680                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23681                 path_constr.data[k] = path_conv_10_conv;
23682         }
23683         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23684         void* short_channel_id_ptr = untag_ptr(short_channel_id);
23685         CHECK_ACCESS(short_channel_id_ptr);
23686         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23687         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
23688         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23689         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
23690         int64_t ret_ref = tag_ptr(ret_copy, true);
23691         return ret_ref;
23692 }
23693
23694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
23695         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23696         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
23697         int64_t ret_ref = tag_ptr(ret_copy, true);
23698         return ret_ref;
23699 }
23700
23701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
23702         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
23703         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
23704         if (outputs_constr.datalen > 0)
23705                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23706         else
23707                 outputs_constr.data = NULL;
23708         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
23709         for (size_t b = 0; b < outputs_constr.datalen; b++) {
23710                 int64_t outputs_conv_27 = outputs_vals[b];
23711                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
23712                 CHECK_ACCESS(outputs_conv_27_ptr);
23713                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
23714                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
23715                 outputs_constr.data[b] = outputs_conv_27_conv;
23716         }
23717         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
23718         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23719         *ret_copy = Event_spendable_outputs(outputs_constr);
23720         int64_t ret_ref = tag_ptr(ret_copy, true);
23721         return ret_ref;
23722 }
23723
23724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int8_tArray next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
23725         LDKThirtyTwoBytes prev_channel_id_ref;
23726         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
23727         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
23728         LDKThirtyTwoBytes next_channel_id_ref;
23729         CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
23730         (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
23731         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
23732         CHECK_ACCESS(fee_earned_msat_ptr);
23733         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
23734         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
23735         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23736         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
23737         int64_t ret_ref = tag_ptr(ret_copy, true);
23738         return ret_ref;
23739 }
23740
23741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t user_channel_id, int64_t reason) {
23742         LDKThirtyTwoBytes channel_id_ref;
23743         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23744         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23745         void* reason_ptr = untag_ptr(reason);
23746         CHECK_ACCESS(reason_ptr);
23747         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
23748         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
23749         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23750         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
23751         int64_t ret_ref = tag_ptr(ret_copy, true);
23752         return ret_ref;
23753 }
23754
23755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
23756         LDKThirtyTwoBytes channel_id_ref;
23757         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23758         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23759         LDKTransaction transaction_ref;
23760         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
23761         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
23762         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
23763         transaction_ref.data_is_owned = true;
23764         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23765         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
23766         int64_t ret_ref = tag_ptr(ret_copy, true);
23767         return ret_ref;
23768 }
23769
23770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_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) {
23771         LDKThirtyTwoBytes temporary_channel_id_ref;
23772         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23773         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23774         LDKPublicKey counterparty_node_id_ref;
23775         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23776         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23777         LDKChannelTypeFeatures channel_type_conv;
23778         channel_type_conv.inner = untag_ptr(channel_type);
23779         channel_type_conv.is_owned = ptr_is_owned(channel_type);
23780         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
23781         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
23782         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23783         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
23784         int64_t ret_ref = tag_ptr(ret_copy, true);
23785         return ret_ref;
23786 }
23787
23788 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) {
23789         LDKThirtyTwoBytes prev_channel_id_ref;
23790         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
23791         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
23792         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
23793         CHECK_ACCESS(failed_next_destination_ptr);
23794         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
23795         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
23796         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23797         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
23798         int64_t ret_ref = tag_ptr(ret_copy, true);
23799         return ret_ref;
23800 }
23801
23802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
23803         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
23804         LDKCVec_u8Z ret_var = Event_write(obj_conv);
23805         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23806         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23807         CVec_u8Z_free(ret_var);
23808         return ret_arr;
23809 }
23810
23811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23812         LDKu8slice ser_ref;
23813         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23814         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23815         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
23816         *ret_conv = Event_read(ser_ref);
23817         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23818         return tag_ptr(ret_conv, true);
23819 }
23820
23821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23822         if (!ptr_is_owned(this_ptr)) return;
23823         void* this_ptr_ptr = untag_ptr(this_ptr);
23824         CHECK_ACCESS(this_ptr_ptr);
23825         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
23826         FREE(untag_ptr(this_ptr));
23827         MessageSendEvent_free(this_ptr_conv);
23828 }
23829
23830 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
23831         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23832         *ret_copy = MessageSendEvent_clone(arg);
23833         int64_t ret_ref = tag_ptr(ret_copy, true);
23834         return ret_ref;
23835 }
23836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23837         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
23838         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
23839         return ret_conv;
23840 }
23841
23842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23843         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
23844         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23845         *ret_copy = MessageSendEvent_clone(orig_conv);
23846         int64_t ret_ref = tag_ptr(ret_copy, true);
23847         return ret_ref;
23848 }
23849
23850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23851         LDKPublicKey node_id_ref;
23852         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23853         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23854         LDKAcceptChannel msg_conv;
23855         msg_conv.inner = untag_ptr(msg);
23856         msg_conv.is_owned = ptr_is_owned(msg);
23857         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23858         msg_conv = AcceptChannel_clone(&msg_conv);
23859         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23860         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
23861         int64_t ret_ref = tag_ptr(ret_copy, true);
23862         return ret_ref;
23863 }
23864
23865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23866         LDKPublicKey node_id_ref;
23867         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23868         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23869         LDKOpenChannel msg_conv;
23870         msg_conv.inner = untag_ptr(msg);
23871         msg_conv.is_owned = ptr_is_owned(msg);
23872         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23873         msg_conv = OpenChannel_clone(&msg_conv);
23874         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23875         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
23876         int64_t ret_ref = tag_ptr(ret_copy, true);
23877         return ret_ref;
23878 }
23879
23880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23881         LDKPublicKey node_id_ref;
23882         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23883         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23884         LDKFundingCreated msg_conv;
23885         msg_conv.inner = untag_ptr(msg);
23886         msg_conv.is_owned = ptr_is_owned(msg);
23887         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23888         msg_conv = FundingCreated_clone(&msg_conv);
23889         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23890         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
23891         int64_t ret_ref = tag_ptr(ret_copy, true);
23892         return ret_ref;
23893 }
23894
23895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23896         LDKPublicKey node_id_ref;
23897         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23898         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23899         LDKFundingSigned msg_conv;
23900         msg_conv.inner = untag_ptr(msg);
23901         msg_conv.is_owned = ptr_is_owned(msg);
23902         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23903         msg_conv = FundingSigned_clone(&msg_conv);
23904         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23905         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
23906         int64_t ret_ref = tag_ptr(ret_copy, true);
23907         return ret_ref;
23908 }
23909
23910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23911         LDKPublicKey node_id_ref;
23912         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23913         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23914         LDKChannelReady msg_conv;
23915         msg_conv.inner = untag_ptr(msg);
23916         msg_conv.is_owned = ptr_is_owned(msg);
23917         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23918         msg_conv = ChannelReady_clone(&msg_conv);
23919         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23920         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
23921         int64_t ret_ref = tag_ptr(ret_copy, true);
23922         return ret_ref;
23923 }
23924
23925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23926         LDKPublicKey node_id_ref;
23927         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23928         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23929         LDKAnnouncementSignatures msg_conv;
23930         msg_conv.inner = untag_ptr(msg);
23931         msg_conv.is_owned = ptr_is_owned(msg);
23932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23933         msg_conv = AnnouncementSignatures_clone(&msg_conv);
23934         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23935         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
23936         int64_t ret_ref = tag_ptr(ret_copy, true);
23937         return ret_ref;
23938 }
23939
23940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
23941         LDKPublicKey node_id_ref;
23942         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23943         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23944         LDKCommitmentUpdate updates_conv;
23945         updates_conv.inner = untag_ptr(updates);
23946         updates_conv.is_owned = ptr_is_owned(updates);
23947         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23948         updates_conv = CommitmentUpdate_clone(&updates_conv);
23949         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23950         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
23951         int64_t ret_ref = tag_ptr(ret_copy, true);
23952         return ret_ref;
23953 }
23954
23955 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) {
23956         LDKPublicKey node_id_ref;
23957         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23958         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23959         LDKRevokeAndACK msg_conv;
23960         msg_conv.inner = untag_ptr(msg);
23961         msg_conv.is_owned = ptr_is_owned(msg);
23962         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23963         msg_conv = RevokeAndACK_clone(&msg_conv);
23964         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23965         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
23966         int64_t ret_ref = tag_ptr(ret_copy, true);
23967         return ret_ref;
23968 }
23969
23970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23971         LDKPublicKey node_id_ref;
23972         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23973         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23974         LDKClosingSigned msg_conv;
23975         msg_conv.inner = untag_ptr(msg);
23976         msg_conv.is_owned = ptr_is_owned(msg);
23977         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23978         msg_conv = ClosingSigned_clone(&msg_conv);
23979         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23980         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
23981         int64_t ret_ref = tag_ptr(ret_copy, true);
23982         return ret_ref;
23983 }
23984
23985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23986         LDKPublicKey node_id_ref;
23987         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23988         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23989         LDKShutdown msg_conv;
23990         msg_conv.inner = untag_ptr(msg);
23991         msg_conv.is_owned = ptr_is_owned(msg);
23992         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23993         msg_conv = Shutdown_clone(&msg_conv);
23994         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23995         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
23996         int64_t ret_ref = tag_ptr(ret_copy, true);
23997         return ret_ref;
23998 }
23999
24000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24001         LDKPublicKey node_id_ref;
24002         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24003         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24004         LDKChannelReestablish msg_conv;
24005         msg_conv.inner = untag_ptr(msg);
24006         msg_conv.is_owned = ptr_is_owned(msg);
24007         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24008         msg_conv = ChannelReestablish_clone(&msg_conv);
24009         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24010         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
24011         int64_t ret_ref = tag_ptr(ret_copy, true);
24012         return ret_ref;
24013 }
24014
24015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
24016         LDKChannelAnnouncement msg_conv;
24017         msg_conv.inner = untag_ptr(msg);
24018         msg_conv.is_owned = ptr_is_owned(msg);
24019         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24020         msg_conv = ChannelAnnouncement_clone(&msg_conv);
24021         LDKChannelUpdate update_msg_conv;
24022         update_msg_conv.inner = untag_ptr(update_msg);
24023         update_msg_conv.is_owned = ptr_is_owned(update_msg);
24024         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
24025         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
24026         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24027         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
24028         int64_t ret_ref = tag_ptr(ret_copy, true);
24029         return ret_ref;
24030 }
24031
24032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
24033         LDKNodeAnnouncement msg_conv;
24034         msg_conv.inner = untag_ptr(msg);
24035         msg_conv.is_owned = ptr_is_owned(msg);
24036         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24037         msg_conv = NodeAnnouncement_clone(&msg_conv);
24038         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24039         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
24040         int64_t ret_ref = tag_ptr(ret_copy, true);
24041         return ret_ref;
24042 }
24043
24044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
24045         LDKChannelUpdate msg_conv;
24046         msg_conv.inner = untag_ptr(msg);
24047         msg_conv.is_owned = ptr_is_owned(msg);
24048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24049         msg_conv = ChannelUpdate_clone(&msg_conv);
24050         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24051         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
24052         int64_t ret_ref = tag_ptr(ret_copy, true);
24053         return ret_ref;
24054 }
24055
24056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24057         LDKPublicKey node_id_ref;
24058         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24059         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24060         LDKChannelUpdate msg_conv;
24061         msg_conv.inner = untag_ptr(msg);
24062         msg_conv.is_owned = ptr_is_owned(msg);
24063         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24064         msg_conv = ChannelUpdate_clone(&msg_conv);
24065         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24066         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
24067         int64_t ret_ref = tag_ptr(ret_copy, true);
24068         return ret_ref;
24069 }
24070
24071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
24072         LDKPublicKey node_id_ref;
24073         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24074         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24075         void* action_ptr = untag_ptr(action);
24076         CHECK_ACCESS(action_ptr);
24077         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
24078         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
24079         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24080         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
24081         int64_t ret_ref = tag_ptr(ret_copy, true);
24082         return ret_ref;
24083 }
24084
24085 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) {
24086         LDKPublicKey node_id_ref;
24087         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24088         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24089         LDKQueryChannelRange msg_conv;
24090         msg_conv.inner = untag_ptr(msg);
24091         msg_conv.is_owned = ptr_is_owned(msg);
24092         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24093         msg_conv = QueryChannelRange_clone(&msg_conv);
24094         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24095         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
24096         int64_t ret_ref = tag_ptr(ret_copy, true);
24097         return ret_ref;
24098 }
24099
24100 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) {
24101         LDKPublicKey node_id_ref;
24102         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24103         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24104         LDKQueryShortChannelIds msg_conv;
24105         msg_conv.inner = untag_ptr(msg);
24106         msg_conv.is_owned = ptr_is_owned(msg);
24107         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24108         msg_conv = QueryShortChannelIds_clone(&msg_conv);
24109         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24110         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
24111         int64_t ret_ref = tag_ptr(ret_copy, true);
24112         return ret_ref;
24113 }
24114
24115 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) {
24116         LDKPublicKey node_id_ref;
24117         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24118         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24119         LDKReplyChannelRange msg_conv;
24120         msg_conv.inner = untag_ptr(msg);
24121         msg_conv.is_owned = ptr_is_owned(msg);
24122         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24123         msg_conv = ReplyChannelRange_clone(&msg_conv);
24124         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24125         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
24126         int64_t ret_ref = tag_ptr(ret_copy, true);
24127         return ret_ref;
24128 }
24129
24130 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) {
24131         LDKPublicKey node_id_ref;
24132         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24133         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24134         LDKGossipTimestampFilter msg_conv;
24135         msg_conv.inner = untag_ptr(msg);
24136         msg_conv.is_owned = ptr_is_owned(msg);
24137         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24138         msg_conv = GossipTimestampFilter_clone(&msg_conv);
24139         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24140         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
24141         int64_t ret_ref = tag_ptr(ret_copy, true);
24142         return ret_ref;
24143 }
24144
24145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24146         if (!ptr_is_owned(this_ptr)) return;
24147         void* this_ptr_ptr = untag_ptr(this_ptr);
24148         CHECK_ACCESS(this_ptr_ptr);
24149         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
24150         FREE(untag_ptr(this_ptr));
24151         MessageSendEventsProvider_free(this_ptr_conv);
24152 }
24153
24154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24155         if (!ptr_is_owned(this_ptr)) return;
24156         void* this_ptr_ptr = untag_ptr(this_ptr);
24157         CHECK_ACCESS(this_ptr_ptr);
24158         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
24159         FREE(untag_ptr(this_ptr));
24160         EventsProvider_free(this_ptr_conv);
24161 }
24162
24163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24164         if (!ptr_is_owned(this_ptr)) return;
24165         void* this_ptr_ptr = untag_ptr(this_ptr);
24166         CHECK_ACCESS(this_ptr_ptr);
24167         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
24168         FREE(untag_ptr(this_ptr));
24169         EventHandler_free(this_ptr_conv);
24170 }
24171
24172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24173         if (!ptr_is_owned(this_ptr)) return;
24174         void* this_ptr_ptr = untag_ptr(this_ptr);
24175         CHECK_ACCESS(this_ptr_ptr);
24176         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
24177         FREE(untag_ptr(this_ptr));
24178         APIError_free(this_ptr_conv);
24179 }
24180
24181 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
24182         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24183         *ret_copy = APIError_clone(arg);
24184         int64_t ret_ref = tag_ptr(ret_copy, true);
24185         return ret_ref;
24186 }
24187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24188         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
24189         int64_t ret_conv = APIError_clone_ptr(arg_conv);
24190         return ret_conv;
24191 }
24192
24193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24194         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
24195         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24196         *ret_copy = APIError_clone(orig_conv);
24197         int64_t ret_ref = tag_ptr(ret_copy, true);
24198         return ret_ref;
24199 }
24200
24201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
24202         LDKStr err_conv = java_to_owned_str(env, err);
24203         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24204         *ret_copy = APIError_apimisuse_error(err_conv);
24205         int64_t ret_ref = tag_ptr(ret_copy, true);
24206         return ret_ref;
24207 }
24208
24209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
24210         LDKStr err_conv = java_to_owned_str(env, err);
24211         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24212         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
24213         int64_t ret_ref = tag_ptr(ret_copy, true);
24214         return ret_ref;
24215 }
24216
24217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
24218         LDKStr err_conv = java_to_owned_str(env, err);
24219         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24220         *ret_copy = APIError_route_error(err_conv);
24221         int64_t ret_ref = tag_ptr(ret_copy, true);
24222         return ret_ref;
24223 }
24224
24225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
24226         LDKStr err_conv = java_to_owned_str(env, err);
24227         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24228         *ret_copy = APIError_channel_unavailable(err_conv);
24229         int64_t ret_ref = tag_ptr(ret_copy, true);
24230         return ret_ref;
24231 }
24232
24233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
24234         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24235         *ret_copy = APIError_monitor_update_failed();
24236         int64_t ret_ref = tag_ptr(ret_copy, true);
24237         return ret_ref;
24238 }
24239
24240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
24241         LDKShutdownScript script_conv;
24242         script_conv.inner = untag_ptr(script);
24243         script_conv.is_owned = ptr_is_owned(script);
24244         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
24245         script_conv = ShutdownScript_clone(&script_conv);
24246         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24247         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
24248         int64_t ret_ref = tag_ptr(ret_copy, true);
24249         return ret_ref;
24250 }
24251
24252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24253         LDKBigSize this_obj_conv;
24254         this_obj_conv.inner = untag_ptr(this_obj);
24255         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24257         BigSize_free(this_obj_conv);
24258 }
24259
24260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
24261         LDKBigSize this_ptr_conv;
24262         this_ptr_conv.inner = untag_ptr(this_ptr);
24263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24265         this_ptr_conv.is_owned = false;
24266         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
24267         return ret_conv;
24268 }
24269
24270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24271         LDKBigSize this_ptr_conv;
24272         this_ptr_conv.inner = untag_ptr(this_ptr);
24273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24275         this_ptr_conv.is_owned = false;
24276         BigSize_set_a(&this_ptr_conv, val);
24277 }
24278
24279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
24280         LDKBigSize ret_var = BigSize_new(a_arg);
24281         int64_t ret_ref = 0;
24282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24284         return ret_ref;
24285 }
24286
24287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24288         LDKHostname this_obj_conv;
24289         this_obj_conv.inner = untag_ptr(this_obj);
24290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24292         Hostname_free(this_obj_conv);
24293 }
24294
24295 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
24296         LDKHostname ret_var = Hostname_clone(arg);
24297         int64_t ret_ref = 0;
24298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24300         return ret_ref;
24301 }
24302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24303         LDKHostname arg_conv;
24304         arg_conv.inner = untag_ptr(arg);
24305         arg_conv.is_owned = ptr_is_owned(arg);
24306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24307         arg_conv.is_owned = false;
24308         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
24309         return ret_conv;
24310 }
24311
24312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24313         LDKHostname orig_conv;
24314         orig_conv.inner = untag_ptr(orig);
24315         orig_conv.is_owned = ptr_is_owned(orig);
24316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24317         orig_conv.is_owned = false;
24318         LDKHostname ret_var = Hostname_clone(&orig_conv);
24319         int64_t ret_ref = 0;
24320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24322         return ret_ref;
24323 }
24324
24325 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
24326         LDKHostname this_arg_conv;
24327         this_arg_conv.inner = untag_ptr(this_arg);
24328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24330         this_arg_conv.is_owned = false;
24331         int8_t ret_conv = Hostname_len(&this_arg_conv);
24332         return ret_conv;
24333 }
24334
24335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
24336         LDKu8slice msg_ref;
24337         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24338         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24339         unsigned char sk_arr[32];
24340         CHECK((*env)->GetArrayLength(env, sk) == 32);
24341         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
24342         unsigned char (*sk_ref)[32] = &sk_arr;
24343         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
24344         *ret_conv = sign(msg_ref, sk_ref);
24345         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24346         return tag_ptr(ret_conv, true);
24347 }
24348
24349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
24350         LDKu8slice msg_ref;
24351         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24352         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24353         LDKStr sig_conv = java_to_owned_str(env, sig);
24354         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24355         *ret_conv = recover_pk(msg_ref, sig_conv);
24356         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24357         return tag_ptr(ret_conv, true);
24358 }
24359
24360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
24361         LDKu8slice msg_ref;
24362         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24363         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24364         LDKStr sig_conv = java_to_owned_str(env, sig);
24365         LDKPublicKey pk_ref;
24366         CHECK((*env)->GetArrayLength(env, pk) == 33);
24367         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
24368         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
24369         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24370         return ret_conv;
24371 }
24372
24373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
24374         LDKu8slice hrp_bytes_ref;
24375         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
24376         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
24377         LDKCVec_u5Z data_without_signature_constr;
24378         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
24379         if (data_without_signature_constr.datalen > 0)
24380                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
24381         else
24382                 data_without_signature_constr.data = NULL;
24383         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
24384         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
24385                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
24386                 
24387                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
24388         }
24389         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
24390         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
24391         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24392         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24393         CVec_u8Z_free(ret_var);
24394         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
24395         return ret_arr;
24396 }
24397
24398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24399         if (!ptr_is_owned(this_ptr)) return;
24400         void* this_ptr_ptr = untag_ptr(this_ptr);
24401         CHECK_ACCESS(this_ptr_ptr);
24402         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
24403         FREE(untag_ptr(this_ptr));
24404         Persister_free(this_ptr_conv);
24405 }
24406
24407 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24408         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
24409         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
24410         return ret_conv;
24411 }
24412
24413 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
24414         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
24415         return ret_conv;
24416 }
24417
24418 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
24419         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
24420         return ret_conv;
24421 }
24422
24423 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
24424         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
24425         return ret_conv;
24426 }
24427
24428 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
24429         jclass ret_conv = LDKLevel_to_java(env, Level_info());
24430         return ret_conv;
24431 }
24432
24433 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
24434         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
24435         return ret_conv;
24436 }
24437
24438 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
24439         jclass ret_conv = LDKLevel_to_java(env, Level_error());
24440         return ret_conv;
24441 }
24442
24443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24444         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
24445         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
24446         jboolean ret_conv = Level_eq(a_conv, b_conv);
24447         return ret_conv;
24448 }
24449
24450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
24451         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
24452         int64_t ret_conv = Level_hash(o_conv);
24453         return ret_conv;
24454 }
24455
24456 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
24457         jclass ret_conv = LDKLevel_to_java(env, Level_max());
24458         return ret_conv;
24459 }
24460
24461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24462         LDKRecord this_obj_conv;
24463         this_obj_conv.inner = untag_ptr(this_obj);
24464         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24466         Record_free(this_obj_conv);
24467 }
24468
24469 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
24470         LDKRecord this_ptr_conv;
24471         this_ptr_conv.inner = untag_ptr(this_ptr);
24472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24474         this_ptr_conv.is_owned = false;
24475         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
24476         return ret_conv;
24477 }
24478
24479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
24480         LDKRecord this_ptr_conv;
24481         this_ptr_conv.inner = untag_ptr(this_ptr);
24482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24484         this_ptr_conv.is_owned = false;
24485         LDKLevel val_conv = LDKLevel_from_java(env, val);
24486         Record_set_level(&this_ptr_conv, val_conv);
24487 }
24488
24489 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
24490         LDKRecord this_ptr_conv;
24491         this_ptr_conv.inner = untag_ptr(this_ptr);
24492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24494         this_ptr_conv.is_owned = false;
24495         LDKStr ret_str = Record_get_args(&this_ptr_conv);
24496         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24497         Str_free(ret_str);
24498         return ret_conv;
24499 }
24500
24501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24502         LDKRecord this_ptr_conv;
24503         this_ptr_conv.inner = untag_ptr(this_ptr);
24504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24506         this_ptr_conv.is_owned = false;
24507         LDKStr val_conv = java_to_owned_str(env, val);
24508         Record_set_args(&this_ptr_conv, val_conv);
24509 }
24510
24511 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
24512         LDKRecord this_ptr_conv;
24513         this_ptr_conv.inner = untag_ptr(this_ptr);
24514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24516         this_ptr_conv.is_owned = false;
24517         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
24518         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24519         Str_free(ret_str);
24520         return ret_conv;
24521 }
24522
24523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24524         LDKRecord this_ptr_conv;
24525         this_ptr_conv.inner = untag_ptr(this_ptr);
24526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24528         this_ptr_conv.is_owned = false;
24529         LDKStr val_conv = java_to_owned_str(env, val);
24530         Record_set_module_path(&this_ptr_conv, val_conv);
24531 }
24532
24533 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
24534         LDKRecord this_ptr_conv;
24535         this_ptr_conv.inner = untag_ptr(this_ptr);
24536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24538         this_ptr_conv.is_owned = false;
24539         LDKStr ret_str = Record_get_file(&this_ptr_conv);
24540         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24541         Str_free(ret_str);
24542         return ret_conv;
24543 }
24544
24545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24546         LDKRecord this_ptr_conv;
24547         this_ptr_conv.inner = untag_ptr(this_ptr);
24548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24550         this_ptr_conv.is_owned = false;
24551         LDKStr val_conv = java_to_owned_str(env, val);
24552         Record_set_file(&this_ptr_conv, val_conv);
24553 }
24554
24555 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
24556         LDKRecord this_ptr_conv;
24557         this_ptr_conv.inner = untag_ptr(this_ptr);
24558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24560         this_ptr_conv.is_owned = false;
24561         int32_t ret_conv = Record_get_line(&this_ptr_conv);
24562         return ret_conv;
24563 }
24564
24565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24566         LDKRecord this_ptr_conv;
24567         this_ptr_conv.inner = untag_ptr(this_ptr);
24568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24570         this_ptr_conv.is_owned = false;
24571         Record_set_line(&this_ptr_conv, val);
24572 }
24573
24574 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
24575         LDKRecord ret_var = Record_clone(arg);
24576         int64_t ret_ref = 0;
24577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24579         return ret_ref;
24580 }
24581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24582         LDKRecord arg_conv;
24583         arg_conv.inner = untag_ptr(arg);
24584         arg_conv.is_owned = ptr_is_owned(arg);
24585         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24586         arg_conv.is_owned = false;
24587         int64_t ret_conv = Record_clone_ptr(&arg_conv);
24588         return ret_conv;
24589 }
24590
24591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24592         LDKRecord orig_conv;
24593         orig_conv.inner = untag_ptr(orig);
24594         orig_conv.is_owned = ptr_is_owned(orig);
24595         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24596         orig_conv.is_owned = false;
24597         LDKRecord ret_var = Record_clone(&orig_conv);
24598         int64_t ret_ref = 0;
24599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24601         return ret_ref;
24602 }
24603
24604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24605         if (!ptr_is_owned(this_ptr)) return;
24606         void* this_ptr_ptr = untag_ptr(this_ptr);
24607         CHECK_ACCESS(this_ptr_ptr);
24608         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
24609         FREE(untag_ptr(this_ptr));
24610         Logger_free(this_ptr_conv);
24611 }
24612
24613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24614         LDKChannelHandshakeConfig this_obj_conv;
24615         this_obj_conv.inner = untag_ptr(this_obj);
24616         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24618         ChannelHandshakeConfig_free(this_obj_conv);
24619 }
24620
24621 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24622         LDKChannelHandshakeConfig this_ptr_conv;
24623         this_ptr_conv.inner = untag_ptr(this_ptr);
24624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24626         this_ptr_conv.is_owned = false;
24627         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
24628         return ret_conv;
24629 }
24630
24631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24632         LDKChannelHandshakeConfig this_ptr_conv;
24633         this_ptr_conv.inner = untag_ptr(this_ptr);
24634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24636         this_ptr_conv.is_owned = false;
24637         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
24638 }
24639
24640 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24641         LDKChannelHandshakeConfig this_ptr_conv;
24642         this_ptr_conv.inner = untag_ptr(this_ptr);
24643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24645         this_ptr_conv.is_owned = false;
24646         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
24647         return ret_conv;
24648 }
24649
24650 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) {
24651         LDKChannelHandshakeConfig this_ptr_conv;
24652         this_ptr_conv.inner = untag_ptr(this_ptr);
24653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24655         this_ptr_conv.is_owned = false;
24656         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
24657 }
24658
24659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24660         LDKChannelHandshakeConfig this_ptr_conv;
24661         this_ptr_conv.inner = untag_ptr(this_ptr);
24662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24664         this_ptr_conv.is_owned = false;
24665         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
24666         return ret_conv;
24667 }
24668
24669 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) {
24670         LDKChannelHandshakeConfig this_ptr_conv;
24671         this_ptr_conv.inner = untag_ptr(this_ptr);
24672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24674         this_ptr_conv.is_owned = false;
24675         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
24676 }
24677
24678 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) {
24679         LDKChannelHandshakeConfig this_ptr_conv;
24680         this_ptr_conv.inner = untag_ptr(this_ptr);
24681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24683         this_ptr_conv.is_owned = false;
24684         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
24685         return ret_conv;
24686 }
24687
24688 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) {
24689         LDKChannelHandshakeConfig this_ptr_conv;
24690         this_ptr_conv.inner = untag_ptr(this_ptr);
24691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24693         this_ptr_conv.is_owned = false;
24694         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
24695 }
24696
24697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
24698         LDKChannelHandshakeConfig this_ptr_conv;
24699         this_ptr_conv.inner = untag_ptr(this_ptr);
24700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24702         this_ptr_conv.is_owned = false;
24703         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
24704         return ret_conv;
24705 }
24706
24707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24708         LDKChannelHandshakeConfig this_ptr_conv;
24709         this_ptr_conv.inner = untag_ptr(this_ptr);
24710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24712         this_ptr_conv.is_owned = false;
24713         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
24714 }
24715
24716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
24717         LDKChannelHandshakeConfig this_ptr_conv;
24718         this_ptr_conv.inner = untag_ptr(this_ptr);
24719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24721         this_ptr_conv.is_owned = false;
24722         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
24723         return ret_conv;
24724 }
24725
24726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24727         LDKChannelHandshakeConfig this_ptr_conv;
24728         this_ptr_conv.inner = untag_ptr(this_ptr);
24729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24731         this_ptr_conv.is_owned = false;
24732         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
24733 }
24734
24735 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24736         LDKChannelHandshakeConfig this_ptr_conv;
24737         this_ptr_conv.inner = untag_ptr(this_ptr);
24738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24740         this_ptr_conv.is_owned = false;
24741         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
24742         return ret_conv;
24743 }
24744
24745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24746         LDKChannelHandshakeConfig this_ptr_conv;
24747         this_ptr_conv.inner = untag_ptr(this_ptr);
24748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24750         this_ptr_conv.is_owned = false;
24751         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
24752 }
24753
24754 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) {
24755         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);
24756         int64_t ret_ref = 0;
24757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24759         return ret_ref;
24760 }
24761
24762 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
24763         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
24764         int64_t ret_ref = 0;
24765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24767         return ret_ref;
24768 }
24769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24770         LDKChannelHandshakeConfig arg_conv;
24771         arg_conv.inner = untag_ptr(arg);
24772         arg_conv.is_owned = ptr_is_owned(arg);
24773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24774         arg_conv.is_owned = false;
24775         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
24776         return ret_conv;
24777 }
24778
24779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24780         LDKChannelHandshakeConfig orig_conv;
24781         orig_conv.inner = untag_ptr(orig);
24782         orig_conv.is_owned = ptr_is_owned(orig);
24783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24784         orig_conv.is_owned = false;
24785         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
24786         int64_t ret_ref = 0;
24787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24789         return ret_ref;
24790 }
24791
24792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
24793         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
24794         int64_t ret_ref = 0;
24795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24797         return ret_ref;
24798 }
24799
24800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24801         LDKChannelHandshakeLimits this_obj_conv;
24802         this_obj_conv.inner = untag_ptr(this_obj);
24803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24805         ChannelHandshakeLimits_free(this_obj_conv);
24806 }
24807
24808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24809         LDKChannelHandshakeLimits this_ptr_conv;
24810         this_ptr_conv.inner = untag_ptr(this_ptr);
24811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24813         this_ptr_conv.is_owned = false;
24814         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
24815         return ret_conv;
24816 }
24817
24818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24819         LDKChannelHandshakeLimits this_ptr_conv;
24820         this_ptr_conv.inner = untag_ptr(this_ptr);
24821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24823         this_ptr_conv.is_owned = false;
24824         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
24825 }
24826
24827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24828         LDKChannelHandshakeLimits this_ptr_conv;
24829         this_ptr_conv.inner = untag_ptr(this_ptr);
24830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24832         this_ptr_conv.is_owned = false;
24833         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
24834         return ret_conv;
24835 }
24836
24837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24838         LDKChannelHandshakeLimits this_ptr_conv;
24839         this_ptr_conv.inner = untag_ptr(this_ptr);
24840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24842         this_ptr_conv.is_owned = false;
24843         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
24844 }
24845
24846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24847         LDKChannelHandshakeLimits this_ptr_conv;
24848         this_ptr_conv.inner = untag_ptr(this_ptr);
24849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24851         this_ptr_conv.is_owned = false;
24852         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
24853         return ret_conv;
24854 }
24855
24856 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) {
24857         LDKChannelHandshakeLimits this_ptr_conv;
24858         this_ptr_conv.inner = untag_ptr(this_ptr);
24859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24861         this_ptr_conv.is_owned = false;
24862         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
24863 }
24864
24865 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) {
24866         LDKChannelHandshakeLimits this_ptr_conv;
24867         this_ptr_conv.inner = untag_ptr(this_ptr);
24868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24870         this_ptr_conv.is_owned = false;
24871         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
24872         return ret_conv;
24873 }
24874
24875 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) {
24876         LDKChannelHandshakeLimits this_ptr_conv;
24877         this_ptr_conv.inner = untag_ptr(this_ptr);
24878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24880         this_ptr_conv.is_owned = false;
24881         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
24882 }
24883
24884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24885         LDKChannelHandshakeLimits this_ptr_conv;
24886         this_ptr_conv.inner = untag_ptr(this_ptr);
24887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24889         this_ptr_conv.is_owned = false;
24890         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
24891         return ret_conv;
24892 }
24893
24894 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) {
24895         LDKChannelHandshakeLimits this_ptr_conv;
24896         this_ptr_conv.inner = untag_ptr(this_ptr);
24897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24899         this_ptr_conv.is_owned = false;
24900         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
24901 }
24902
24903 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24904         LDKChannelHandshakeLimits this_ptr_conv;
24905         this_ptr_conv.inner = untag_ptr(this_ptr);
24906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24908         this_ptr_conv.is_owned = false;
24909         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
24910         return ret_conv;
24911 }
24912
24913 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) {
24914         LDKChannelHandshakeLimits this_ptr_conv;
24915         this_ptr_conv.inner = untag_ptr(this_ptr);
24916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24918         this_ptr_conv.is_owned = false;
24919         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
24920 }
24921
24922 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24923         LDKChannelHandshakeLimits this_ptr_conv;
24924         this_ptr_conv.inner = untag_ptr(this_ptr);
24925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24927         this_ptr_conv.is_owned = false;
24928         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
24929         return ret_conv;
24930 }
24931
24932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24933         LDKChannelHandshakeLimits this_ptr_conv;
24934         this_ptr_conv.inner = untag_ptr(this_ptr);
24935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24937         this_ptr_conv.is_owned = false;
24938         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
24939 }
24940
24941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
24942         LDKChannelHandshakeLimits this_ptr_conv;
24943         this_ptr_conv.inner = untag_ptr(this_ptr);
24944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24946         this_ptr_conv.is_owned = false;
24947         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
24948         return ret_conv;
24949 }
24950
24951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24952         LDKChannelHandshakeLimits this_ptr_conv;
24953         this_ptr_conv.inner = untag_ptr(this_ptr);
24954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24956         this_ptr_conv.is_owned = false;
24957         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
24958 }
24959
24960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
24961         LDKChannelHandshakeLimits this_ptr_conv;
24962         this_ptr_conv.inner = untag_ptr(this_ptr);
24963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24965         this_ptr_conv.is_owned = false;
24966         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
24967         return ret_conv;
24968 }
24969
24970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24971         LDKChannelHandshakeLimits this_ptr_conv;
24972         this_ptr_conv.inner = untag_ptr(this_ptr);
24973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24975         this_ptr_conv.is_owned = false;
24976         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
24977 }
24978
24979 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24980         LDKChannelHandshakeLimits this_ptr_conv;
24981         this_ptr_conv.inner = untag_ptr(this_ptr);
24982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24984         this_ptr_conv.is_owned = false;
24985         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
24986         return ret_conv;
24987 }
24988
24989 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) {
24990         LDKChannelHandshakeLimits this_ptr_conv;
24991         this_ptr_conv.inner = untag_ptr(this_ptr);
24992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24994         this_ptr_conv.is_owned = false;
24995         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
24996 }
24997
24998 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) {
24999         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);
25000         int64_t ret_ref = 0;
25001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25003         return ret_ref;
25004 }
25005
25006 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
25007         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
25008         int64_t ret_ref = 0;
25009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25011         return ret_ref;
25012 }
25013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25014         LDKChannelHandshakeLimits arg_conv;
25015         arg_conv.inner = untag_ptr(arg);
25016         arg_conv.is_owned = ptr_is_owned(arg);
25017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25018         arg_conv.is_owned = false;
25019         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
25020         return ret_conv;
25021 }
25022
25023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25024         LDKChannelHandshakeLimits orig_conv;
25025         orig_conv.inner = untag_ptr(orig);
25026         orig_conv.is_owned = ptr_is_owned(orig);
25027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25028         orig_conv.is_owned = false;
25029         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
25030         int64_t ret_ref = 0;
25031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25033         return ret_ref;
25034 }
25035
25036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
25037         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
25038         int64_t ret_ref = 0;
25039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25041         return ret_ref;
25042 }
25043
25044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25045         LDKChannelConfig this_obj_conv;
25046         this_obj_conv.inner = untag_ptr(this_obj);
25047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25049         ChannelConfig_free(this_obj_conv);
25050 }
25051
25052 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
25053         LDKChannelConfig this_ptr_conv;
25054         this_ptr_conv.inner = untag_ptr(this_ptr);
25055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25057         this_ptr_conv.is_owned = false;
25058         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
25059         return ret_conv;
25060 }
25061
25062 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) {
25063         LDKChannelConfig this_ptr_conv;
25064         this_ptr_conv.inner = untag_ptr(this_ptr);
25065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25067         this_ptr_conv.is_owned = false;
25068         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
25069 }
25070
25071 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25072         LDKChannelConfig this_ptr_conv;
25073         this_ptr_conv.inner = untag_ptr(this_ptr);
25074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25076         this_ptr_conv.is_owned = false;
25077         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
25078         return ret_conv;
25079 }
25080
25081 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) {
25082         LDKChannelConfig this_ptr_conv;
25083         this_ptr_conv.inner = untag_ptr(this_ptr);
25084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25086         this_ptr_conv.is_owned = false;
25087         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
25088 }
25089
25090 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
25091         LDKChannelConfig this_ptr_conv;
25092         this_ptr_conv.inner = untag_ptr(this_ptr);
25093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25095         this_ptr_conv.is_owned = false;
25096         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
25097         return ret_conv;
25098 }
25099
25100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25101         LDKChannelConfig this_ptr_conv;
25102         this_ptr_conv.inner = untag_ptr(this_ptr);
25103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25105         this_ptr_conv.is_owned = false;
25106         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
25107 }
25108
25109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25110         LDKChannelConfig this_ptr_conv;
25111         this_ptr_conv.inner = untag_ptr(this_ptr);
25112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25114         this_ptr_conv.is_owned = false;
25115         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
25116         return ret_conv;
25117 }
25118
25119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25120         LDKChannelConfig this_ptr_conv;
25121         this_ptr_conv.inner = untag_ptr(this_ptr);
25122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25124         this_ptr_conv.is_owned = false;
25125         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
25126 }
25127
25128 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) {
25129         LDKChannelConfig this_ptr_conv;
25130         this_ptr_conv.inner = untag_ptr(this_ptr);
25131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25133         this_ptr_conv.is_owned = false;
25134         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
25135         return ret_conv;
25136 }
25137
25138 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) {
25139         LDKChannelConfig this_ptr_conv;
25140         this_ptr_conv.inner = untag_ptr(this_ptr);
25141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25143         this_ptr_conv.is_owned = false;
25144         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
25145 }
25146
25147 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_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
25148         LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
25149         int64_t ret_ref = 0;
25150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25152         return ret_ref;
25153 }
25154
25155 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
25156         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
25157         int64_t ret_ref = 0;
25158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25160         return ret_ref;
25161 }
25162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25163         LDKChannelConfig arg_conv;
25164         arg_conv.inner = untag_ptr(arg);
25165         arg_conv.is_owned = ptr_is_owned(arg);
25166         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25167         arg_conv.is_owned = false;
25168         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
25169         return ret_conv;
25170 }
25171
25172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25173         LDKChannelConfig orig_conv;
25174         orig_conv.inner = untag_ptr(orig);
25175         orig_conv.is_owned = ptr_is_owned(orig);
25176         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25177         orig_conv.is_owned = false;
25178         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
25179         int64_t ret_ref = 0;
25180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25182         return ret_ref;
25183 }
25184
25185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
25186         LDKChannelConfig ret_var = ChannelConfig_default();
25187         int64_t ret_ref = 0;
25188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25190         return ret_ref;
25191 }
25192
25193 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
25194         LDKChannelConfig obj_conv;
25195         obj_conv.inner = untag_ptr(obj);
25196         obj_conv.is_owned = ptr_is_owned(obj);
25197         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25198         obj_conv.is_owned = false;
25199         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
25200         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25201         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25202         CVec_u8Z_free(ret_var);
25203         return ret_arr;
25204 }
25205
25206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25207         LDKu8slice ser_ref;
25208         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25209         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25210         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25211         *ret_conv = ChannelConfig_read(ser_ref);
25212         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25213         return tag_ptr(ret_conv, true);
25214 }
25215
25216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25217         LDKUserConfig this_obj_conv;
25218         this_obj_conv.inner = untag_ptr(this_obj);
25219         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25221         UserConfig_free(this_obj_conv);
25222 }
25223
25224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25225         LDKUserConfig this_ptr_conv;
25226         this_ptr_conv.inner = untag_ptr(this_ptr);
25227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25229         this_ptr_conv.is_owned = false;
25230         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
25231         int64_t ret_ref = 0;
25232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25234         return ret_ref;
25235 }
25236
25237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25238         LDKUserConfig this_ptr_conv;
25239         this_ptr_conv.inner = untag_ptr(this_ptr);
25240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25242         this_ptr_conv.is_owned = false;
25243         LDKChannelHandshakeConfig val_conv;
25244         val_conv.inner = untag_ptr(val);
25245         val_conv.is_owned = ptr_is_owned(val);
25246         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25247         val_conv = ChannelHandshakeConfig_clone(&val_conv);
25248         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
25249 }
25250
25251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
25252         LDKUserConfig this_ptr_conv;
25253         this_ptr_conv.inner = untag_ptr(this_ptr);
25254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25256         this_ptr_conv.is_owned = false;
25257         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
25258         int64_t ret_ref = 0;
25259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25261         return ret_ref;
25262 }
25263
25264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25265         LDKUserConfig this_ptr_conv;
25266         this_ptr_conv.inner = untag_ptr(this_ptr);
25267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25269         this_ptr_conv.is_owned = false;
25270         LDKChannelHandshakeLimits val_conv;
25271         val_conv.inner = untag_ptr(val);
25272         val_conv.is_owned = ptr_is_owned(val);
25273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25274         val_conv = ChannelHandshakeLimits_clone(&val_conv);
25275         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
25276 }
25277
25278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25279         LDKUserConfig this_ptr_conv;
25280         this_ptr_conv.inner = untag_ptr(this_ptr);
25281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25283         this_ptr_conv.is_owned = false;
25284         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
25285         int64_t ret_ref = 0;
25286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25288         return ret_ref;
25289 }
25290
25291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25292         LDKUserConfig this_ptr_conv;
25293         this_ptr_conv.inner = untag_ptr(this_ptr);
25294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25296         this_ptr_conv.is_owned = false;
25297         LDKChannelConfig val_conv;
25298         val_conv.inner = untag_ptr(val);
25299         val_conv.is_owned = ptr_is_owned(val);
25300         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25301         val_conv = ChannelConfig_clone(&val_conv);
25302         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
25303 }
25304
25305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25306         LDKUserConfig this_ptr_conv;
25307         this_ptr_conv.inner = untag_ptr(this_ptr);
25308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25310         this_ptr_conv.is_owned = false;
25311         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
25312         return ret_conv;
25313 }
25314
25315 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) {
25316         LDKUserConfig this_ptr_conv;
25317         this_ptr_conv.inner = untag_ptr(this_ptr);
25318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25320         this_ptr_conv.is_owned = false;
25321         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
25322 }
25323
25324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25325         LDKUserConfig this_ptr_conv;
25326         this_ptr_conv.inner = untag_ptr(this_ptr);
25327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25329         this_ptr_conv.is_owned = false;
25330         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
25331         return ret_conv;
25332 }
25333
25334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25335         LDKUserConfig this_ptr_conv;
25336         this_ptr_conv.inner = untag_ptr(this_ptr);
25337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25339         this_ptr_conv.is_owned = false;
25340         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
25341 }
25342
25343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25344         LDKUserConfig this_ptr_conv;
25345         this_ptr_conv.inner = untag_ptr(this_ptr);
25346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25348         this_ptr_conv.is_owned = false;
25349         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
25350         return ret_conv;
25351 }
25352
25353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25354         LDKUserConfig this_ptr_conv;
25355         this_ptr_conv.inner = untag_ptr(this_ptr);
25356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25358         this_ptr_conv.is_owned = false;
25359         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
25360 }
25361
25362 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) {
25363         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
25364         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
25365         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
25366         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
25367         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
25368         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
25369         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
25370         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
25371         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
25372         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
25373         LDKChannelConfig channel_config_arg_conv;
25374         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
25375         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
25376         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
25377         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
25378         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);
25379         int64_t ret_ref = 0;
25380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25382         return ret_ref;
25383 }
25384
25385 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
25386         LDKUserConfig ret_var = UserConfig_clone(arg);
25387         int64_t ret_ref = 0;
25388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25390         return ret_ref;
25391 }
25392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25393         LDKUserConfig arg_conv;
25394         arg_conv.inner = untag_ptr(arg);
25395         arg_conv.is_owned = ptr_is_owned(arg);
25396         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25397         arg_conv.is_owned = false;
25398         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
25399         return ret_conv;
25400 }
25401
25402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25403         LDKUserConfig orig_conv;
25404         orig_conv.inner = untag_ptr(orig);
25405         orig_conv.is_owned = ptr_is_owned(orig);
25406         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25407         orig_conv.is_owned = false;
25408         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
25409         int64_t ret_ref = 0;
25410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25412         return ret_ref;
25413 }
25414
25415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
25416         LDKUserConfig ret_var = UserConfig_default();
25417         int64_t ret_ref = 0;
25418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25420         return ret_ref;
25421 }
25422
25423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25424         LDKBestBlock this_obj_conv;
25425         this_obj_conv.inner = untag_ptr(this_obj);
25426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25428         BestBlock_free(this_obj_conv);
25429 }
25430
25431 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
25432         LDKBestBlock ret_var = BestBlock_clone(arg);
25433         int64_t ret_ref = 0;
25434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25436         return ret_ref;
25437 }
25438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25439         LDKBestBlock arg_conv;
25440         arg_conv.inner = untag_ptr(arg);
25441         arg_conv.is_owned = ptr_is_owned(arg);
25442         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25443         arg_conv.is_owned = false;
25444         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
25445         return ret_conv;
25446 }
25447
25448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25449         LDKBestBlock orig_conv;
25450         orig_conv.inner = untag_ptr(orig);
25451         orig_conv.is_owned = ptr_is_owned(orig);
25452         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25453         orig_conv.is_owned = false;
25454         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
25455         int64_t ret_ref = 0;
25456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25458         return ret_ref;
25459 }
25460
25461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
25462         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
25463         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
25464         int64_t ret_ref = 0;
25465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25467         return ret_ref;
25468 }
25469
25470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
25471         LDKThirtyTwoBytes block_hash_ref;
25472         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
25473         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
25474         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
25475         int64_t ret_ref = 0;
25476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25478         return ret_ref;
25479 }
25480
25481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25482         LDKBestBlock this_arg_conv;
25483         this_arg_conv.inner = untag_ptr(this_arg);
25484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25486         this_arg_conv.is_owned = false;
25487         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25488         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
25489         return ret_arr;
25490 }
25491
25492 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
25493         LDKBestBlock this_arg_conv;
25494         this_arg_conv.inner = untag_ptr(this_arg);
25495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25497         this_arg_conv.is_owned = false;
25498         int32_t ret_conv = BestBlock_height(&this_arg_conv);
25499         return ret_conv;
25500 }
25501
25502 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25503         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
25504         jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
25505         return ret_conv;
25506 }
25507
25508 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
25509         jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
25510         return ret_conv;
25511 }
25512
25513 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
25514         jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
25515         return ret_conv;
25516 }
25517
25518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25519         if (!ptr_is_owned(this_ptr)) return;
25520         void* this_ptr_ptr = untag_ptr(this_ptr);
25521         CHECK_ACCESS(this_ptr_ptr);
25522         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
25523         FREE(untag_ptr(this_ptr));
25524         Access_free(this_ptr_conv);
25525 }
25526
25527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25528         if (!ptr_is_owned(this_ptr)) return;
25529         void* this_ptr_ptr = untag_ptr(this_ptr);
25530         CHECK_ACCESS(this_ptr_ptr);
25531         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
25532         FREE(untag_ptr(this_ptr));
25533         Listen_free(this_ptr_conv);
25534 }
25535
25536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25537         if (!ptr_is_owned(this_ptr)) return;
25538         void* this_ptr_ptr = untag_ptr(this_ptr);
25539         CHECK_ACCESS(this_ptr_ptr);
25540         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
25541         FREE(untag_ptr(this_ptr));
25542         Confirm_free(this_ptr_conv);
25543 }
25544
25545 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25546         LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)untag_ptr(orig);
25547         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
25548         return ret_conv;
25549 }
25550
25551 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
25552         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
25553         return ret_conv;
25554 }
25555
25556 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
25557         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
25558         return ret_conv;
25559 }
25560
25561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25562         if (!ptr_is_owned(this_ptr)) return;
25563         void* this_ptr_ptr = untag_ptr(this_ptr);
25564         CHECK_ACCESS(this_ptr_ptr);
25565         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
25566         FREE(untag_ptr(this_ptr));
25567         Watch_free(this_ptr_conv);
25568 }
25569
25570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25571         if (!ptr_is_owned(this_ptr)) return;
25572         void* this_ptr_ptr = untag_ptr(this_ptr);
25573         CHECK_ACCESS(this_ptr_ptr);
25574         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
25575         FREE(untag_ptr(this_ptr));
25576         Filter_free(this_ptr_conv);
25577 }
25578
25579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25580         LDKWatchedOutput this_obj_conv;
25581         this_obj_conv.inner = untag_ptr(this_obj);
25582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25584         WatchedOutput_free(this_obj_conv);
25585 }
25586
25587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25588         LDKWatchedOutput this_ptr_conv;
25589         this_ptr_conv.inner = untag_ptr(this_ptr);
25590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25592         this_ptr_conv.is_owned = false;
25593         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25594         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
25595         return ret_arr;
25596 }
25597
25598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25599         LDKWatchedOutput this_ptr_conv;
25600         this_ptr_conv.inner = untag_ptr(this_ptr);
25601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25603         this_ptr_conv.is_owned = false;
25604         LDKThirtyTwoBytes val_ref;
25605         CHECK((*env)->GetArrayLength(env, val) == 32);
25606         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25607         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
25608 }
25609
25610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25611         LDKWatchedOutput this_ptr_conv;
25612         this_ptr_conv.inner = untag_ptr(this_ptr);
25613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25615         this_ptr_conv.is_owned = false;
25616         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
25617         int64_t ret_ref = 0;
25618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25620         return ret_ref;
25621 }
25622
25623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25624         LDKWatchedOutput this_ptr_conv;
25625         this_ptr_conv.inner = untag_ptr(this_ptr);
25626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25628         this_ptr_conv.is_owned = false;
25629         LDKOutPoint val_conv;
25630         val_conv.inner = untag_ptr(val);
25631         val_conv.is_owned = ptr_is_owned(val);
25632         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25633         val_conv = OutPoint_clone(&val_conv);
25634         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
25635 }
25636
25637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25638         LDKWatchedOutput this_ptr_conv;
25639         this_ptr_conv.inner = untag_ptr(this_ptr);
25640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25642         this_ptr_conv.is_owned = false;
25643         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
25644         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25645         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25646         return ret_arr;
25647 }
25648
25649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25650         LDKWatchedOutput this_ptr_conv;
25651         this_ptr_conv.inner = untag_ptr(this_ptr);
25652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25654         this_ptr_conv.is_owned = false;
25655         LDKCVec_u8Z val_ref;
25656         val_ref.datalen = (*env)->GetArrayLength(env, val);
25657         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
25658         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25659         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
25660 }
25661
25662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
25663         LDKThirtyTwoBytes block_hash_arg_ref;
25664         CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
25665         (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
25666         LDKOutPoint outpoint_arg_conv;
25667         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25668         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25669         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25670         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25671         LDKCVec_u8Z script_pubkey_arg_ref;
25672         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
25673         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
25674         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
25675         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
25676         int64_t ret_ref = 0;
25677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25679         return ret_ref;
25680 }
25681
25682 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
25683         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
25684         int64_t ret_ref = 0;
25685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25687         return ret_ref;
25688 }
25689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25690         LDKWatchedOutput arg_conv;
25691         arg_conv.inner = untag_ptr(arg);
25692         arg_conv.is_owned = ptr_is_owned(arg);
25693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25694         arg_conv.is_owned = false;
25695         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
25696         return ret_conv;
25697 }
25698
25699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25700         LDKWatchedOutput orig_conv;
25701         orig_conv.inner = untag_ptr(orig);
25702         orig_conv.is_owned = ptr_is_owned(orig);
25703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25704         orig_conv.is_owned = false;
25705         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
25706         int64_t ret_ref = 0;
25707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25709         return ret_ref;
25710 }
25711
25712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
25713         LDKWatchedOutput o_conv;
25714         o_conv.inner = untag_ptr(o);
25715         o_conv.is_owned = ptr_is_owned(o);
25716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25717         o_conv.is_owned = false;
25718         int64_t ret_conv = WatchedOutput_hash(&o_conv);
25719         return ret_conv;
25720 }
25721
25722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25723         if (!ptr_is_owned(this_ptr)) return;
25724         void* this_ptr_ptr = untag_ptr(this_ptr);
25725         CHECK_ACCESS(this_ptr_ptr);
25726         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
25727         FREE(untag_ptr(this_ptr));
25728         BroadcasterInterface_free(this_ptr_conv);
25729 }
25730
25731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25732         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
25733         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
25734         return ret_conv;
25735 }
25736
25737 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
25738         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
25739         return ret_conv;
25740 }
25741
25742 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
25743         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
25744         return ret_conv;
25745 }
25746
25747 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
25748         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
25749         return ret_conv;
25750 }
25751
25752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25753         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
25754         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
25755         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
25756         return ret_conv;
25757 }
25758
25759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25760         if (!ptr_is_owned(this_ptr)) return;
25761         void* this_ptr_ptr = untag_ptr(this_ptr);
25762         CHECK_ACCESS(this_ptr_ptr);
25763         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
25764         FREE(untag_ptr(this_ptr));
25765         FeeEstimator_free(this_ptr_conv);
25766 }
25767
25768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25769         LDKMonitorUpdateId this_obj_conv;
25770         this_obj_conv.inner = untag_ptr(this_obj);
25771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25773         MonitorUpdateId_free(this_obj_conv);
25774 }
25775
25776 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
25777         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
25778         int64_t ret_ref = 0;
25779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25781         return ret_ref;
25782 }
25783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25784         LDKMonitorUpdateId arg_conv;
25785         arg_conv.inner = untag_ptr(arg);
25786         arg_conv.is_owned = ptr_is_owned(arg);
25787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25788         arg_conv.is_owned = false;
25789         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
25790         return ret_conv;
25791 }
25792
25793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25794         LDKMonitorUpdateId orig_conv;
25795         orig_conv.inner = untag_ptr(orig);
25796         orig_conv.is_owned = ptr_is_owned(orig);
25797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25798         orig_conv.is_owned = false;
25799         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
25800         int64_t ret_ref = 0;
25801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25803         return ret_ref;
25804 }
25805
25806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
25807         LDKMonitorUpdateId o_conv;
25808         o_conv.inner = untag_ptr(o);
25809         o_conv.is_owned = ptr_is_owned(o);
25810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25811         o_conv.is_owned = false;
25812         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
25813         return ret_conv;
25814 }
25815
25816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25817         LDKMonitorUpdateId a_conv;
25818         a_conv.inner = untag_ptr(a);
25819         a_conv.is_owned = ptr_is_owned(a);
25820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25821         a_conv.is_owned = false;
25822         LDKMonitorUpdateId b_conv;
25823         b_conv.inner = untag_ptr(b);
25824         b_conv.is_owned = ptr_is_owned(b);
25825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25826         b_conv.is_owned = false;
25827         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
25828         return ret_conv;
25829 }
25830
25831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25832         if (!ptr_is_owned(this_ptr)) return;
25833         void* this_ptr_ptr = untag_ptr(this_ptr);
25834         CHECK_ACCESS(this_ptr_ptr);
25835         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
25836         FREE(untag_ptr(this_ptr));
25837         Persist_free(this_ptr_conv);
25838 }
25839
25840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25841         LDKLockedChannelMonitor this_obj_conv;
25842         this_obj_conv.inner = untag_ptr(this_obj);
25843         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25845         LockedChannelMonitor_free(this_obj_conv);
25846 }
25847
25848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25849         LDKChainMonitor this_obj_conv;
25850         this_obj_conv.inner = untag_ptr(this_obj);
25851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25853         ChainMonitor_free(this_obj_conv);
25854 }
25855
25856 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) {
25857         void* chain_source_ptr = untag_ptr(chain_source);
25858         CHECK_ACCESS(chain_source_ptr);
25859         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
25860         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
25861         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
25862                 // Manually implement clone for Java trait instances
25863                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
25864                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25865                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
25866                 }
25867         }
25868         void* broadcaster_ptr = untag_ptr(broadcaster);
25869         CHECK_ACCESS(broadcaster_ptr);
25870         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25871         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25872                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25873                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25874         }
25875         void* logger_ptr = untag_ptr(logger);
25876         CHECK_ACCESS(logger_ptr);
25877         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25878         if (logger_conv.free == LDKLogger_JCalls_free) {
25879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25880                 LDKLogger_JCalls_cloned(&logger_conv);
25881         }
25882         void* feeest_ptr = untag_ptr(feeest);
25883         CHECK_ACCESS(feeest_ptr);
25884         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
25885         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
25886                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25887                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
25888         }
25889         void* persister_ptr = untag_ptr(persister);
25890         CHECK_ACCESS(persister_ptr);
25891         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
25892         if (persister_conv.free == LDKPersist_JCalls_free) {
25893                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25894                 LDKPersist_JCalls_cloned(&persister_conv);
25895         }
25896         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
25897         int64_t ret_ref = 0;
25898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25900         return ret_ref;
25901 }
25902
25903 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) {
25904         LDKChainMonitor this_arg_conv;
25905         this_arg_conv.inner = untag_ptr(this_arg);
25906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25908         this_arg_conv.is_owned = false;
25909         LDKCVec_ChannelDetailsZ ignored_channels_constr;
25910         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
25911         if (ignored_channels_constr.datalen > 0)
25912                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25913         else
25914                 ignored_channels_constr.data = NULL;
25915         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
25916         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
25917                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
25918                 LDKChannelDetails ignored_channels_conv_16_conv;
25919                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
25920                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
25921                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
25922                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
25923                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
25924         }
25925         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
25926         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
25927         int64_tArray ret_arr = NULL;
25928         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25929         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25930         for (size_t j = 0; j < ret_var.datalen; j++) {
25931                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25932                 *ret_conv_9_copy = ret_var.data[j];
25933                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25934                 ret_arr_ptr[j] = ret_conv_9_ref;
25935         }
25936         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25937         FREE(ret_var.data);
25938         return ret_arr;
25939 }
25940
25941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
25942         LDKChainMonitor this_arg_conv;
25943         this_arg_conv.inner = untag_ptr(this_arg);
25944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25946         this_arg_conv.is_owned = false;
25947         LDKOutPoint funding_txo_conv;
25948         funding_txo_conv.inner = untag_ptr(funding_txo);
25949         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25950         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25951         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25952         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25953         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25954         return tag_ptr(ret_conv, true);
25955 }
25956
25957 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
25958         LDKChainMonitor this_arg_conv;
25959         this_arg_conv.inner = untag_ptr(this_arg);
25960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25962         this_arg_conv.is_owned = false;
25963         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25964         int64_tArray ret_arr = NULL;
25965         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25966         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25967         for (size_t k = 0; k < ret_var.datalen; k++) {
25968                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25969                 int64_t ret_conv_10_ref = 0;
25970                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25971                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
25972                 ret_arr_ptr[k] = ret_conv_10_ref;
25973         }
25974         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25975         FREE(ret_var.data);
25976         return ret_arr;
25977 }
25978
25979 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) {
25980         LDKChainMonitor this_arg_conv;
25981         this_arg_conv.inner = untag_ptr(this_arg);
25982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25984         this_arg_conv.is_owned = false;
25985         LDKOutPoint funding_txo_conv;
25986         funding_txo_conv.inner = untag_ptr(funding_txo);
25987         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25988         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25989         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25990         LDKMonitorUpdateId completed_update_id_conv;
25991         completed_update_id_conv.inner = untag_ptr(completed_update_id);
25992         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
25993         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25994         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25995         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25996         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25997         return tag_ptr(ret_conv, true);
25998 }
25999
26000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
26001         LDKChainMonitor this_arg_conv;
26002         this_arg_conv.inner = untag_ptr(this_arg);
26003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26005         this_arg_conv.is_owned = false;
26006         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26007         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
26008         return tag_ptr(ret_ret, true);
26009 }
26010
26011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
26012         LDKChainMonitor this_arg_conv;
26013         this_arg_conv.inner = untag_ptr(this_arg);
26014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26016         this_arg_conv.is_owned = false;
26017         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26018         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
26019         return tag_ptr(ret_ret, true);
26020 }
26021
26022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26023         LDKChainMonitor this_arg_conv;
26024         this_arg_conv.inner = untag_ptr(this_arg);
26025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26027         this_arg_conv.is_owned = false;
26028         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
26029         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
26030         return tag_ptr(ret_ret, true);
26031 }
26032
26033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
26034         LDKChainMonitor this_arg_conv;
26035         this_arg_conv.inner = untag_ptr(this_arg);
26036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26038         this_arg_conv.is_owned = false;
26039         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26040         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
26041         return tag_ptr(ret_ret, true);
26042 }
26043
26044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26045         LDKChannelMonitorUpdate this_obj_conv;
26046         this_obj_conv.inner = untag_ptr(this_obj);
26047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26049         ChannelMonitorUpdate_free(this_obj_conv);
26050 }
26051
26052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26053         LDKChannelMonitorUpdate this_ptr_conv;
26054         this_ptr_conv.inner = untag_ptr(this_ptr);
26055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26057         this_ptr_conv.is_owned = false;
26058         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
26059         return ret_conv;
26060 }
26061
26062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26063         LDKChannelMonitorUpdate this_ptr_conv;
26064         this_ptr_conv.inner = untag_ptr(this_ptr);
26065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26067         this_ptr_conv.is_owned = false;
26068         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
26069 }
26070
26071 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
26072         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
26073         int64_t ret_ref = 0;
26074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26076         return ret_ref;
26077 }
26078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26079         LDKChannelMonitorUpdate arg_conv;
26080         arg_conv.inner = untag_ptr(arg);
26081         arg_conv.is_owned = ptr_is_owned(arg);
26082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26083         arg_conv.is_owned = false;
26084         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
26085         return ret_conv;
26086 }
26087
26088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26089         LDKChannelMonitorUpdate orig_conv;
26090         orig_conv.inner = untag_ptr(orig);
26091         orig_conv.is_owned = ptr_is_owned(orig);
26092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26093         orig_conv.is_owned = false;
26094         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
26095         int64_t ret_ref = 0;
26096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26098         return ret_ref;
26099 }
26100
26101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26102         LDKChannelMonitorUpdate obj_conv;
26103         obj_conv.inner = untag_ptr(obj);
26104         obj_conv.is_owned = ptr_is_owned(obj);
26105         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26106         obj_conv.is_owned = false;
26107         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
26108         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26109         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26110         CVec_u8Z_free(ret_var);
26111         return ret_arr;
26112 }
26113
26114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26115         LDKu8slice ser_ref;
26116         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26117         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26118         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26119         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
26120         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26121         return tag_ptr(ret_conv, true);
26122 }
26123
26124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26125         if (!ptr_is_owned(this_ptr)) return;
26126         void* this_ptr_ptr = untag_ptr(this_ptr);
26127         CHECK_ACCESS(this_ptr_ptr);
26128         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
26129         FREE(untag_ptr(this_ptr));
26130         MonitorEvent_free(this_ptr_conv);
26131 }
26132
26133 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
26134         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26135         *ret_copy = MonitorEvent_clone(arg);
26136         int64_t ret_ref = tag_ptr(ret_copy, true);
26137         return ret_ref;
26138 }
26139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26140         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
26141         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
26142         return ret_conv;
26143 }
26144
26145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26146         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
26147         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26148         *ret_copy = MonitorEvent_clone(orig_conv);
26149         int64_t ret_ref = tag_ptr(ret_copy, true);
26150         return ret_ref;
26151 }
26152
26153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
26154         LDKHTLCUpdate a_conv;
26155         a_conv.inner = untag_ptr(a);
26156         a_conv.is_owned = ptr_is_owned(a);
26157         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26158         a_conv = HTLCUpdate_clone(&a_conv);
26159         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26160         *ret_copy = MonitorEvent_htlcevent(a_conv);
26161         int64_t ret_ref = tag_ptr(ret_copy, true);
26162         return ret_ref;
26163 }
26164
26165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
26166         LDKOutPoint a_conv;
26167         a_conv.inner = untag_ptr(a);
26168         a_conv.is_owned = ptr_is_owned(a);
26169         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26170         a_conv = OutPoint_clone(&a_conv);
26171         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26172         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
26173         int64_t ret_ref = tag_ptr(ret_copy, true);
26174         return ret_ref;
26175 }
26176
26177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
26178         LDKOutPoint funding_txo_conv;
26179         funding_txo_conv.inner = untag_ptr(funding_txo);
26180         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
26181         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
26182         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
26183         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26184         *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
26185         int64_t ret_ref = tag_ptr(ret_copy, true);
26186         return ret_ref;
26187 }
26188
26189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
26190         LDKOutPoint a_conv;
26191         a_conv.inner = untag_ptr(a);
26192         a_conv.is_owned = ptr_is_owned(a);
26193         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26194         a_conv = OutPoint_clone(&a_conv);
26195         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26196         *ret_copy = MonitorEvent_update_failed(a_conv);
26197         int64_t ret_ref = tag_ptr(ret_copy, true);
26198         return ret_ref;
26199 }
26200
26201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
26202         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
26203         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
26204         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26205         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26206         CVec_u8Z_free(ret_var);
26207         return ret_arr;
26208 }
26209
26210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26211         LDKu8slice ser_ref;
26212         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26213         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26214         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26215         *ret_conv = MonitorEvent_read(ser_ref);
26216         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26217         return tag_ptr(ret_conv, true);
26218 }
26219
26220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26221         LDKHTLCUpdate this_obj_conv;
26222         this_obj_conv.inner = untag_ptr(this_obj);
26223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26225         HTLCUpdate_free(this_obj_conv);
26226 }
26227
26228 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
26229         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
26230         int64_t ret_ref = 0;
26231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26233         return ret_ref;
26234 }
26235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26236         LDKHTLCUpdate arg_conv;
26237         arg_conv.inner = untag_ptr(arg);
26238         arg_conv.is_owned = ptr_is_owned(arg);
26239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26240         arg_conv.is_owned = false;
26241         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
26242         return ret_conv;
26243 }
26244
26245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26246         LDKHTLCUpdate orig_conv;
26247         orig_conv.inner = untag_ptr(orig);
26248         orig_conv.is_owned = ptr_is_owned(orig);
26249         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26250         orig_conv.is_owned = false;
26251         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
26252         int64_t ret_ref = 0;
26253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26255         return ret_ref;
26256 }
26257
26258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26259         LDKHTLCUpdate obj_conv;
26260         obj_conv.inner = untag_ptr(obj);
26261         obj_conv.is_owned = ptr_is_owned(obj);
26262         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26263         obj_conv.is_owned = false;
26264         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
26265         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26266         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26267         CVec_u8Z_free(ret_var);
26268         return ret_arr;
26269 }
26270
26271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26272         LDKu8slice ser_ref;
26273         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26274         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26275         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26276         *ret_conv = HTLCUpdate_read(ser_ref);
26277         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26278         return tag_ptr(ret_conv, true);
26279 }
26280
26281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26282         if (!ptr_is_owned(this_ptr)) return;
26283         void* this_ptr_ptr = untag_ptr(this_ptr);
26284         CHECK_ACCESS(this_ptr_ptr);
26285         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
26286         FREE(untag_ptr(this_ptr));
26287         Balance_free(this_ptr_conv);
26288 }
26289
26290 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
26291         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26292         *ret_copy = Balance_clone(arg);
26293         int64_t ret_ref = tag_ptr(ret_copy, true);
26294         return ret_ref;
26295 }
26296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26297         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
26298         int64_t ret_conv = Balance_clone_ptr(arg_conv);
26299         return ret_conv;
26300 }
26301
26302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26303         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
26304         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26305         *ret_copy = Balance_clone(orig_conv);
26306         int64_t ret_ref = tag_ptr(ret_copy, true);
26307         return ret_ref;
26308 }
26309
26310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
26311         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26312         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
26313         int64_t ret_ref = tag_ptr(ret_copy, true);
26314         return ret_ref;
26315 }
26316
26317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t confirmation_height) {
26318         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26319         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
26320         int64_t ret_ref = tag_ptr(ret_copy, true);
26321         return ret_ref;
26322 }
26323
26324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t timeout_height) {
26325         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26326         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
26327         int64_t ret_ref = tag_ptr(ret_copy, true);
26328         return ret_ref;
26329 }
26330
26331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
26332         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26333         *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
26334         int64_t ret_ref = tag_ptr(ret_copy, true);
26335         return ret_ref;
26336 }
26337
26338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26339         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
26340         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
26341         jboolean ret_conv = Balance_eq(a_conv, b_conv);
26342         return ret_conv;
26343 }
26344
26345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26346         LDKChannelMonitor this_obj_conv;
26347         this_obj_conv.inner = untag_ptr(this_obj);
26348         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26350         ChannelMonitor_free(this_obj_conv);
26351 }
26352
26353 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
26354         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
26355         int64_t ret_ref = 0;
26356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26358         return ret_ref;
26359 }
26360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26361         LDKChannelMonitor arg_conv;
26362         arg_conv.inner = untag_ptr(arg);
26363         arg_conv.is_owned = ptr_is_owned(arg);
26364         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26365         arg_conv.is_owned = false;
26366         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
26367         return ret_conv;
26368 }
26369
26370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26371         LDKChannelMonitor orig_conv;
26372         orig_conv.inner = untag_ptr(orig);
26373         orig_conv.is_owned = ptr_is_owned(orig);
26374         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26375         orig_conv.is_owned = false;
26376         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
26377         int64_t ret_ref = 0;
26378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26380         return ret_ref;
26381 }
26382
26383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26384         LDKChannelMonitor obj_conv;
26385         obj_conv.inner = untag_ptr(obj);
26386         obj_conv.is_owned = ptr_is_owned(obj);
26387         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26388         obj_conv.is_owned = false;
26389         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
26390         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26391         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26392         CVec_u8Z_free(ret_var);
26393         return ret_arr;
26394 }
26395
26396 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) {
26397         LDKChannelMonitor this_arg_conv;
26398         this_arg_conv.inner = untag_ptr(this_arg);
26399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26401         this_arg_conv.is_owned = false;
26402         LDKChannelMonitorUpdate updates_conv;
26403         updates_conv.inner = untag_ptr(updates);
26404         updates_conv.is_owned = ptr_is_owned(updates);
26405         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
26406         updates_conv.is_owned = false;
26407         void* broadcaster_ptr = untag_ptr(broadcaster);
26408         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
26409         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
26410         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26411         CHECK_ACCESS(fee_estimator_ptr);
26412         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26413         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26414                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26415                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26416         }
26417         void* logger_ptr = untag_ptr(logger);
26418         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
26419         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26420         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
26421         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
26422         return tag_ptr(ret_conv, true);
26423 }
26424
26425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26426         LDKChannelMonitor this_arg_conv;
26427         this_arg_conv.inner = untag_ptr(this_arg);
26428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26430         this_arg_conv.is_owned = false;
26431         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
26432         return ret_conv;
26433 }
26434
26435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
26436         LDKChannelMonitor this_arg_conv;
26437         this_arg_conv.inner = untag_ptr(this_arg);
26438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26440         this_arg_conv.is_owned = false;
26441         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
26442         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
26443         return tag_ptr(ret_conv, true);
26444 }
26445
26446 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26447         LDKChannelMonitor this_arg_conv;
26448         this_arg_conv.inner = untag_ptr(this_arg);
26449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26451         this_arg_conv.is_owned = false;
26452         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
26453         int64_tArray ret_arr = NULL;
26454         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26455         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26456         for (size_t o = 0; o < ret_var.datalen; o++) {
26457                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
26458                 *ret_conv_40_conv = ret_var.data[o];
26459                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
26460         }
26461         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26462         FREE(ret_var.data);
26463         return ret_arr;
26464 }
26465
26466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
26467         LDKChannelMonitor this_arg_conv;
26468         this_arg_conv.inner = untag_ptr(this_arg);
26469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26471         this_arg_conv.is_owned = false;
26472         void* filter_ptr = untag_ptr(filter);
26473         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
26474         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
26475         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
26476 }
26477
26478 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26479         LDKChannelMonitor this_arg_conv;
26480         this_arg_conv.inner = untag_ptr(this_arg);
26481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26483         this_arg_conv.is_owned = false;
26484         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
26485         int64_tArray ret_arr = NULL;
26486         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26487         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26488         for (size_t o = 0; o < ret_var.datalen; o++) {
26489                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26490                 *ret_conv_14_copy = ret_var.data[o];
26491                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
26492                 ret_arr_ptr[o] = ret_conv_14_ref;
26493         }
26494         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26495         FREE(ret_var.data);
26496         return ret_arr;
26497 }
26498
26499 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26500         LDKChannelMonitor this_arg_conv;
26501         this_arg_conv.inner = untag_ptr(this_arg);
26502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26504         this_arg_conv.is_owned = false;
26505         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
26506         int64_tArray ret_arr = NULL;
26507         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26508         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26509         for (size_t h = 0; h < ret_var.datalen; h++) {
26510                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26511                 *ret_conv_7_copy = ret_var.data[h];
26512                 int64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
26513                 ret_arr_ptr[h] = ret_conv_7_ref;
26514         }
26515         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26516         FREE(ret_var.data);
26517         return ret_arr;
26518 }
26519
26520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26521         LDKChannelMonitor this_arg_conv;
26522         this_arg_conv.inner = untag_ptr(this_arg);
26523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26525         this_arg_conv.is_owned = false;
26526         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26527         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
26528         return ret_arr;
26529 }
26530
26531 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) {
26532         LDKChannelMonitor this_arg_conv;
26533         this_arg_conv.inner = untag_ptr(this_arg);
26534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26536         this_arg_conv.is_owned = false;
26537         void* logger_ptr = untag_ptr(logger);
26538         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
26539         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26540         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
26541         jobjectArray ret_arr = NULL;
26542         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26543         ;
26544         for (size_t i = 0; i < ret_var.datalen; i++) {
26545                 LDKTransaction ret_conv_8_var = ret_var.data[i];
26546                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
26547                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
26548                 Transaction_free(ret_conv_8_var);
26549                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26550         }
26551         
26552         FREE(ret_var.data);
26553         return ret_arr;
26554 }
26555
26556 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) {
26557         LDKChannelMonitor this_arg_conv;
26558         this_arg_conv.inner = untag_ptr(this_arg);
26559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26561         this_arg_conv.is_owned = false;
26562         unsigned char header_arr[80];
26563         CHECK((*env)->GetArrayLength(env, header) == 80);
26564         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26565         unsigned char (*header_ref)[80] = &header_arr;
26566         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26567         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26568         if (txdata_constr.datalen > 0)
26569                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26570         else
26571                 txdata_constr.data = NULL;
26572         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26573         for (size_t c = 0; c < txdata_constr.datalen; c++) {
26574                 int64_t txdata_conv_28 = txdata_vals[c];
26575                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
26576                 CHECK_ACCESS(txdata_conv_28_ptr);
26577                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26578                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
26579                 txdata_constr.data[c] = txdata_conv_28_conv;
26580         }
26581         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26582         void* broadcaster_ptr = untag_ptr(broadcaster);
26583         CHECK_ACCESS(broadcaster_ptr);
26584         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26585         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26586                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26587                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26588         }
26589         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26590         CHECK_ACCESS(fee_estimator_ptr);
26591         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26592         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26593                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26594                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26595         }
26596         void* logger_ptr = untag_ptr(logger);
26597         CHECK_ACCESS(logger_ptr);
26598         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26599         if (logger_conv.free == LDKLogger_JCalls_free) {
26600                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26601                 LDKLogger_JCalls_cloned(&logger_conv);
26602         }
26603         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26604         int64_tArray ret_arr = NULL;
26605         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26606         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26607         for (size_t n = 0; n < ret_var.datalen; n++) {
26608                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26609                 *ret_conv_39_conv = ret_var.data[n];
26610                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26611         }
26612         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26613         FREE(ret_var.data);
26614         return ret_arr;
26615 }
26616
26617 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) {
26618         LDKChannelMonitor this_arg_conv;
26619         this_arg_conv.inner = untag_ptr(this_arg);
26620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26622         this_arg_conv.is_owned = false;
26623         unsigned char header_arr[80];
26624         CHECK((*env)->GetArrayLength(env, header) == 80);
26625         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26626         unsigned char (*header_ref)[80] = &header_arr;
26627         void* broadcaster_ptr = untag_ptr(broadcaster);
26628         CHECK_ACCESS(broadcaster_ptr);
26629         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26630         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26631                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26632                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26633         }
26634         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26635         CHECK_ACCESS(fee_estimator_ptr);
26636         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26637         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26638                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26639                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26640         }
26641         void* logger_ptr = untag_ptr(logger);
26642         CHECK_ACCESS(logger_ptr);
26643         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26644         if (logger_conv.free == LDKLogger_JCalls_free) {
26645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26646                 LDKLogger_JCalls_cloned(&logger_conv);
26647         }
26648         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26649 }
26650
26651 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) {
26652         LDKChannelMonitor this_arg_conv;
26653         this_arg_conv.inner = untag_ptr(this_arg);
26654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26656         this_arg_conv.is_owned = false;
26657         unsigned char header_arr[80];
26658         CHECK((*env)->GetArrayLength(env, header) == 80);
26659         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26660         unsigned char (*header_ref)[80] = &header_arr;
26661         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26662         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26663         if (txdata_constr.datalen > 0)
26664                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26665         else
26666                 txdata_constr.data = NULL;
26667         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26668         for (size_t c = 0; c < txdata_constr.datalen; c++) {
26669                 int64_t txdata_conv_28 = txdata_vals[c];
26670                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
26671                 CHECK_ACCESS(txdata_conv_28_ptr);
26672                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26673                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
26674                 txdata_constr.data[c] = txdata_conv_28_conv;
26675         }
26676         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26677         void* broadcaster_ptr = untag_ptr(broadcaster);
26678         CHECK_ACCESS(broadcaster_ptr);
26679         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26680         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26681                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26682                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26683         }
26684         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26685         CHECK_ACCESS(fee_estimator_ptr);
26686         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26687         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26688                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26689                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26690         }
26691         void* logger_ptr = untag_ptr(logger);
26692         CHECK_ACCESS(logger_ptr);
26693         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26694         if (logger_conv.free == LDKLogger_JCalls_free) {
26695                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26696                 LDKLogger_JCalls_cloned(&logger_conv);
26697         }
26698         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26699         int64_tArray ret_arr = NULL;
26700         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26701         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26702         for (size_t n = 0; n < ret_var.datalen; n++) {
26703                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26704                 *ret_conv_39_conv = ret_var.data[n];
26705                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26706         }
26707         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26708         FREE(ret_var.data);
26709         return ret_arr;
26710 }
26711
26712 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) {
26713         LDKChannelMonitor this_arg_conv;
26714         this_arg_conv.inner = untag_ptr(this_arg);
26715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26717         this_arg_conv.is_owned = false;
26718         unsigned char txid_arr[32];
26719         CHECK((*env)->GetArrayLength(env, txid) == 32);
26720         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
26721         unsigned char (*txid_ref)[32] = &txid_arr;
26722         void* broadcaster_ptr = untag_ptr(broadcaster);
26723         CHECK_ACCESS(broadcaster_ptr);
26724         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26725         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26726                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26727                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26728         }
26729         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26730         CHECK_ACCESS(fee_estimator_ptr);
26731         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26732         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26733                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26734                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26735         }
26736         void* logger_ptr = untag_ptr(logger);
26737         CHECK_ACCESS(logger_ptr);
26738         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26739         if (logger_conv.free == LDKLogger_JCalls_free) {
26740                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26741                 LDKLogger_JCalls_cloned(&logger_conv);
26742         }
26743         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
26744 }
26745
26746 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) {
26747         LDKChannelMonitor this_arg_conv;
26748         this_arg_conv.inner = untag_ptr(this_arg);
26749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26751         this_arg_conv.is_owned = false;
26752         unsigned char header_arr[80];
26753         CHECK((*env)->GetArrayLength(env, header) == 80);
26754         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26755         unsigned char (*header_ref)[80] = &header_arr;
26756         void* broadcaster_ptr = untag_ptr(broadcaster);
26757         CHECK_ACCESS(broadcaster_ptr);
26758         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26759         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26760                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26761                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26762         }
26763         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26764         CHECK_ACCESS(fee_estimator_ptr);
26765         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26766         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26767                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26768                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26769         }
26770         void* logger_ptr = untag_ptr(logger);
26771         CHECK_ACCESS(logger_ptr);
26772         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26773         if (logger_conv.free == LDKLogger_JCalls_free) {
26774                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26775                 LDKLogger_JCalls_cloned(&logger_conv);
26776         }
26777         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26778         int64_tArray ret_arr = NULL;
26779         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26780         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26781         for (size_t n = 0; n < ret_var.datalen; n++) {
26782                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26783                 *ret_conv_39_conv = ret_var.data[n];
26784                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26785         }
26786         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26787         FREE(ret_var.data);
26788         return ret_arr;
26789 }
26790
26791 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
26792         LDKChannelMonitor this_arg_conv;
26793         this_arg_conv.inner = untag_ptr(this_arg);
26794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26796         this_arg_conv.is_owned = false;
26797         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
26798         jobjectArray ret_arr = NULL;
26799         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26800         ;
26801         for (size_t i = 0; i < ret_var.datalen; i++) {
26802                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
26803                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
26804                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26805         }
26806         
26807         FREE(ret_var.data);
26808         return ret_arr;
26809 }
26810
26811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
26812         LDKChannelMonitor this_arg_conv;
26813         this_arg_conv.inner = untag_ptr(this_arg);
26814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26816         this_arg_conv.is_owned = false;
26817         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
26818         int64_t ret_ref = 0;
26819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26821         return ret_ref;
26822 }
26823
26824 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
26825         LDKChannelMonitor this_arg_conv;
26826         this_arg_conv.inner = untag_ptr(this_arg);
26827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26829         this_arg_conv.is_owned = false;
26830         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
26831         int64_tArray ret_arr = NULL;
26832         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26833         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26834         for (size_t j = 0; j < ret_var.datalen; j++) {
26835                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26836                 *ret_conv_9_copy = ret_var.data[j];
26837                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
26838                 ret_arr_ptr[j] = ret_conv_9_ref;
26839         }
26840         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26841         FREE(ret_var.data);
26842         return ret_arr;
26843 }
26844
26845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
26846         LDKu8slice ser_ref;
26847         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26848         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26849         void* arg_ptr = untag_ptr(arg);
26850         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26851         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
26852         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
26853         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
26854         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26855         return tag_ptr(ret_conv, true);
26856 }
26857
26858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26859         LDKOutPoint this_obj_conv;
26860         this_obj_conv.inner = untag_ptr(this_obj);
26861         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26863         OutPoint_free(this_obj_conv);
26864 }
26865
26866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
26867         LDKOutPoint this_ptr_conv;
26868         this_ptr_conv.inner = untag_ptr(this_ptr);
26869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26871         this_ptr_conv.is_owned = false;
26872         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26873         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
26874         return ret_arr;
26875 }
26876
26877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26878         LDKOutPoint this_ptr_conv;
26879         this_ptr_conv.inner = untag_ptr(this_ptr);
26880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26882         this_ptr_conv.is_owned = false;
26883         LDKThirtyTwoBytes val_ref;
26884         CHECK((*env)->GetArrayLength(env, val) == 32);
26885         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26886         OutPoint_set_txid(&this_ptr_conv, val_ref);
26887 }
26888
26889 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
26890         LDKOutPoint this_ptr_conv;
26891         this_ptr_conv.inner = untag_ptr(this_ptr);
26892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26894         this_ptr_conv.is_owned = false;
26895         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
26896         return ret_conv;
26897 }
26898
26899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26900         LDKOutPoint this_ptr_conv;
26901         this_ptr_conv.inner = untag_ptr(this_ptr);
26902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26904         this_ptr_conv.is_owned = false;
26905         OutPoint_set_index(&this_ptr_conv, val);
26906 }
26907
26908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
26909         LDKThirtyTwoBytes txid_arg_ref;
26910         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
26911         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
26912         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
26913         int64_t ret_ref = 0;
26914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26916         return ret_ref;
26917 }
26918
26919 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
26920         LDKOutPoint ret_var = OutPoint_clone(arg);
26921         int64_t ret_ref = 0;
26922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26924         return ret_ref;
26925 }
26926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26927         LDKOutPoint arg_conv;
26928         arg_conv.inner = untag_ptr(arg);
26929         arg_conv.is_owned = ptr_is_owned(arg);
26930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26931         arg_conv.is_owned = false;
26932         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
26933         return ret_conv;
26934 }
26935
26936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26937         LDKOutPoint orig_conv;
26938         orig_conv.inner = untag_ptr(orig);
26939         orig_conv.is_owned = ptr_is_owned(orig);
26940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26941         orig_conv.is_owned = false;
26942         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
26943         int64_t ret_ref = 0;
26944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26946         return ret_ref;
26947 }
26948
26949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26950         LDKOutPoint a_conv;
26951         a_conv.inner = untag_ptr(a);
26952         a_conv.is_owned = ptr_is_owned(a);
26953         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26954         a_conv.is_owned = false;
26955         LDKOutPoint b_conv;
26956         b_conv.inner = untag_ptr(b);
26957         b_conv.is_owned = ptr_is_owned(b);
26958         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26959         b_conv.is_owned = false;
26960         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
26961         return ret_conv;
26962 }
26963
26964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26965         LDKOutPoint o_conv;
26966         o_conv.inner = untag_ptr(o);
26967         o_conv.is_owned = ptr_is_owned(o);
26968         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26969         o_conv.is_owned = false;
26970         int64_t ret_conv = OutPoint_hash(&o_conv);
26971         return ret_conv;
26972 }
26973
26974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26975         LDKOutPoint this_arg_conv;
26976         this_arg_conv.inner = untag_ptr(this_arg);
26977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26979         this_arg_conv.is_owned = false;
26980         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26981         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
26982         return ret_arr;
26983 }
26984
26985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
26986         LDKOutPoint obj_conv;
26987         obj_conv.inner = untag_ptr(obj);
26988         obj_conv.is_owned = ptr_is_owned(obj);
26989         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26990         obj_conv.is_owned = false;
26991         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26992         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26993         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26994         CVec_u8Z_free(ret_var);
26995         return ret_arr;
26996 }
26997
26998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26999         LDKu8slice ser_ref;
27000         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27001         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27002         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27003         *ret_conv = OutPoint_read(ser_ref);
27004         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27005         return tag_ptr(ret_conv, true);
27006 }
27007
27008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27009         LDKDelayedPaymentOutputDescriptor this_obj_conv;
27010         this_obj_conv.inner = untag_ptr(this_obj);
27011         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27013         DelayedPaymentOutputDescriptor_free(this_obj_conv);
27014 }
27015
27016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27017         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27018         this_ptr_conv.inner = untag_ptr(this_ptr);
27019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27021         this_ptr_conv.is_owned = false;
27022         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
27023         int64_t ret_ref = 0;
27024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27026         return ret_ref;
27027 }
27028
27029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27030         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27031         this_ptr_conv.inner = untag_ptr(this_ptr);
27032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27034         this_ptr_conv.is_owned = false;
27035         LDKOutPoint val_conv;
27036         val_conv.inner = untag_ptr(val);
27037         val_conv.is_owned = ptr_is_owned(val);
27038         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27039         val_conv = OutPoint_clone(&val_conv);
27040         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27041 }
27042
27043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27044         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27045         this_ptr_conv.inner = untag_ptr(this_ptr);
27046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27048         this_ptr_conv.is_owned = false;
27049         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27050         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
27051         return ret_arr;
27052 }
27053
27054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27055         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27056         this_ptr_conv.inner = untag_ptr(this_ptr);
27057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27059         this_ptr_conv.is_owned = false;
27060         LDKPublicKey val_ref;
27061         CHECK((*env)->GetArrayLength(env, val) == 33);
27062         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27063         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
27064 }
27065
27066 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
27067         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27068         this_ptr_conv.inner = untag_ptr(this_ptr);
27069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27071         this_ptr_conv.is_owned = false;
27072         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
27073         return ret_conv;
27074 }
27075
27076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27077         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27078         this_ptr_conv.inner = untag_ptr(this_ptr);
27079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27081         this_ptr_conv.is_owned = false;
27082         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
27083 }
27084
27085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
27086         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27087         this_ptr_conv.inner = untag_ptr(this_ptr);
27088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27090         this_ptr_conv.is_owned = false;
27091         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
27092         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
27093         return tag_ptr(ret_ref, true);
27094 }
27095
27096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27097         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27098         this_ptr_conv.inner = untag_ptr(this_ptr);
27099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27101         this_ptr_conv.is_owned = false;
27102         void* val_ptr = untag_ptr(val);
27103         CHECK_ACCESS(val_ptr);
27104         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27105         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
27106         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27107 }
27108
27109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
27110         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27111         this_ptr_conv.inner = untag_ptr(this_ptr);
27112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27114         this_ptr_conv.is_owned = false;
27115         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27116         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
27117         return ret_arr;
27118 }
27119
27120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27121         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27122         this_ptr_conv.inner = untag_ptr(this_ptr);
27123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27125         this_ptr_conv.is_owned = false;
27126         LDKPublicKey val_ref;
27127         CHECK((*env)->GetArrayLength(env, val) == 33);
27128         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27129         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
27130 }
27131
27132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27133         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27134         this_ptr_conv.inner = untag_ptr(this_ptr);
27135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27137         this_ptr_conv.is_owned = false;
27138         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27139         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27140         return ret_arr;
27141 }
27142
27143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27144         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27145         this_ptr_conv.inner = untag_ptr(this_ptr);
27146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27148         this_ptr_conv.is_owned = false;
27149         LDKThirtyTwoBytes val_ref;
27150         CHECK((*env)->GetArrayLength(env, val) == 32);
27151         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27152         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27153 }
27154
27155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27156         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27157         this_ptr_conv.inner = untag_ptr(this_ptr);
27158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27160         this_ptr_conv.is_owned = false;
27161         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27162         return ret_conv;
27163 }
27164
27165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27166         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27167         this_ptr_conv.inner = untag_ptr(this_ptr);
27168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27170         this_ptr_conv.is_owned = false;
27171         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27172 }
27173
27174 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) {
27175         LDKOutPoint outpoint_arg_conv;
27176         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
27177         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
27178         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27179         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27180         LDKPublicKey per_commitment_point_arg_ref;
27181         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
27182         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
27183         void* output_arg_ptr = untag_ptr(output_arg);
27184         CHECK_ACCESS(output_arg_ptr);
27185         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27186         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
27187         LDKPublicKey revocation_pubkey_arg_ref;
27188         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
27189         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
27190         LDKThirtyTwoBytes channel_keys_id_arg_ref;
27191         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27192         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27193         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);
27194         int64_t ret_ref = 0;
27195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27197         return ret_ref;
27198 }
27199
27200 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
27201         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
27202         int64_t ret_ref = 0;
27203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27205         return ret_ref;
27206 }
27207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27208         LDKDelayedPaymentOutputDescriptor arg_conv;
27209         arg_conv.inner = untag_ptr(arg);
27210         arg_conv.is_owned = ptr_is_owned(arg);
27211         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27212         arg_conv.is_owned = false;
27213         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
27214         return ret_conv;
27215 }
27216
27217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27218         LDKDelayedPaymentOutputDescriptor orig_conv;
27219         orig_conv.inner = untag_ptr(orig);
27220         orig_conv.is_owned = ptr_is_owned(orig);
27221         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27222         orig_conv.is_owned = false;
27223         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
27224         int64_t ret_ref = 0;
27225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27227         return ret_ref;
27228 }
27229
27230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27231         LDKDelayedPaymentOutputDescriptor obj_conv;
27232         obj_conv.inner = untag_ptr(obj);
27233         obj_conv.is_owned = ptr_is_owned(obj);
27234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27235         obj_conv.is_owned = false;
27236         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
27237         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27238         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27239         CVec_u8Z_free(ret_var);
27240         return ret_arr;
27241 }
27242
27243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27244         LDKu8slice ser_ref;
27245         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27246         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27247         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
27248         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
27249         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27250         return tag_ptr(ret_conv, true);
27251 }
27252
27253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27254         LDKStaticPaymentOutputDescriptor this_obj_conv;
27255         this_obj_conv.inner = untag_ptr(this_obj);
27256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27258         StaticPaymentOutputDescriptor_free(this_obj_conv);
27259 }
27260
27261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27262         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27263         this_ptr_conv.inner = untag_ptr(this_ptr);
27264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27266         this_ptr_conv.is_owned = false;
27267         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
27268         int64_t ret_ref = 0;
27269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27271         return ret_ref;
27272 }
27273
27274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27275         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27276         this_ptr_conv.inner = untag_ptr(this_ptr);
27277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27279         this_ptr_conv.is_owned = false;
27280         LDKOutPoint val_conv;
27281         val_conv.inner = untag_ptr(val);
27282         val_conv.is_owned = ptr_is_owned(val);
27283         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27284         val_conv = OutPoint_clone(&val_conv);
27285         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27286 }
27287
27288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
27289         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27290         this_ptr_conv.inner = untag_ptr(this_ptr);
27291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27293         this_ptr_conv.is_owned = false;
27294         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
27295         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
27296         return tag_ptr(ret_ref, true);
27297 }
27298
27299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27300         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27301         this_ptr_conv.inner = untag_ptr(this_ptr);
27302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27304         this_ptr_conv.is_owned = false;
27305         void* val_ptr = untag_ptr(val);
27306         CHECK_ACCESS(val_ptr);
27307         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27308         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
27309         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27310 }
27311
27312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27313         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27314         this_ptr_conv.inner = untag_ptr(this_ptr);
27315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27317         this_ptr_conv.is_owned = false;
27318         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27319         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27320         return ret_arr;
27321 }
27322
27323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27324         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27325         this_ptr_conv.inner = untag_ptr(this_ptr);
27326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27328         this_ptr_conv.is_owned = false;
27329         LDKThirtyTwoBytes val_ref;
27330         CHECK((*env)->GetArrayLength(env, val) == 32);
27331         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27332         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27333 }
27334
27335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27336         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27337         this_ptr_conv.inner = untag_ptr(this_ptr);
27338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27340         this_ptr_conv.is_owned = false;
27341         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27342         return ret_conv;
27343 }
27344
27345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27346         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27347         this_ptr_conv.inner = untag_ptr(this_ptr);
27348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27350         this_ptr_conv.is_owned = false;
27351         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27352 }
27353
27354 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) {
27355         LDKOutPoint outpoint_arg_conv;
27356         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
27357         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
27358         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27359         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27360         void* output_arg_ptr = untag_ptr(output_arg);
27361         CHECK_ACCESS(output_arg_ptr);
27362         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27363         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
27364         LDKThirtyTwoBytes channel_keys_id_arg_ref;
27365         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27366         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27367         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
27368         int64_t ret_ref = 0;
27369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27371         return ret_ref;
27372 }
27373
27374 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
27375         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
27376         int64_t ret_ref = 0;
27377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27379         return ret_ref;
27380 }
27381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27382         LDKStaticPaymentOutputDescriptor arg_conv;
27383         arg_conv.inner = untag_ptr(arg);
27384         arg_conv.is_owned = ptr_is_owned(arg);
27385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27386         arg_conv.is_owned = false;
27387         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
27388         return ret_conv;
27389 }
27390
27391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27392         LDKStaticPaymentOutputDescriptor orig_conv;
27393         orig_conv.inner = untag_ptr(orig);
27394         orig_conv.is_owned = ptr_is_owned(orig);
27395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27396         orig_conv.is_owned = false;
27397         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
27398         int64_t ret_ref = 0;
27399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27401         return ret_ref;
27402 }
27403
27404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27405         LDKStaticPaymentOutputDescriptor obj_conv;
27406         obj_conv.inner = untag_ptr(obj);
27407         obj_conv.is_owned = ptr_is_owned(obj);
27408         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27409         obj_conv.is_owned = false;
27410         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
27411         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27412         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27413         CVec_u8Z_free(ret_var);
27414         return ret_arr;
27415 }
27416
27417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27418         LDKu8slice ser_ref;
27419         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27420         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27421         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
27422         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
27423         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27424         return tag_ptr(ret_conv, true);
27425 }
27426
27427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27428         if (!ptr_is_owned(this_ptr)) return;
27429         void* this_ptr_ptr = untag_ptr(this_ptr);
27430         CHECK_ACCESS(this_ptr_ptr);
27431         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
27432         FREE(untag_ptr(this_ptr));
27433         SpendableOutputDescriptor_free(this_ptr_conv);
27434 }
27435
27436 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
27437         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27438         *ret_copy = SpendableOutputDescriptor_clone(arg);
27439         int64_t ret_ref = tag_ptr(ret_copy, true);
27440         return ret_ref;
27441 }
27442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27443         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
27444         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
27445         return ret_conv;
27446 }
27447
27448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27449         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
27450         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27451         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
27452         int64_t ret_ref = tag_ptr(ret_copy, true);
27453         return ret_ref;
27454 }
27455
27456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
27457         LDKOutPoint outpoint_conv;
27458         outpoint_conv.inner = untag_ptr(outpoint);
27459         outpoint_conv.is_owned = ptr_is_owned(outpoint);
27460         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
27461         outpoint_conv = OutPoint_clone(&outpoint_conv);
27462         void* output_ptr = untag_ptr(output);
27463         CHECK_ACCESS(output_ptr);
27464         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
27465         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
27466         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27467         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
27468         int64_t ret_ref = tag_ptr(ret_copy, true);
27469         return ret_ref;
27470 }
27471
27472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27473         LDKDelayedPaymentOutputDescriptor a_conv;
27474         a_conv.inner = untag_ptr(a);
27475         a_conv.is_owned = ptr_is_owned(a);
27476         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27477         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
27478         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27479         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
27480         int64_t ret_ref = tag_ptr(ret_copy, true);
27481         return ret_ref;
27482 }
27483
27484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27485         LDKStaticPaymentOutputDescriptor a_conv;
27486         a_conv.inner = untag_ptr(a);
27487         a_conv.is_owned = ptr_is_owned(a);
27488         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27489         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
27490         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27491         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
27492         int64_t ret_ref = tag_ptr(ret_copy, true);
27493         return ret_ref;
27494 }
27495
27496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27497         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
27498         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
27499         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27500         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27501         CVec_u8Z_free(ret_var);
27502         return ret_arr;
27503 }
27504
27505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27506         LDKu8slice ser_ref;
27507         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27508         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27509         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
27510         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
27511         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27512         return tag_ptr(ret_conv, true);
27513 }
27514
27515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27516         if (!ptr_is_owned(this_ptr)) return;
27517         void* this_ptr_ptr = untag_ptr(this_ptr);
27518         CHECK_ACCESS(this_ptr_ptr);
27519         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
27520         FREE(untag_ptr(this_ptr));
27521         BaseSign_free(this_ptr_conv);
27522 }
27523
27524 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
27525         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27526         *ret_ret = Sign_clone(arg);
27527         return tag_ptr(ret_ret, true);
27528 }
27529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27530         void* arg_ptr = untag_ptr(arg);
27531         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
27532         LDKSign* arg_conv = (LDKSign*)arg_ptr;
27533         int64_t ret_conv = Sign_clone_ptr(arg_conv);
27534         return ret_conv;
27535 }
27536
27537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27538         void* orig_ptr = untag_ptr(orig);
27539         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
27540         LDKSign* orig_conv = (LDKSign*)orig_ptr;
27541         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27542         *ret_ret = Sign_clone(orig_conv);
27543         return tag_ptr(ret_ret, true);
27544 }
27545
27546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27547         if (!ptr_is_owned(this_ptr)) return;
27548         void* this_ptr_ptr = untag_ptr(this_ptr);
27549         CHECK_ACCESS(this_ptr_ptr);
27550         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
27551         FREE(untag_ptr(this_ptr));
27552         Sign_free(this_ptr_conv);
27553 }
27554
27555 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27556         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
27557         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
27558         return ret_conv;
27559 }
27560
27561 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
27562         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
27563         return ret_conv;
27564 }
27565
27566 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
27567         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
27568         return ret_conv;
27569 }
27570
27571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27572         if (!ptr_is_owned(this_ptr)) return;
27573         void* this_ptr_ptr = untag_ptr(this_ptr);
27574         CHECK_ACCESS(this_ptr_ptr);
27575         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
27576         FREE(untag_ptr(this_ptr));
27577         KeysInterface_free(this_ptr_conv);
27578 }
27579
27580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27581         LDKInMemorySigner this_obj_conv;
27582         this_obj_conv.inner = untag_ptr(this_obj);
27583         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27585         InMemorySigner_free(this_obj_conv);
27586 }
27587
27588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27589         LDKInMemorySigner this_ptr_conv;
27590         this_ptr_conv.inner = untag_ptr(this_ptr);
27591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27593         this_ptr_conv.is_owned = false;
27594         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27595         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
27596         return ret_arr;
27597 }
27598
27599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27600         LDKInMemorySigner this_ptr_conv;
27601         this_ptr_conv.inner = untag_ptr(this_ptr);
27602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27604         this_ptr_conv.is_owned = false;
27605         LDKSecretKey val_ref;
27606         CHECK((*env)->GetArrayLength(env, val) == 32);
27607         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27608         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
27609 }
27610
27611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27612         LDKInMemorySigner this_ptr_conv;
27613         this_ptr_conv.inner = untag_ptr(this_ptr);
27614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27616         this_ptr_conv.is_owned = false;
27617         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27618         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
27619         return ret_arr;
27620 }
27621
27622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27623         LDKInMemorySigner this_ptr_conv;
27624         this_ptr_conv.inner = untag_ptr(this_ptr);
27625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27627         this_ptr_conv.is_owned = false;
27628         LDKSecretKey val_ref;
27629         CHECK((*env)->GetArrayLength(env, val) == 32);
27630         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27631         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
27632 }
27633
27634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27635         LDKInMemorySigner this_ptr_conv;
27636         this_ptr_conv.inner = untag_ptr(this_ptr);
27637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27639         this_ptr_conv.is_owned = false;
27640         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27641         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
27642         return ret_arr;
27643 }
27644
27645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27646         LDKInMemorySigner this_ptr_conv;
27647         this_ptr_conv.inner = untag_ptr(this_ptr);
27648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27650         this_ptr_conv.is_owned = false;
27651         LDKSecretKey val_ref;
27652         CHECK((*env)->GetArrayLength(env, val) == 32);
27653         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27654         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
27655 }
27656
27657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27658         LDKInMemorySigner this_ptr_conv;
27659         this_ptr_conv.inner = untag_ptr(this_ptr);
27660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27662         this_ptr_conv.is_owned = false;
27663         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27664         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
27665         return ret_arr;
27666 }
27667
27668 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) {
27669         LDKInMemorySigner this_ptr_conv;
27670         this_ptr_conv.inner = untag_ptr(this_ptr);
27671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27673         this_ptr_conv.is_owned = false;
27674         LDKSecretKey val_ref;
27675         CHECK((*env)->GetArrayLength(env, val) == 32);
27676         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27677         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
27678 }
27679
27680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27681         LDKInMemorySigner this_ptr_conv;
27682         this_ptr_conv.inner = untag_ptr(this_ptr);
27683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27685         this_ptr_conv.is_owned = false;
27686         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27687         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
27688         return ret_arr;
27689 }
27690
27691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27692         LDKInMemorySigner this_ptr_conv;
27693         this_ptr_conv.inner = untag_ptr(this_ptr);
27694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27696         this_ptr_conv.is_owned = false;
27697         LDKSecretKey val_ref;
27698         CHECK((*env)->GetArrayLength(env, val) == 32);
27699         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27700         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
27701 }
27702
27703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
27704         LDKInMemorySigner this_ptr_conv;
27705         this_ptr_conv.inner = untag_ptr(this_ptr);
27706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27708         this_ptr_conv.is_owned = false;
27709         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27710         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
27711         return ret_arr;
27712 }
27713
27714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27715         LDKInMemorySigner this_ptr_conv;
27716         this_ptr_conv.inner = untag_ptr(this_ptr);
27717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27719         this_ptr_conv.is_owned = false;
27720         LDKThirtyTwoBytes val_ref;
27721         CHECK((*env)->GetArrayLength(env, val) == 32);
27722         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27723         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
27724 }
27725
27726 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
27727         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
27728         int64_t ret_ref = 0;
27729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27731         return ret_ref;
27732 }
27733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27734         LDKInMemorySigner arg_conv;
27735         arg_conv.inner = untag_ptr(arg);
27736         arg_conv.is_owned = ptr_is_owned(arg);
27737         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27738         arg_conv.is_owned = false;
27739         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
27740         return ret_conv;
27741 }
27742
27743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27744         LDKInMemorySigner orig_conv;
27745         orig_conv.inner = untag_ptr(orig);
27746         orig_conv.is_owned = ptr_is_owned(orig);
27747         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27748         orig_conv.is_owned = false;
27749         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
27750         int64_t ret_ref = 0;
27751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27753         return ret_ref;
27754 }
27755
27756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray node_secret, 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) {
27757         LDKSecretKey node_secret_ref;
27758         CHECK((*env)->GetArrayLength(env, node_secret) == 32);
27759         (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
27760         LDKSecretKey funding_key_ref;
27761         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
27762         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
27763         LDKSecretKey revocation_base_key_ref;
27764         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
27765         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
27766         LDKSecretKey payment_key_ref;
27767         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
27768         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
27769         LDKSecretKey delayed_payment_base_key_ref;
27770         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
27771         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
27772         LDKSecretKey htlc_base_key_ref;
27773         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
27774         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
27775         LDKThirtyTwoBytes commitment_seed_ref;
27776         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
27777         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
27778         LDKThirtyTwoBytes channel_keys_id_ref;
27779         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
27780         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
27781         LDKInMemorySigner ret_var = InMemorySigner_new(node_secret_ref, 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);
27782         int64_t ret_ref = 0;
27783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27785         return ret_ref;
27786 }
27787
27788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
27789         LDKInMemorySigner this_arg_conv;
27790         this_arg_conv.inner = untag_ptr(this_arg);
27791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27793         this_arg_conv.is_owned = false;
27794         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
27795         int64_t ret_ref = 0;
27796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27798         return ret_ref;
27799 }
27800
27801 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27802         LDKInMemorySigner this_arg_conv;
27803         this_arg_conv.inner = untag_ptr(this_arg);
27804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27806         this_arg_conv.is_owned = false;
27807         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
27808         return ret_conv;
27809 }
27810
27811 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27812         LDKInMemorySigner this_arg_conv;
27813         this_arg_conv.inner = untag_ptr(this_arg);
27814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27816         this_arg_conv.is_owned = false;
27817         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
27818         return ret_conv;
27819 }
27820
27821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
27822         LDKInMemorySigner this_arg_conv;
27823         this_arg_conv.inner = untag_ptr(this_arg);
27824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27826         this_arg_conv.is_owned = false;
27827         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
27828         return ret_conv;
27829 }
27830
27831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
27832         LDKInMemorySigner this_arg_conv;
27833         this_arg_conv.inner = untag_ptr(this_arg);
27834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27836         this_arg_conv.is_owned = false;
27837         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
27838         int64_t ret_ref = 0;
27839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27841         return ret_ref;
27842 }
27843
27844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
27845         LDKInMemorySigner this_arg_conv;
27846         this_arg_conv.inner = untag_ptr(this_arg);
27847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27849         this_arg_conv.is_owned = false;
27850         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
27851         int64_t ret_ref = 0;
27852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27854         return ret_ref;
27855 }
27856
27857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
27858         LDKInMemorySigner this_arg_conv;
27859         this_arg_conv.inner = untag_ptr(this_arg);
27860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27862         this_arg_conv.is_owned = false;
27863         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
27864         return ret_conv;
27865 }
27866
27867 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) {
27868         LDKInMemorySigner this_arg_conv;
27869         this_arg_conv.inner = untag_ptr(this_arg);
27870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27872         this_arg_conv.is_owned = false;
27873         LDKTransaction spend_tx_ref;
27874         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27875         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27876         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27877         spend_tx_ref.data_is_owned = true;
27878         LDKStaticPaymentOutputDescriptor descriptor_conv;
27879         descriptor_conv.inner = untag_ptr(descriptor);
27880         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27881         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27882         descriptor_conv.is_owned = false;
27883         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27884         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27885         return tag_ptr(ret_conv, true);
27886 }
27887
27888 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) {
27889         LDKInMemorySigner this_arg_conv;
27890         this_arg_conv.inner = untag_ptr(this_arg);
27891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27893         this_arg_conv.is_owned = false;
27894         LDKTransaction spend_tx_ref;
27895         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27896         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27897         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27898         spend_tx_ref.data_is_owned = true;
27899         LDKDelayedPaymentOutputDescriptor descriptor_conv;
27900         descriptor_conv.inner = untag_ptr(descriptor);
27901         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27902         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27903         descriptor_conv.is_owned = false;
27904         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27905         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27906         return tag_ptr(ret_conv, true);
27907 }
27908
27909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
27910         LDKInMemorySigner this_arg_conv;
27911         this_arg_conv.inner = untag_ptr(this_arg);
27912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27914         this_arg_conv.is_owned = false;
27915         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
27916         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
27917         return tag_ptr(ret_ret, true);
27918 }
27919
27920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
27921         LDKInMemorySigner this_arg_conv;
27922         this_arg_conv.inner = untag_ptr(this_arg);
27923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27925         this_arg_conv.is_owned = false;
27926         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27927         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
27928         return tag_ptr(ret_ret, true);
27929 }
27930
27931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
27932         LDKInMemorySigner obj_conv;
27933         obj_conv.inner = untag_ptr(obj);
27934         obj_conv.is_owned = ptr_is_owned(obj);
27935         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27936         obj_conv.is_owned = false;
27937         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27938         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27939         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27940         CVec_u8Z_free(ret_var);
27941         return ret_arr;
27942 }
27943
27944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
27945         LDKu8slice ser_ref;
27946         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27947         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27948         LDKSecretKey arg_ref;
27949         CHECK((*env)->GetArrayLength(env, arg) == 32);
27950         (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
27951         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27952         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
27953         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27954         return tag_ptr(ret_conv, true);
27955 }
27956
27957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27958         LDKKeysManager this_obj_conv;
27959         this_obj_conv.inner = untag_ptr(this_obj);
27960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27962         KeysManager_free(this_obj_conv);
27963 }
27964
27965 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) {
27966         unsigned char seed_arr[32];
27967         CHECK((*env)->GetArrayLength(env, seed) == 32);
27968         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27969         unsigned char (*seed_ref)[32] = &seed_arr;
27970         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27971         int64_t ret_ref = 0;
27972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27974         return ret_ref;
27975 }
27976
27977 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) {
27978         LDKKeysManager this_arg_conv;
27979         this_arg_conv.inner = untag_ptr(this_arg);
27980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27982         this_arg_conv.is_owned = false;
27983         unsigned char params_arr[32];
27984         CHECK((*env)->GetArrayLength(env, params) == 32);
27985         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27986         unsigned char (*params_ref)[32] = &params_arr;
27987         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27988         int64_t ret_ref = 0;
27989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27991         return ret_ref;
27992 }
27993
27994 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) {
27995         LDKKeysManager this_arg_conv;
27996         this_arg_conv.inner = untag_ptr(this_arg);
27997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27999         this_arg_conv.is_owned = false;
28000         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
28001         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
28002         if (descriptors_constr.datalen > 0)
28003                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
28004         else
28005                 descriptors_constr.data = NULL;
28006         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
28007         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
28008                 int64_t descriptors_conv_27 = descriptors_vals[b];
28009                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
28010                 CHECK_ACCESS(descriptors_conv_27_ptr);
28011                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
28012                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
28013                 descriptors_constr.data[b] = descriptors_conv_27_conv;
28014         }
28015         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
28016         LDKCVec_TxOutZ outputs_constr;
28017         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
28018         if (outputs_constr.datalen > 0)
28019                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
28020         else
28021                 outputs_constr.data = NULL;
28022         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
28023         for (size_t h = 0; h < outputs_constr.datalen; h++) {
28024                 int64_t outputs_conv_7 = outputs_vals[h];
28025                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
28026                 CHECK_ACCESS(outputs_conv_7_ptr);
28027                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
28028                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
28029                 outputs_constr.data[h] = outputs_conv_7_conv;
28030         }
28031         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
28032         LDKCVec_u8Z change_destination_script_ref;
28033         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
28034         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
28035         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
28036         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
28037         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
28038         return tag_ptr(ret_conv, true);
28039 }
28040
28041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
28042         LDKKeysManager this_arg_conv;
28043         this_arg_conv.inner = untag_ptr(this_arg);
28044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28046         this_arg_conv.is_owned = false;
28047         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
28048         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
28049         return tag_ptr(ret_ret, true);
28050 }
28051
28052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28053         LDKPhantomKeysManager this_obj_conv;
28054         this_obj_conv.inner = untag_ptr(this_obj);
28055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28057         PhantomKeysManager_free(this_obj_conv);
28058 }
28059
28060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
28061         LDKPhantomKeysManager this_arg_conv;
28062         this_arg_conv.inner = untag_ptr(this_arg);
28063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28065         this_arg_conv.is_owned = false;
28066         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
28067         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
28068         return tag_ptr(ret_ret, true);
28069 }
28070
28071 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) {
28072         unsigned char seed_arr[32];
28073         CHECK((*env)->GetArrayLength(env, seed) == 32);
28074         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
28075         unsigned char (*seed_ref)[32] = &seed_arr;
28076         unsigned char cross_node_seed_arr[32];
28077         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
28078         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
28079         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
28080         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
28081         int64_t ret_ref = 0;
28082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28084         return ret_ref;
28085 }
28086
28087 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) {
28088         LDKPhantomKeysManager this_arg_conv;
28089         this_arg_conv.inner = untag_ptr(this_arg);
28090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28092         this_arg_conv.is_owned = false;
28093         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
28094         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
28095         if (descriptors_constr.datalen > 0)
28096                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
28097         else
28098                 descriptors_constr.data = NULL;
28099         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
28100         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
28101                 int64_t descriptors_conv_27 = descriptors_vals[b];
28102                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
28103                 CHECK_ACCESS(descriptors_conv_27_ptr);
28104                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
28105                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
28106                 descriptors_constr.data[b] = descriptors_conv_27_conv;
28107         }
28108         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
28109         LDKCVec_TxOutZ outputs_constr;
28110         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
28111         if (outputs_constr.datalen > 0)
28112                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
28113         else
28114                 outputs_constr.data = NULL;
28115         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
28116         for (size_t h = 0; h < outputs_constr.datalen; h++) {
28117                 int64_t outputs_conv_7 = outputs_vals[h];
28118                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
28119                 CHECK_ACCESS(outputs_conv_7_ptr);
28120                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
28121                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
28122                 outputs_constr.data[h] = outputs_conv_7_conv;
28123         }
28124         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
28125         LDKCVec_u8Z change_destination_script_ref;
28126         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
28127         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
28128         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
28129         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
28130         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
28131         return tag_ptr(ret_conv, true);
28132 }
28133
28134 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) {
28135         LDKPhantomKeysManager this_arg_conv;
28136         this_arg_conv.inner = untag_ptr(this_arg);
28137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28139         this_arg_conv.is_owned = false;
28140         unsigned char params_arr[32];
28141         CHECK((*env)->GetArrayLength(env, params) == 32);
28142         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
28143         unsigned char (*params_ref)[32] = &params_arr;
28144         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
28145         int64_t ret_ref = 0;
28146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28148         return ret_ref;
28149 }
28150
28151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28152         LDKChannelManager this_obj_conv;
28153         this_obj_conv.inner = untag_ptr(this_obj);
28154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28156         ChannelManager_free(this_obj_conv);
28157 }
28158
28159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28160         LDKChainParameters this_obj_conv;
28161         this_obj_conv.inner = untag_ptr(this_obj);
28162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28164         ChainParameters_free(this_obj_conv);
28165 }
28166
28167 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
28168         LDKChainParameters this_ptr_conv;
28169         this_ptr_conv.inner = untag_ptr(this_ptr);
28170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28172         this_ptr_conv.is_owned = false;
28173         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
28174         return ret_conv;
28175 }
28176
28177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
28178         LDKChainParameters this_ptr_conv;
28179         this_ptr_conv.inner = untag_ptr(this_ptr);
28180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28182         this_ptr_conv.is_owned = false;
28183         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
28184         ChainParameters_set_network(&this_ptr_conv, val_conv);
28185 }
28186
28187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
28188         LDKChainParameters this_ptr_conv;
28189         this_ptr_conv.inner = untag_ptr(this_ptr);
28190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28192         this_ptr_conv.is_owned = false;
28193         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
28194         int64_t ret_ref = 0;
28195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28197         return ret_ref;
28198 }
28199
28200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28201         LDKChainParameters this_ptr_conv;
28202         this_ptr_conv.inner = untag_ptr(this_ptr);
28203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28205         this_ptr_conv.is_owned = false;
28206         LDKBestBlock val_conv;
28207         val_conv.inner = untag_ptr(val);
28208         val_conv.is_owned = ptr_is_owned(val);
28209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28210         val_conv = BestBlock_clone(&val_conv);
28211         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
28212 }
28213
28214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
28215         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
28216         LDKBestBlock best_block_arg_conv;
28217         best_block_arg_conv.inner = untag_ptr(best_block_arg);
28218         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
28219         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
28220         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
28221         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
28222         int64_t ret_ref = 0;
28223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28225         return ret_ref;
28226 }
28227
28228 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
28229         LDKChainParameters ret_var = ChainParameters_clone(arg);
28230         int64_t ret_ref = 0;
28231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28233         return ret_ref;
28234 }
28235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28236         LDKChainParameters arg_conv;
28237         arg_conv.inner = untag_ptr(arg);
28238         arg_conv.is_owned = ptr_is_owned(arg);
28239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28240         arg_conv.is_owned = false;
28241         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
28242         return ret_conv;
28243 }
28244
28245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28246         LDKChainParameters orig_conv;
28247         orig_conv.inner = untag_ptr(orig);
28248         orig_conv.is_owned = ptr_is_owned(orig);
28249         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28250         orig_conv.is_owned = false;
28251         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
28252         int64_t ret_ref = 0;
28253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28255         return ret_ref;
28256 }
28257
28258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28259         LDKCounterpartyForwardingInfo this_obj_conv;
28260         this_obj_conv.inner = untag_ptr(this_obj);
28261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28263         CounterpartyForwardingInfo_free(this_obj_conv);
28264 }
28265
28266 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28267         LDKCounterpartyForwardingInfo this_ptr_conv;
28268         this_ptr_conv.inner = untag_ptr(this_ptr);
28269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28271         this_ptr_conv.is_owned = false;
28272         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
28273         return ret_conv;
28274 }
28275
28276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28277         LDKCounterpartyForwardingInfo this_ptr_conv;
28278         this_ptr_conv.inner = untag_ptr(this_ptr);
28279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28281         this_ptr_conv.is_owned = false;
28282         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
28283 }
28284
28285 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28286         LDKCounterpartyForwardingInfo this_ptr_conv;
28287         this_ptr_conv.inner = untag_ptr(this_ptr);
28288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28290         this_ptr_conv.is_owned = false;
28291         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
28292         return ret_conv;
28293 }
28294
28295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28296         LDKCounterpartyForwardingInfo this_ptr_conv;
28297         this_ptr_conv.inner = untag_ptr(this_ptr);
28298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28300         this_ptr_conv.is_owned = false;
28301         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
28302 }
28303
28304 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28305         LDKCounterpartyForwardingInfo this_ptr_conv;
28306         this_ptr_conv.inner = untag_ptr(this_ptr);
28307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28309         this_ptr_conv.is_owned = false;
28310         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
28311         return ret_conv;
28312 }
28313
28314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28315         LDKCounterpartyForwardingInfo this_ptr_conv;
28316         this_ptr_conv.inner = untag_ptr(this_ptr);
28317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28319         this_ptr_conv.is_owned = false;
28320         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
28321 }
28322
28323 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) {
28324         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
28325         int64_t ret_ref = 0;
28326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28328         return ret_ref;
28329 }
28330
28331 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
28332         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
28333         int64_t ret_ref = 0;
28334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28336         return ret_ref;
28337 }
28338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28339         LDKCounterpartyForwardingInfo arg_conv;
28340         arg_conv.inner = untag_ptr(arg);
28341         arg_conv.is_owned = ptr_is_owned(arg);
28342         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28343         arg_conv.is_owned = false;
28344         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
28345         return ret_conv;
28346 }
28347
28348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28349         LDKCounterpartyForwardingInfo orig_conv;
28350         orig_conv.inner = untag_ptr(orig);
28351         orig_conv.is_owned = ptr_is_owned(orig);
28352         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28353         orig_conv.is_owned = false;
28354         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
28355         int64_t ret_ref = 0;
28356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28358         return ret_ref;
28359 }
28360
28361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28362         LDKChannelCounterparty this_obj_conv;
28363         this_obj_conv.inner = untag_ptr(this_obj);
28364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28366         ChannelCounterparty_free(this_obj_conv);
28367 }
28368
28369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28370         LDKChannelCounterparty this_ptr_conv;
28371         this_ptr_conv.inner = untag_ptr(this_ptr);
28372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28374         this_ptr_conv.is_owned = false;
28375         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28376         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
28377         return ret_arr;
28378 }
28379
28380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28381         LDKChannelCounterparty this_ptr_conv;
28382         this_ptr_conv.inner = untag_ptr(this_ptr);
28383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28385         this_ptr_conv.is_owned = false;
28386         LDKPublicKey val_ref;
28387         CHECK((*env)->GetArrayLength(env, val) == 33);
28388         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28389         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
28390 }
28391
28392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28393         LDKChannelCounterparty this_ptr_conv;
28394         this_ptr_conv.inner = untag_ptr(this_ptr);
28395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28397         this_ptr_conv.is_owned = false;
28398         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
28399         int64_t ret_ref = 0;
28400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28402         return ret_ref;
28403 }
28404
28405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28406         LDKChannelCounterparty this_ptr_conv;
28407         this_ptr_conv.inner = untag_ptr(this_ptr);
28408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28410         this_ptr_conv.is_owned = false;
28411         LDKInitFeatures val_conv;
28412         val_conv.inner = untag_ptr(val);
28413         val_conv.is_owned = ptr_is_owned(val);
28414         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28415         val_conv = InitFeatures_clone(&val_conv);
28416         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
28417 }
28418
28419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28420         LDKChannelCounterparty this_ptr_conv;
28421         this_ptr_conv.inner = untag_ptr(this_ptr);
28422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28424         this_ptr_conv.is_owned = false;
28425         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
28426         return ret_conv;
28427 }
28428
28429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28430         LDKChannelCounterparty this_ptr_conv;
28431         this_ptr_conv.inner = untag_ptr(this_ptr);
28432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28434         this_ptr_conv.is_owned = false;
28435         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
28436 }
28437
28438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28439         LDKChannelCounterparty this_ptr_conv;
28440         this_ptr_conv.inner = untag_ptr(this_ptr);
28441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28443         this_ptr_conv.is_owned = false;
28444         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
28445         int64_t ret_ref = 0;
28446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28448         return ret_ref;
28449 }
28450
28451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28452         LDKChannelCounterparty this_ptr_conv;
28453         this_ptr_conv.inner = untag_ptr(this_ptr);
28454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28456         this_ptr_conv.is_owned = false;
28457         LDKCounterpartyForwardingInfo val_conv;
28458         val_conv.inner = untag_ptr(val);
28459         val_conv.is_owned = ptr_is_owned(val);
28460         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28461         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
28462         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
28463 }
28464
28465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28466         LDKChannelCounterparty this_ptr_conv;
28467         this_ptr_conv.inner = untag_ptr(this_ptr);
28468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28470         this_ptr_conv.is_owned = false;
28471         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28472         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
28473         int64_t ret_ref = tag_ptr(ret_copy, true);
28474         return ret_ref;
28475 }
28476
28477 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) {
28478         LDKChannelCounterparty this_ptr_conv;
28479         this_ptr_conv.inner = untag_ptr(this_ptr);
28480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28482         this_ptr_conv.is_owned = false;
28483         void* val_ptr = untag_ptr(val);
28484         CHECK_ACCESS(val_ptr);
28485         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28486         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28487         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28488 }
28489
28490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28491         LDKChannelCounterparty this_ptr_conv;
28492         this_ptr_conv.inner = untag_ptr(this_ptr);
28493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28495         this_ptr_conv.is_owned = false;
28496         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28497         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
28498         int64_t ret_ref = tag_ptr(ret_copy, true);
28499         return ret_ref;
28500 }
28501
28502 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) {
28503         LDKChannelCounterparty this_ptr_conv;
28504         this_ptr_conv.inner = untag_ptr(this_ptr);
28505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28507         this_ptr_conv.is_owned = false;
28508         void* val_ptr = untag_ptr(val);
28509         CHECK_ACCESS(val_ptr);
28510         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28511         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28512         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28513 }
28514
28515 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) {
28516         LDKPublicKey node_id_arg_ref;
28517         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
28518         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
28519         LDKInitFeatures features_arg_conv;
28520         features_arg_conv.inner = untag_ptr(features_arg);
28521         features_arg_conv.is_owned = ptr_is_owned(features_arg);
28522         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28523         features_arg_conv = InitFeatures_clone(&features_arg_conv);
28524         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
28525         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
28526         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
28527         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
28528         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
28529         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
28530         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
28531         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
28532         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
28533         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
28534         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
28535         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
28536         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
28537         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);
28538         int64_t ret_ref = 0;
28539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28541         return ret_ref;
28542 }
28543
28544 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
28545         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
28546         int64_t ret_ref = 0;
28547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28549         return ret_ref;
28550 }
28551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28552         LDKChannelCounterparty arg_conv;
28553         arg_conv.inner = untag_ptr(arg);
28554         arg_conv.is_owned = ptr_is_owned(arg);
28555         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28556         arg_conv.is_owned = false;
28557         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
28558         return ret_conv;
28559 }
28560
28561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28562         LDKChannelCounterparty orig_conv;
28563         orig_conv.inner = untag_ptr(orig);
28564         orig_conv.is_owned = ptr_is_owned(orig);
28565         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28566         orig_conv.is_owned = false;
28567         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
28568         int64_t ret_ref = 0;
28569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28571         return ret_ref;
28572 }
28573
28574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28575         LDKChannelDetails this_obj_conv;
28576         this_obj_conv.inner = untag_ptr(this_obj);
28577         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28579         ChannelDetails_free(this_obj_conv);
28580 }
28581
28582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28583         LDKChannelDetails this_ptr_conv;
28584         this_ptr_conv.inner = untag_ptr(this_ptr);
28585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28587         this_ptr_conv.is_owned = false;
28588         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28589         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
28590         return ret_arr;
28591 }
28592
28593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28594         LDKChannelDetails this_ptr_conv;
28595         this_ptr_conv.inner = untag_ptr(this_ptr);
28596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28598         this_ptr_conv.is_owned = false;
28599         LDKThirtyTwoBytes val_ref;
28600         CHECK((*env)->GetArrayLength(env, val) == 32);
28601         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28602         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
28603 }
28604
28605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
28606         LDKChannelDetails this_ptr_conv;
28607         this_ptr_conv.inner = untag_ptr(this_ptr);
28608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28610         this_ptr_conv.is_owned = false;
28611         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
28612         int64_t ret_ref = 0;
28613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28615         return ret_ref;
28616 }
28617
28618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28619         LDKChannelDetails this_ptr_conv;
28620         this_ptr_conv.inner = untag_ptr(this_ptr);
28621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28623         this_ptr_conv.is_owned = false;
28624         LDKChannelCounterparty val_conv;
28625         val_conv.inner = untag_ptr(val);
28626         val_conv.is_owned = ptr_is_owned(val);
28627         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28628         val_conv = ChannelCounterparty_clone(&val_conv);
28629         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
28630 }
28631
28632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
28633         LDKChannelDetails this_ptr_conv;
28634         this_ptr_conv.inner = untag_ptr(this_ptr);
28635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28637         this_ptr_conv.is_owned = false;
28638         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
28639         int64_t ret_ref = 0;
28640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28642         return ret_ref;
28643 }
28644
28645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28646         LDKChannelDetails this_ptr_conv;
28647         this_ptr_conv.inner = untag_ptr(this_ptr);
28648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28650         this_ptr_conv.is_owned = false;
28651         LDKOutPoint val_conv;
28652         val_conv.inner = untag_ptr(val);
28653         val_conv.is_owned = ptr_is_owned(val);
28654         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28655         val_conv = OutPoint_clone(&val_conv);
28656         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
28657 }
28658
28659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
28660         LDKChannelDetails this_ptr_conv;
28661         this_ptr_conv.inner = untag_ptr(this_ptr);
28662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28664         this_ptr_conv.is_owned = false;
28665         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
28666         int64_t ret_ref = 0;
28667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28669         return ret_ref;
28670 }
28671
28672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28673         LDKChannelDetails this_ptr_conv;
28674         this_ptr_conv.inner = untag_ptr(this_ptr);
28675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28677         this_ptr_conv.is_owned = false;
28678         LDKChannelTypeFeatures val_conv;
28679         val_conv.inner = untag_ptr(val);
28680         val_conv.is_owned = ptr_is_owned(val);
28681         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28682         val_conv = ChannelTypeFeatures_clone(&val_conv);
28683         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
28684 }
28685
28686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28687         LDKChannelDetails this_ptr_conv;
28688         this_ptr_conv.inner = untag_ptr(this_ptr);
28689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28691         this_ptr_conv.is_owned = false;
28692         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28693         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
28694         int64_t ret_ref = tag_ptr(ret_copy, true);
28695         return ret_ref;
28696 }
28697
28698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28699         LDKChannelDetails this_ptr_conv;
28700         this_ptr_conv.inner = untag_ptr(this_ptr);
28701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28703         this_ptr_conv.is_owned = false;
28704         void* val_ptr = untag_ptr(val);
28705         CHECK_ACCESS(val_ptr);
28706         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28707         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28708         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
28709 }
28710
28711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28712         LDKChannelDetails this_ptr_conv;
28713         this_ptr_conv.inner = untag_ptr(this_ptr);
28714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28716         this_ptr_conv.is_owned = false;
28717         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28718         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
28719         int64_t ret_ref = tag_ptr(ret_copy, true);
28720         return ret_ref;
28721 }
28722
28723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28724         LDKChannelDetails this_ptr_conv;
28725         this_ptr_conv.inner = untag_ptr(this_ptr);
28726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28728         this_ptr_conv.is_owned = false;
28729         void* val_ptr = untag_ptr(val);
28730         CHECK_ACCESS(val_ptr);
28731         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28732         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28733         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
28734 }
28735
28736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28737         LDKChannelDetails this_ptr_conv;
28738         this_ptr_conv.inner = untag_ptr(this_ptr);
28739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28741         this_ptr_conv.is_owned = false;
28742         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28743         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
28744         int64_t ret_ref = tag_ptr(ret_copy, true);
28745         return ret_ref;
28746 }
28747
28748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28749         LDKChannelDetails this_ptr_conv;
28750         this_ptr_conv.inner = untag_ptr(this_ptr);
28751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28753         this_ptr_conv.is_owned = false;
28754         void* val_ptr = untag_ptr(val);
28755         CHECK_ACCESS(val_ptr);
28756         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28757         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28758         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
28759 }
28760
28761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28762         LDKChannelDetails this_ptr_conv;
28763         this_ptr_conv.inner = untag_ptr(this_ptr);
28764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28766         this_ptr_conv.is_owned = false;
28767         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
28768         return ret_conv;
28769 }
28770
28771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28772         LDKChannelDetails this_ptr_conv;
28773         this_ptr_conv.inner = untag_ptr(this_ptr);
28774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28776         this_ptr_conv.is_owned = false;
28777         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
28778 }
28779
28780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28781         LDKChannelDetails this_ptr_conv;
28782         this_ptr_conv.inner = untag_ptr(this_ptr);
28783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28785         this_ptr_conv.is_owned = false;
28786         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28787         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
28788         int64_t ret_ref = tag_ptr(ret_copy, true);
28789         return ret_ref;
28790 }
28791
28792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28793         LDKChannelDetails this_ptr_conv;
28794         this_ptr_conv.inner = untag_ptr(this_ptr);
28795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28797         this_ptr_conv.is_owned = false;
28798         void* val_ptr = untag_ptr(val);
28799         CHECK_ACCESS(val_ptr);
28800         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28801         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28802         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
28803 }
28804
28805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28806         LDKChannelDetails this_ptr_conv;
28807         this_ptr_conv.inner = untag_ptr(this_ptr);
28808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28810         this_ptr_conv.is_owned = false;
28811         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
28812         return ret_conv;
28813 }
28814
28815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28816         LDKChannelDetails this_ptr_conv;
28817         this_ptr_conv.inner = untag_ptr(this_ptr);
28818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28820         this_ptr_conv.is_owned = false;
28821         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
28822 }
28823
28824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28825         LDKChannelDetails this_ptr_conv;
28826         this_ptr_conv.inner = untag_ptr(this_ptr);
28827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28829         this_ptr_conv.is_owned = false;
28830         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28831         return ret_conv;
28832 }
28833
28834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28835         LDKChannelDetails this_ptr_conv;
28836         this_ptr_conv.inner = untag_ptr(this_ptr);
28837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28839         this_ptr_conv.is_owned = false;
28840         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28841 }
28842
28843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28844         LDKChannelDetails this_ptr_conv;
28845         this_ptr_conv.inner = untag_ptr(this_ptr);
28846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28848         this_ptr_conv.is_owned = false;
28849         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28850         return ret_conv;
28851 }
28852
28853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28854         LDKChannelDetails this_ptr_conv;
28855         this_ptr_conv.inner = untag_ptr(this_ptr);
28856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28858         this_ptr_conv.is_owned = false;
28859         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28860 }
28861
28862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28863         LDKChannelDetails this_ptr_conv;
28864         this_ptr_conv.inner = untag_ptr(this_ptr);
28865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28867         this_ptr_conv.is_owned = false;
28868         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28869         return ret_conv;
28870 }
28871
28872 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) {
28873         LDKChannelDetails this_ptr_conv;
28874         this_ptr_conv.inner = untag_ptr(this_ptr);
28875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28877         this_ptr_conv.is_owned = false;
28878         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28879 }
28880
28881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28882         LDKChannelDetails this_ptr_conv;
28883         this_ptr_conv.inner = untag_ptr(this_ptr);
28884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28886         this_ptr_conv.is_owned = false;
28887         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28888         return ret_conv;
28889 }
28890
28891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28892         LDKChannelDetails this_ptr_conv;
28893         this_ptr_conv.inner = untag_ptr(this_ptr);
28894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28896         this_ptr_conv.is_owned = false;
28897         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28898 }
28899
28900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
28901         LDKChannelDetails this_ptr_conv;
28902         this_ptr_conv.inner = untag_ptr(this_ptr);
28903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28905         this_ptr_conv.is_owned = false;
28906         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28907         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28908         int64_t ret_ref = tag_ptr(ret_copy, true);
28909         return ret_ref;
28910 }
28911
28912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28913         LDKChannelDetails this_ptr_conv;
28914         this_ptr_conv.inner = untag_ptr(this_ptr);
28915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28917         this_ptr_conv.is_owned = false;
28918         void* val_ptr = untag_ptr(val);
28919         CHECK_ACCESS(val_ptr);
28920         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28921         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28922         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28923 }
28924
28925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28926         LDKChannelDetails this_ptr_conv;
28927         this_ptr_conv.inner = untag_ptr(this_ptr);
28928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28930         this_ptr_conv.is_owned = false;
28931         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28932         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28933         int64_t ret_ref = tag_ptr(ret_copy, true);
28934         return ret_ref;
28935 }
28936
28937 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) {
28938         LDKChannelDetails this_ptr_conv;
28939         this_ptr_conv.inner = untag_ptr(this_ptr);
28940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28942         this_ptr_conv.is_owned = false;
28943         void* val_ptr = untag_ptr(val);
28944         CHECK_ACCESS(val_ptr);
28945         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28946         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28947         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28948 }
28949
28950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
28951         LDKChannelDetails this_ptr_conv;
28952         this_ptr_conv.inner = untag_ptr(this_ptr);
28953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28955         this_ptr_conv.is_owned = false;
28956         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28957         return ret_conv;
28958 }
28959
28960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28961         LDKChannelDetails this_ptr_conv;
28962         this_ptr_conv.inner = untag_ptr(this_ptr);
28963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28965         this_ptr_conv.is_owned = false;
28966         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28967 }
28968
28969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
28970         LDKChannelDetails this_ptr_conv;
28971         this_ptr_conv.inner = untag_ptr(this_ptr);
28972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28974         this_ptr_conv.is_owned = false;
28975         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28976         return ret_conv;
28977 }
28978
28979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28980         LDKChannelDetails this_ptr_conv;
28981         this_ptr_conv.inner = untag_ptr(this_ptr);
28982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28984         this_ptr_conv.is_owned = false;
28985         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28986 }
28987
28988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
28989         LDKChannelDetails this_ptr_conv;
28990         this_ptr_conv.inner = untag_ptr(this_ptr);
28991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28993         this_ptr_conv.is_owned = false;
28994         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28995         return ret_conv;
28996 }
28997
28998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28999         LDKChannelDetails this_ptr_conv;
29000         this_ptr_conv.inner = untag_ptr(this_ptr);
29001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29003         this_ptr_conv.is_owned = false;
29004         ChannelDetails_set_is_usable(&this_ptr_conv, val);
29005 }
29006
29007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
29008         LDKChannelDetails this_ptr_conv;
29009         this_ptr_conv.inner = untag_ptr(this_ptr);
29010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29012         this_ptr_conv.is_owned = false;
29013         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
29014         return ret_conv;
29015 }
29016
29017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29018         LDKChannelDetails this_ptr_conv;
29019         this_ptr_conv.inner = untag_ptr(this_ptr);
29020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29022         this_ptr_conv.is_owned = false;
29023         ChannelDetails_set_is_public(&this_ptr_conv, val);
29024 }
29025
29026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29027         LDKChannelDetails this_ptr_conv;
29028         this_ptr_conv.inner = untag_ptr(this_ptr);
29029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29031         this_ptr_conv.is_owned = false;
29032         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29033         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
29034         int64_t ret_ref = tag_ptr(ret_copy, true);
29035         return ret_ref;
29036 }
29037
29038 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) {
29039         LDKChannelDetails this_ptr_conv;
29040         this_ptr_conv.inner = untag_ptr(this_ptr);
29041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29043         this_ptr_conv.is_owned = false;
29044         void* val_ptr = untag_ptr(val);
29045         CHECK_ACCESS(val_ptr);
29046         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29047         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
29048         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
29049 }
29050
29051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29052         LDKChannelDetails this_ptr_conv;
29053         this_ptr_conv.inner = untag_ptr(this_ptr);
29054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29056         this_ptr_conv.is_owned = false;
29057         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29058         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
29059         int64_t ret_ref = tag_ptr(ret_copy, true);
29060         return ret_ref;
29061 }
29062
29063 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) {
29064         LDKChannelDetails this_ptr_conv;
29065         this_ptr_conv.inner = untag_ptr(this_ptr);
29066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29068         this_ptr_conv.is_owned = false;
29069         void* val_ptr = untag_ptr(val);
29070         CHECK_ACCESS(val_ptr);
29071         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29072         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
29073         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
29074 }
29075
29076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
29077         LDKChannelDetails this_ptr_conv;
29078         this_ptr_conv.inner = untag_ptr(this_ptr);
29079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29081         this_ptr_conv.is_owned = false;
29082         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
29083         int64_t ret_ref = 0;
29084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29086         return ret_ref;
29087 }
29088
29089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29090         LDKChannelDetails this_ptr_conv;
29091         this_ptr_conv.inner = untag_ptr(this_ptr);
29092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29094         this_ptr_conv.is_owned = false;
29095         LDKChannelConfig val_conv;
29096         val_conv.inner = untag_ptr(val);
29097         val_conv.is_owned = ptr_is_owned(val);
29098         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29099         val_conv = ChannelConfig_clone(&val_conv);
29100         ChannelDetails_set_config(&this_ptr_conv, val_conv);
29101 }
29102
29103 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, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_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) {
29104         LDKThirtyTwoBytes channel_id_arg_ref;
29105         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29106         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29107         LDKChannelCounterparty counterparty_arg_conv;
29108         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
29109         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
29110         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
29111         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
29112         LDKOutPoint funding_txo_arg_conv;
29113         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
29114         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
29115         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
29116         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
29117         LDKChannelTypeFeatures channel_type_arg_conv;
29118         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
29119         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
29120         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
29121         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
29122         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
29123         CHECK_ACCESS(short_channel_id_arg_ptr);
29124         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
29125         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
29126         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
29127         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
29128         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
29129         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
29130         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
29131         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
29132         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
29133         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
29134         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
29135         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
29136         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
29137         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
29138         CHECK_ACCESS(confirmations_required_arg_ptr);
29139         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
29140         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
29141         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
29142         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
29143         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
29144         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
29145         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
29146         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
29147         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
29148         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
29149         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
29150         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
29151         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
29152         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
29153         LDKChannelConfig config_arg_conv;
29154         config_arg_conv.inner = untag_ptr(config_arg);
29155         config_arg_conv.is_owned = ptr_is_owned(config_arg);
29156         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
29157         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
29158         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, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
29159         int64_t ret_ref = 0;
29160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29162         return ret_ref;
29163 }
29164
29165 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
29166         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
29167         int64_t ret_ref = 0;
29168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29170         return ret_ref;
29171 }
29172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29173         LDKChannelDetails arg_conv;
29174         arg_conv.inner = untag_ptr(arg);
29175         arg_conv.is_owned = ptr_is_owned(arg);
29176         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29177         arg_conv.is_owned = false;
29178         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
29179         return ret_conv;
29180 }
29181
29182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29183         LDKChannelDetails orig_conv;
29184         orig_conv.inner = untag_ptr(orig);
29185         orig_conv.is_owned = ptr_is_owned(orig);
29186         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29187         orig_conv.is_owned = false;
29188         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
29189         int64_t ret_ref = 0;
29190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29192         return ret_ref;
29193 }
29194
29195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29196         LDKChannelDetails this_arg_conv;
29197         this_arg_conv.inner = untag_ptr(this_arg);
29198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29200         this_arg_conv.is_owned = false;
29201         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29202         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
29203         int64_t ret_ref = tag_ptr(ret_copy, true);
29204         return ret_ref;
29205 }
29206
29207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29208         LDKChannelDetails this_arg_conv;
29209         this_arg_conv.inner = untag_ptr(this_arg);
29210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29212         this_arg_conv.is_owned = false;
29213         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29214         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
29215         int64_t ret_ref = tag_ptr(ret_copy, true);
29216         return ret_ref;
29217 }
29218
29219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29220         if (!ptr_is_owned(this_ptr)) return;
29221         void* this_ptr_ptr = untag_ptr(this_ptr);
29222         CHECK_ACCESS(this_ptr_ptr);
29223         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
29224         FREE(untag_ptr(this_ptr));
29225         PaymentSendFailure_free(this_ptr_conv);
29226 }
29227
29228 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
29229         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29230         *ret_copy = PaymentSendFailure_clone(arg);
29231         int64_t ret_ref = tag_ptr(ret_copy, true);
29232         return ret_ref;
29233 }
29234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29235         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
29236         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
29237         return ret_conv;
29238 }
29239
29240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29241         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
29242         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29243         *ret_copy = PaymentSendFailure_clone(orig_conv);
29244         int64_t ret_ref = tag_ptr(ret_copy, true);
29245         return ret_ref;
29246 }
29247
29248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
29249         void* a_ptr = untag_ptr(a);
29250         CHECK_ACCESS(a_ptr);
29251         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
29252         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
29253         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29254         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
29255         int64_t ret_ref = tag_ptr(ret_copy, true);
29256         return ret_ref;
29257 }
29258
29259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
29260         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
29261         a_constr.datalen = (*env)->GetArrayLength(env, a);
29262         if (a_constr.datalen > 0)
29263                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29264         else
29265                 a_constr.data = NULL;
29266         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29267         for (size_t w = 0; w < a_constr.datalen; w++) {
29268                 int64_t a_conv_22 = a_vals[w];
29269                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
29270                 CHECK_ACCESS(a_conv_22_ptr);
29271                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
29272                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
29273                 a_constr.data[w] = a_conv_22_conv;
29274         }
29275         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29276         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29277         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
29278         int64_t ret_ref = tag_ptr(ret_copy, true);
29279         return ret_ref;
29280 }
29281
29282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
29283         LDKCVec_APIErrorZ a_constr;
29284         a_constr.datalen = (*env)->GetArrayLength(env, a);
29285         if (a_constr.datalen > 0)
29286                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
29287         else
29288                 a_constr.data = NULL;
29289         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29290         for (size_t k = 0; k < a_constr.datalen; k++) {
29291                 int64_t a_conv_10 = a_vals[k];
29292                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
29293                 CHECK_ACCESS(a_conv_10_ptr);
29294                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
29295                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
29296                 a_constr.data[k] = a_conv_10_conv;
29297         }
29298         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29299         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29300         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
29301         int64_t ret_ref = tag_ptr(ret_copy, true);
29302         return ret_ref;
29303 }
29304
29305 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) {
29306         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
29307         results_constr.datalen = (*env)->GetArrayLength(env, results);
29308         if (results_constr.datalen > 0)
29309                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29310         else
29311                 results_constr.data = NULL;
29312         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
29313         for (size_t w = 0; w < results_constr.datalen; w++) {
29314                 int64_t results_conv_22 = results_vals[w];
29315                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
29316                 CHECK_ACCESS(results_conv_22_ptr);
29317                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
29318                 results_constr.data[w] = results_conv_22_conv;
29319         }
29320         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
29321         LDKRouteParameters failed_paths_retry_conv;
29322         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
29323         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
29324         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
29325         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
29326         LDKThirtyTwoBytes payment_id_ref;
29327         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29328         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29329         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29330         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
29331         int64_t ret_ref = tag_ptr(ret_copy, true);
29332         return ret_ref;
29333 }
29334
29335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29336         LDKPhantomRouteHints this_obj_conv;
29337         this_obj_conv.inner = untag_ptr(this_obj);
29338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29340         PhantomRouteHints_free(this_obj_conv);
29341 }
29342
29343 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
29344         LDKPhantomRouteHints this_ptr_conv;
29345         this_ptr_conv.inner = untag_ptr(this_ptr);
29346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29348         this_ptr_conv.is_owned = false;
29349         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
29350         int64_tArray ret_arr = NULL;
29351         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29352         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29353         for (size_t q = 0; q < ret_var.datalen; q++) {
29354                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29355                 int64_t ret_conv_16_ref = 0;
29356                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29357                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29358                 ret_arr_ptr[q] = ret_conv_16_ref;
29359         }
29360         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29361         FREE(ret_var.data);
29362         return ret_arr;
29363 }
29364
29365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
29366         LDKPhantomRouteHints this_ptr_conv;
29367         this_ptr_conv.inner = untag_ptr(this_ptr);
29368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29370         this_ptr_conv.is_owned = false;
29371         LDKCVec_ChannelDetailsZ val_constr;
29372         val_constr.datalen = (*env)->GetArrayLength(env, val);
29373         if (val_constr.datalen > 0)
29374                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29375         else
29376                 val_constr.data = NULL;
29377         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
29378         for (size_t q = 0; q < val_constr.datalen; q++) {
29379                 int64_t val_conv_16 = val_vals[q];
29380                 LDKChannelDetails val_conv_16_conv;
29381                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
29382                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
29383                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
29384                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
29385                 val_constr.data[q] = val_conv_16_conv;
29386         }
29387         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
29388         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
29389 }
29390
29391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
29392         LDKPhantomRouteHints this_ptr_conv;
29393         this_ptr_conv.inner = untag_ptr(this_ptr);
29394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29396         this_ptr_conv.is_owned = false;
29397         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
29398         return ret_conv;
29399 }
29400
29401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29402         LDKPhantomRouteHints this_ptr_conv;
29403         this_ptr_conv.inner = untag_ptr(this_ptr);
29404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29406         this_ptr_conv.is_owned = false;
29407         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
29408 }
29409
29410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29411         LDKPhantomRouteHints this_ptr_conv;
29412         this_ptr_conv.inner = untag_ptr(this_ptr);
29413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29415         this_ptr_conv.is_owned = false;
29416         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29417         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
29418         return ret_arr;
29419 }
29420
29421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29422         LDKPhantomRouteHints this_ptr_conv;
29423         this_ptr_conv.inner = untag_ptr(this_ptr);
29424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29426         this_ptr_conv.is_owned = false;
29427         LDKPublicKey val_ref;
29428         CHECK((*env)->GetArrayLength(env, val) == 33);
29429         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29430         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
29431 }
29432
29433 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) {
29434         LDKCVec_ChannelDetailsZ channels_arg_constr;
29435         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
29436         if (channels_arg_constr.datalen > 0)
29437                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29438         else
29439                 channels_arg_constr.data = NULL;
29440         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
29441         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
29442                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
29443                 LDKChannelDetails channels_arg_conv_16_conv;
29444                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
29445                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
29446                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
29447                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
29448                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
29449         }
29450         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
29451         LDKPublicKey real_node_pubkey_arg_ref;
29452         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
29453         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
29454         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
29455         int64_t ret_ref = 0;
29456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29458         return ret_ref;
29459 }
29460
29461 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
29462         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
29463         int64_t ret_ref = 0;
29464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29466         return ret_ref;
29467 }
29468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29469         LDKPhantomRouteHints arg_conv;
29470         arg_conv.inner = untag_ptr(arg);
29471         arg_conv.is_owned = ptr_is_owned(arg);
29472         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29473         arg_conv.is_owned = false;
29474         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
29475         return ret_conv;
29476 }
29477
29478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29479         LDKPhantomRouteHints orig_conv;
29480         orig_conv.inner = untag_ptr(orig);
29481         orig_conv.is_owned = ptr_is_owned(orig);
29482         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29483         orig_conv.is_owned = false;
29484         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
29485         int64_t ret_ref = 0;
29486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29488         return ret_ref;
29489 }
29490
29491 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 logger, int64_t keys_manager, int64_t config, int64_t params) {
29492         void* fee_est_ptr = untag_ptr(fee_est);
29493         CHECK_ACCESS(fee_est_ptr);
29494         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
29495         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
29496                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29497                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
29498         }
29499         void* chain_monitor_ptr = untag_ptr(chain_monitor);
29500         CHECK_ACCESS(chain_monitor_ptr);
29501         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29502         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29503                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29504                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29505         }
29506         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
29507         CHECK_ACCESS(tx_broadcaster_ptr);
29508         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29509         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29510                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29511                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29512         }
29513         void* logger_ptr = untag_ptr(logger);
29514         CHECK_ACCESS(logger_ptr);
29515         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29516         if (logger_conv.free == LDKLogger_JCalls_free) {
29517                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29518                 LDKLogger_JCalls_cloned(&logger_conv);
29519         }
29520         void* keys_manager_ptr = untag_ptr(keys_manager);
29521         CHECK_ACCESS(keys_manager_ptr);
29522         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29523         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29524                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29525                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29526         }
29527         LDKUserConfig config_conv;
29528         config_conv.inner = untag_ptr(config);
29529         config_conv.is_owned = ptr_is_owned(config);
29530         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29531         config_conv = UserConfig_clone(&config_conv);
29532         LDKChainParameters params_conv;
29533         params_conv.inner = untag_ptr(params);
29534         params_conv.is_owned = ptr_is_owned(params);
29535         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
29536         params_conv = ChainParameters_clone(&params_conv);
29537         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
29538         int64_t ret_ref = 0;
29539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29541         return ret_ref;
29542 }
29543
29544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
29545         LDKChannelManager this_arg_conv;
29546         this_arg_conv.inner = untag_ptr(this_arg);
29547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29549         this_arg_conv.is_owned = false;
29550         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
29551         int64_t ret_ref = 0;
29552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29554         return ret_ref;
29555 }
29556
29557 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, int64_t user_channel_id, int64_t override_config) {
29558         LDKChannelManager this_arg_conv;
29559         this_arg_conv.inner = untag_ptr(this_arg);
29560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29562         this_arg_conv.is_owned = false;
29563         LDKPublicKey their_network_key_ref;
29564         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
29565         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
29566         LDKUserConfig override_config_conv;
29567         override_config_conv.inner = untag_ptr(override_config);
29568         override_config_conv.is_owned = ptr_is_owned(override_config);
29569         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
29570         override_config_conv = UserConfig_clone(&override_config_conv);
29571         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
29572         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
29573         return tag_ptr(ret_conv, true);
29574 }
29575
29576 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29577         LDKChannelManager this_arg_conv;
29578         this_arg_conv.inner = untag_ptr(this_arg);
29579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29581         this_arg_conv.is_owned = false;
29582         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
29583         int64_tArray ret_arr = NULL;
29584         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29585         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29586         for (size_t q = 0; q < ret_var.datalen; q++) {
29587                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29588                 int64_t ret_conv_16_ref = 0;
29589                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29590                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29591                 ret_arr_ptr[q] = ret_conv_16_ref;
29592         }
29593         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29594         FREE(ret_var.data);
29595         return ret_arr;
29596 }
29597
29598 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29599         LDKChannelManager this_arg_conv;
29600         this_arg_conv.inner = untag_ptr(this_arg);
29601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29603         this_arg_conv.is_owned = false;
29604         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
29605         int64_tArray ret_arr = NULL;
29606         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29607         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29608         for (size_t q = 0; q < ret_var.datalen; q++) {
29609                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29610                 int64_t ret_conv_16_ref = 0;
29611                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29612                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29613                 ret_arr_ptr[q] = ret_conv_16_ref;
29614         }
29615         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29616         FREE(ret_var.data);
29617         return ret_arr;
29618 }
29619
29620 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) {
29621         LDKChannelManager this_arg_conv;
29622         this_arg_conv.inner = untag_ptr(this_arg);
29623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29625         this_arg_conv.is_owned = false;
29626         unsigned char channel_id_arr[32];
29627         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29628         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29629         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29630         LDKPublicKey counterparty_node_id_ref;
29631         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29632         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29633         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29634         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29635         return tag_ptr(ret_conv, true);
29636 }
29637
29638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int32_t target_feerate_sats_per_1000_weight) {
29639         LDKChannelManager this_arg_conv;
29640         this_arg_conv.inner = untag_ptr(this_arg);
29641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29643         this_arg_conv.is_owned = false;
29644         unsigned char channel_id_arr[32];
29645         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29646         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29647         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29648         LDKPublicKey counterparty_node_id_ref;
29649         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29650         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29651         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29652         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
29653         return tag_ptr(ret_conv, true);
29654 }
29655
29656 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) {
29657         LDKChannelManager this_arg_conv;
29658         this_arg_conv.inner = untag_ptr(this_arg);
29659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29661         this_arg_conv.is_owned = false;
29662         unsigned char channel_id_arr[32];
29663         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29664         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29665         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29666         LDKPublicKey counterparty_node_id_ref;
29667         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29668         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29669         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29670         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29671         return tag_ptr(ret_conv, true);
29672 }
29673
29674 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) {
29675         LDKChannelManager this_arg_conv;
29676         this_arg_conv.inner = untag_ptr(this_arg);
29677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29679         this_arg_conv.is_owned = false;
29680         unsigned char channel_id_arr[32];
29681         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29682         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29683         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29684         LDKPublicKey counterparty_node_id_ref;
29685         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29686         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29687         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29688         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29689         return tag_ptr(ret_conv, true);
29690 }
29691
29692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
29693         LDKChannelManager this_arg_conv;
29694         this_arg_conv.inner = untag_ptr(this_arg);
29695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29697         this_arg_conv.is_owned = false;
29698         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
29699 }
29700
29701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
29702         LDKChannelManager this_arg_conv;
29703         this_arg_conv.inner = untag_ptr(this_arg);
29704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29706         this_arg_conv.is_owned = false;
29707         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
29708 }
29709
29710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
29711         LDKChannelManager this_arg_conv;
29712         this_arg_conv.inner = untag_ptr(this_arg);
29713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29715         this_arg_conv.is_owned = false;
29716         LDKRoute route_conv;
29717         route_conv.inner = untag_ptr(route);
29718         route_conv.is_owned = ptr_is_owned(route);
29719         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29720         route_conv.is_owned = false;
29721         LDKThirtyTwoBytes payment_hash_ref;
29722         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29723         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29724         LDKThirtyTwoBytes payment_secret_ref;
29725         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29726         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29727         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
29728         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
29729         return tag_ptr(ret_conv, true);
29730 }
29731
29732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) {
29733         LDKChannelManager this_arg_conv;
29734         this_arg_conv.inner = untag_ptr(this_arg);
29735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29737         this_arg_conv.is_owned = false;
29738         LDKRoute route_conv;
29739         route_conv.inner = untag_ptr(route);
29740         route_conv.is_owned = ptr_is_owned(route);
29741         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29742         route_conv.is_owned = false;
29743         LDKThirtyTwoBytes payment_id_ref;
29744         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29745         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29746         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29747         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
29748         return tag_ptr(ret_conv, true);
29749 }
29750
29751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
29752         LDKChannelManager this_arg_conv;
29753         this_arg_conv.inner = untag_ptr(this_arg);
29754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29756         this_arg_conv.is_owned = false;
29757         LDKThirtyTwoBytes payment_id_ref;
29758         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29759         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29760         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29761 }
29762
29763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
29764         LDKChannelManager this_arg_conv;
29765         this_arg_conv.inner = untag_ptr(this_arg);
29766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29768         this_arg_conv.is_owned = false;
29769         LDKRoute route_conv;
29770         route_conv.inner = untag_ptr(route);
29771         route_conv.is_owned = ptr_is_owned(route);
29772         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29773         route_conv.is_owned = false;
29774         LDKThirtyTwoBytes payment_preimage_ref;
29775         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29776         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29777         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29778         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
29779         return tag_ptr(ret_conv, true);
29780 }
29781
29782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) {
29783         LDKChannelManager this_arg_conv;
29784         this_arg_conv.inner = untag_ptr(this_arg);
29785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29787         this_arg_conv.is_owned = false;
29788         LDKCVec_RouteHopZ hops_constr;
29789         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
29790         if (hops_constr.datalen > 0)
29791                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
29792         else
29793                 hops_constr.data = NULL;
29794         int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL);
29795         for (size_t k = 0; k < hops_constr.datalen; k++) {
29796                 int64_t hops_conv_10 = hops_vals[k];
29797                 LDKRouteHop hops_conv_10_conv;
29798                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
29799                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
29800                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
29801                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
29802                 hops_constr.data[k] = hops_conv_10_conv;
29803         }
29804         (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0);
29805         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29806         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
29807         return tag_ptr(ret_conv, true);
29808 }
29809
29810 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) {
29811         LDKChannelManager this_arg_conv;
29812         this_arg_conv.inner = untag_ptr(this_arg);
29813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29815         this_arg_conv.is_owned = false;
29816         unsigned char temporary_channel_id_arr[32];
29817         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29818         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29819         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29820         LDKPublicKey counterparty_node_id_ref;
29821         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29822         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29823         LDKTransaction funding_transaction_ref;
29824         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
29825         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29826         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
29827         funding_transaction_ref.data_is_owned = true;
29828         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29829         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29830         return tag_ptr(ret_conv, true);
29831 }
29832
29833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
29834         LDKChannelManager this_arg_conv;
29835         this_arg_conv.inner = untag_ptr(this_arg);
29836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29838         this_arg_conv.is_owned = false;
29839         LDKThreeBytes rgb_ref;
29840         CHECK((*env)->GetArrayLength(env, rgb) == 3);
29841         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
29842         LDKThirtyTwoBytes alias_ref;
29843         CHECK((*env)->GetArrayLength(env, alias) == 32);
29844         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
29845         LDKCVec_NetAddressZ addresses_constr;
29846         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
29847         if (addresses_constr.datalen > 0)
29848                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
29849         else
29850                 addresses_constr.data = NULL;
29851         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
29852         for (size_t m = 0; m < addresses_constr.datalen; m++) {
29853                 int64_t addresses_conv_12 = addresses_vals[m];
29854                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
29855                 CHECK_ACCESS(addresses_conv_12_ptr);
29856                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
29857                 addresses_constr.data[m] = addresses_conv_12_conv;
29858         }
29859         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
29860         ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
29861 }
29862
29863 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) {
29864         LDKChannelManager this_arg_conv;
29865         this_arg_conv.inner = untag_ptr(this_arg);
29866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29868         this_arg_conv.is_owned = false;
29869         LDKPublicKey counterparty_node_id_ref;
29870         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29871         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29872         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29873         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
29874         if (channel_ids_constr.datalen > 0)
29875                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29876         else
29877                 channel_ids_constr.data = NULL;
29878         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
29879                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
29880                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
29881                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
29882                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
29883                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
29884         }
29885         LDKChannelConfig config_conv;
29886         config_conv.inner = untag_ptr(config);
29887         config_conv.is_owned = ptr_is_owned(config);
29888         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29889         config_conv.is_owned = false;
29890         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29891         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29892         return tag_ptr(ret_conv, true);
29893 }
29894
29895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
29896         LDKChannelManager this_arg_conv;
29897         this_arg_conv.inner = untag_ptr(this_arg);
29898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29900         this_arg_conv.is_owned = false;
29901         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29902 }
29903
29904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
29905         LDKChannelManager this_arg_conv;
29906         this_arg_conv.inner = untag_ptr(this_arg);
29907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29909         this_arg_conv.is_owned = false;
29910         ChannelManager_timer_tick_occurred(&this_arg_conv);
29911 }
29912
29913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
29914         LDKChannelManager this_arg_conv;
29915         this_arg_conv.inner = untag_ptr(this_arg);
29916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29918         this_arg_conv.is_owned = false;
29919         unsigned char payment_hash_arr[32];
29920         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29921         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
29922         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
29923         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29924 }
29925
29926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
29927         LDKChannelManager this_arg_conv;
29928         this_arg_conv.inner = untag_ptr(this_arg);
29929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29931         this_arg_conv.is_owned = false;
29932         LDKThirtyTwoBytes payment_preimage_ref;
29933         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29934         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29935         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29936 }
29937
29938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
29939         LDKChannelManager this_arg_conv;
29940         this_arg_conv.inner = untag_ptr(this_arg);
29941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29943         this_arg_conv.is_owned = false;
29944         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29945         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
29946         return ret_arr;
29947 }
29948
29949 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, int64_t user_channel_id) {
29950         LDKChannelManager this_arg_conv;
29951         this_arg_conv.inner = untag_ptr(this_arg);
29952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29954         this_arg_conv.is_owned = false;
29955         unsigned char temporary_channel_id_arr[32];
29956         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29957         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29958         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29959         LDKPublicKey counterparty_node_id_ref;
29960         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29961         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29962         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29963         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
29964         return tag_ptr(ret_conv, true);
29965 }
29966
29967 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, int64_t user_channel_id) {
29968         LDKChannelManager this_arg_conv;
29969         this_arg_conv.inner = untag_ptr(this_arg);
29970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29972         this_arg_conv.is_owned = false;
29973         unsigned char temporary_channel_id_arr[32];
29974         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29975         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29976         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29977         LDKPublicKey counterparty_node_id_ref;
29978         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29979         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29980         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29981         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
29982         return tag_ptr(ret_conv, true);
29983 }
29984
29985 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) {
29986         LDKChannelManager this_arg_conv;
29987         this_arg_conv.inner = untag_ptr(this_arg);
29988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29990         this_arg_conv.is_owned = false;
29991         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29992         CHECK_ACCESS(min_value_msat_ptr);
29993         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29994         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29995         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29996         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29997         return tag_ptr(ret_conv, true);
29998 }
29999
30000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
30001         LDKChannelManager this_arg_conv;
30002         this_arg_conv.inner = untag_ptr(this_arg);
30003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30005         this_arg_conv.is_owned = false;
30006         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30007         CHECK_ACCESS(min_value_msat_ptr);
30008         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30009         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30010         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
30011         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
30012         return tag_ptr(ret_conv, true);
30013 }
30014
30015 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) {
30016         LDKChannelManager this_arg_conv;
30017         this_arg_conv.inner = untag_ptr(this_arg);
30018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30020         this_arg_conv.is_owned = false;
30021         LDKThirtyTwoBytes payment_hash_ref;
30022         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30023         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30024         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30025         CHECK_ACCESS(min_value_msat_ptr);
30026         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30027         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30028         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30029         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
30030         return tag_ptr(ret_conv, true);
30031 }
30032
30033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
30034         LDKChannelManager this_arg_conv;
30035         this_arg_conv.inner = untag_ptr(this_arg);
30036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30038         this_arg_conv.is_owned = false;
30039         LDKThirtyTwoBytes payment_hash_ref;
30040         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30041         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30042         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30043         CHECK_ACCESS(min_value_msat_ptr);
30044         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30045         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30046         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
30047         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
30048         return tag_ptr(ret_conv, true);
30049 }
30050
30051 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) {
30052         LDKChannelManager this_arg_conv;
30053         this_arg_conv.inner = untag_ptr(this_arg);
30054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30056         this_arg_conv.is_owned = false;
30057         LDKThirtyTwoBytes payment_hash_ref;
30058         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30059         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30060         LDKThirtyTwoBytes payment_secret_ref;
30061         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
30062         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
30063         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
30064         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
30065         return tag_ptr(ret_conv, true);
30066 }
30067
30068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30069         LDKChannelManager this_arg_conv;
30070         this_arg_conv.inner = untag_ptr(this_arg);
30071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30073         this_arg_conv.is_owned = false;
30074         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
30075         return ret_conv;
30076 }
30077
30078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
30079         LDKChannelManager this_arg_conv;
30080         this_arg_conv.inner = untag_ptr(this_arg);
30081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30083         this_arg_conv.is_owned = false;
30084         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
30085         int64_t ret_ref = 0;
30086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30088         return ret_ref;
30089 }
30090
30091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
30092         LDKChannelManager this_arg_conv;
30093         this_arg_conv.inner = untag_ptr(this_arg);
30094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30096         this_arg_conv.is_owned = false;
30097         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
30098         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
30099         return tag_ptr(ret_ret, true);
30100 }
30101
30102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
30103         LDKChannelManager this_arg_conv;
30104         this_arg_conv.inner = untag_ptr(this_arg);
30105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30107         this_arg_conv.is_owned = false;
30108         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
30109         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
30110         return tag_ptr(ret_ret, true);
30111 }
30112
30113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
30114         LDKChannelManager this_arg_conv;
30115         this_arg_conv.inner = untag_ptr(this_arg);
30116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30118         this_arg_conv.is_owned = false;
30119         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
30120         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
30121         return tag_ptr(ret_ret, true);
30122 }
30123
30124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
30125         LDKChannelManager this_arg_conv;
30126         this_arg_conv.inner = untag_ptr(this_arg);
30127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30129         this_arg_conv.is_owned = false;
30130         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
30131         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
30132         return tag_ptr(ret_ret, true);
30133 }
30134
30135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
30136         LDKChannelManager this_arg_conv;
30137         this_arg_conv.inner = untag_ptr(this_arg);
30138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30140         this_arg_conv.is_owned = false;
30141         jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
30142         return ret_conv;
30143 }
30144
30145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
30146         LDKChannelManager this_arg_conv;
30147         this_arg_conv.inner = untag_ptr(this_arg);
30148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30150         this_arg_conv.is_owned = false;
30151         ChannelManager_await_persistable_update(&this_arg_conv);
30152 }
30153
30154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
30155         LDKChannelManager this_arg_conv;
30156         this_arg_conv.inner = untag_ptr(this_arg);
30157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30159         this_arg_conv.is_owned = false;
30160         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
30161         int64_t ret_ref = 0;
30162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30164         return ret_ref;
30165 }
30166
30167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
30168         LDKChannelManager this_arg_conv;
30169         this_arg_conv.inner = untag_ptr(this_arg);
30170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30172         this_arg_conv.is_owned = false;
30173         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
30174         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
30175         return tag_ptr(ret_ret, true);
30176 }
30177
30178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
30179         LDKCounterpartyForwardingInfo obj_conv;
30180         obj_conv.inner = untag_ptr(obj);
30181         obj_conv.is_owned = ptr_is_owned(obj);
30182         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30183         obj_conv.is_owned = false;
30184         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
30185         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30186         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30187         CVec_u8Z_free(ret_var);
30188         return ret_arr;
30189 }
30190
30191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30192         LDKu8slice ser_ref;
30193         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30194         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30195         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30196         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
30197         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30198         return tag_ptr(ret_conv, true);
30199 }
30200
30201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
30202         LDKChannelCounterparty obj_conv;
30203         obj_conv.inner = untag_ptr(obj);
30204         obj_conv.is_owned = ptr_is_owned(obj);
30205         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30206         obj_conv.is_owned = false;
30207         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
30208         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30209         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30210         CVec_u8Z_free(ret_var);
30211         return ret_arr;
30212 }
30213
30214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30215         LDKu8slice ser_ref;
30216         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30217         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30218         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30219         *ret_conv = ChannelCounterparty_read(ser_ref);
30220         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30221         return tag_ptr(ret_conv, true);
30222 }
30223
30224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
30225         LDKChannelDetails obj_conv;
30226         obj_conv.inner = untag_ptr(obj);
30227         obj_conv.is_owned = ptr_is_owned(obj);
30228         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30229         obj_conv.is_owned = false;
30230         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
30231         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30232         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30233         CVec_u8Z_free(ret_var);
30234         return ret_arr;
30235 }
30236
30237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30238         LDKu8slice ser_ref;
30239         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30240         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30241         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30242         *ret_conv = ChannelDetails_read(ser_ref);
30243         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30244         return tag_ptr(ret_conv, true);
30245 }
30246
30247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
30248         LDKPhantomRouteHints obj_conv;
30249         obj_conv.inner = untag_ptr(obj);
30250         obj_conv.is_owned = ptr_is_owned(obj);
30251         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30252         obj_conv.is_owned = false;
30253         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
30254         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30255         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30256         CVec_u8Z_free(ret_var);
30257         return ret_arr;
30258 }
30259
30260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30261         LDKu8slice ser_ref;
30262         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30263         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30264         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30265         *ret_conv = PhantomRouteHints_read(ser_ref);
30266         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30267         return tag_ptr(ret_conv, true);
30268 }
30269
30270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
30271         LDKChannelManager obj_conv;
30272         obj_conv.inner = untag_ptr(obj);
30273         obj_conv.is_owned = ptr_is_owned(obj);
30274         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30275         obj_conv.is_owned = false;
30276         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
30277         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30278         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30279         CVec_u8Z_free(ret_var);
30280         return ret_arr;
30281 }
30282
30283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30284         LDKChannelManagerReadArgs this_obj_conv;
30285         this_obj_conv.inner = untag_ptr(this_obj);
30286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30288         ChannelManagerReadArgs_free(this_obj_conv);
30289 }
30290
30291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
30292         LDKChannelManagerReadArgs this_ptr_conv;
30293         this_ptr_conv.inner = untag_ptr(this_ptr);
30294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30296         this_ptr_conv.is_owned = false;
30297         // WARNING: This object doesn't live past this scope, needs clone!
30298         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
30299         return ret_ret;
30300 }
30301
30302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30303         LDKChannelManagerReadArgs this_ptr_conv;
30304         this_ptr_conv.inner = untag_ptr(this_ptr);
30305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30307         this_ptr_conv.is_owned = false;
30308         void* val_ptr = untag_ptr(val);
30309         CHECK_ACCESS(val_ptr);
30310         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
30311         if (val_conv.free == LDKKeysInterface_JCalls_free) {
30312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30313                 LDKKeysInterface_JCalls_cloned(&val_conv);
30314         }
30315         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
30316 }
30317
30318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
30319         LDKChannelManagerReadArgs this_ptr_conv;
30320         this_ptr_conv.inner = untag_ptr(this_ptr);
30321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30323         this_ptr_conv.is_owned = false;
30324         // WARNING: This object doesn't live past this scope, needs clone!
30325         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
30326         return ret_ret;
30327 }
30328
30329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30330         LDKChannelManagerReadArgs this_ptr_conv;
30331         this_ptr_conv.inner = untag_ptr(this_ptr);
30332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30334         this_ptr_conv.is_owned = false;
30335         void* val_ptr = untag_ptr(val);
30336         CHECK_ACCESS(val_ptr);
30337         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
30338         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
30339                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30340                 LDKFeeEstimator_JCalls_cloned(&val_conv);
30341         }
30342         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
30343 }
30344
30345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
30346         LDKChannelManagerReadArgs this_ptr_conv;
30347         this_ptr_conv.inner = untag_ptr(this_ptr);
30348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30350         this_ptr_conv.is_owned = false;
30351         // WARNING: This object doesn't live past this scope, needs clone!
30352         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
30353         return ret_ret;
30354 }
30355
30356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30357         LDKChannelManagerReadArgs this_ptr_conv;
30358         this_ptr_conv.inner = untag_ptr(this_ptr);
30359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30361         this_ptr_conv.is_owned = false;
30362         void* val_ptr = untag_ptr(val);
30363         CHECK_ACCESS(val_ptr);
30364         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
30365         if (val_conv.free == LDKWatch_JCalls_free) {
30366                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30367                 LDKWatch_JCalls_cloned(&val_conv);
30368         }
30369         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
30370 }
30371
30372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
30373         LDKChannelManagerReadArgs this_ptr_conv;
30374         this_ptr_conv.inner = untag_ptr(this_ptr);
30375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30377         this_ptr_conv.is_owned = false;
30378         // WARNING: This object doesn't live past this scope, needs clone!
30379         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
30380         return ret_ret;
30381 }
30382
30383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30384         LDKChannelManagerReadArgs this_ptr_conv;
30385         this_ptr_conv.inner = untag_ptr(this_ptr);
30386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30388         this_ptr_conv.is_owned = false;
30389         void* val_ptr = untag_ptr(val);
30390         CHECK_ACCESS(val_ptr);
30391         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
30392         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
30393                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30394                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
30395         }
30396         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
30397 }
30398
30399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
30400         LDKChannelManagerReadArgs this_ptr_conv;
30401         this_ptr_conv.inner = untag_ptr(this_ptr);
30402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30404         this_ptr_conv.is_owned = false;
30405         // WARNING: This object doesn't live past this scope, needs clone!
30406         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
30407         return ret_ret;
30408 }
30409
30410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30411         LDKChannelManagerReadArgs this_ptr_conv;
30412         this_ptr_conv.inner = untag_ptr(this_ptr);
30413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30415         this_ptr_conv.is_owned = false;
30416         void* val_ptr = untag_ptr(val);
30417         CHECK_ACCESS(val_ptr);
30418         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
30419         if (val_conv.free == LDKLogger_JCalls_free) {
30420                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30421                 LDKLogger_JCalls_cloned(&val_conv);
30422         }
30423         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
30424 }
30425
30426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
30427         LDKChannelManagerReadArgs this_ptr_conv;
30428         this_ptr_conv.inner = untag_ptr(this_ptr);
30429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30431         this_ptr_conv.is_owned = false;
30432         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
30433         int64_t ret_ref = 0;
30434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30436         return ret_ref;
30437 }
30438
30439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30440         LDKChannelManagerReadArgs this_ptr_conv;
30441         this_ptr_conv.inner = untag_ptr(this_ptr);
30442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30444         this_ptr_conv.is_owned = false;
30445         LDKUserConfig val_conv;
30446         val_conv.inner = untag_ptr(val);
30447         val_conv.is_owned = ptr_is_owned(val);
30448         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30449         val_conv = UserConfig_clone(&val_conv);
30450         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
30451 }
30452
30453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t default_config, int64_tArray channel_monitors) {
30454         void* keys_manager_ptr = untag_ptr(keys_manager);
30455         CHECK_ACCESS(keys_manager_ptr);
30456         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30457         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30458                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30459                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30460         }
30461         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30462         CHECK_ACCESS(fee_estimator_ptr);
30463         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30464         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30465                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30466                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30467         }
30468         void* chain_monitor_ptr = untag_ptr(chain_monitor);
30469         CHECK_ACCESS(chain_monitor_ptr);
30470         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30471         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30472                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30473                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30474         }
30475         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
30476         CHECK_ACCESS(tx_broadcaster_ptr);
30477         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30478         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30479                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30480                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30481         }
30482         void* logger_ptr = untag_ptr(logger);
30483         CHECK_ACCESS(logger_ptr);
30484         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30485         if (logger_conv.free == LDKLogger_JCalls_free) {
30486                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30487                 LDKLogger_JCalls_cloned(&logger_conv);
30488         }
30489         LDKUserConfig default_config_conv;
30490         default_config_conv.inner = untag_ptr(default_config);
30491         default_config_conv.is_owned = ptr_is_owned(default_config);
30492         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30493         default_config_conv = UserConfig_clone(&default_config_conv);
30494         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30495         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
30496         if (channel_monitors_constr.datalen > 0)
30497                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30498         else
30499                 channel_monitors_constr.data = NULL;
30500         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
30501         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30502                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30503                 LDKChannelMonitor channel_monitors_conv_16_conv;
30504                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30505                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30506                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30507                 channel_monitors_conv_16_conv.is_owned = false;
30508                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30509         }
30510         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
30511         LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
30512         int64_t ret_ref = 0;
30513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30515         return ret_ref;
30516 }
30517
30518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
30519         LDKu8slice ser_ref;
30520         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30521         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30522         LDKChannelManagerReadArgs arg_conv;
30523         arg_conv.inner = untag_ptr(arg);
30524         arg_conv.is_owned = ptr_is_owned(arg);
30525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30526         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30527         
30528         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30529         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30530         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30531         return tag_ptr(ret_conv, true);
30532 }
30533
30534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30535         LDKExpandedKey this_obj_conv;
30536         this_obj_conv.inner = untag_ptr(this_obj);
30537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30539         ExpandedKey_free(this_obj_conv);
30540 }
30541
30542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
30543         unsigned char key_material_arr[32];
30544         CHECK((*env)->GetArrayLength(env, key_material) == 32);
30545         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
30546         unsigned char (*key_material_ref)[32] = &key_material_arr;
30547         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30548         int64_t ret_ref = 0;
30549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30551         return ret_ref;
30552 }
30553
30554 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 keys_manager, int64_t current_time) {
30555         LDKExpandedKey keys_conv;
30556         keys_conv.inner = untag_ptr(keys);
30557         keys_conv.is_owned = ptr_is_owned(keys);
30558         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30559         keys_conv.is_owned = false;
30560         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30561         CHECK_ACCESS(min_value_msat_ptr);
30562         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30563         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30564         void* keys_manager_ptr = untag_ptr(keys_manager);
30565         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
30566         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
30567         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30568         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
30569         return tag_ptr(ret_conv, true);
30570 }
30571
30572 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) {
30573         LDKExpandedKey keys_conv;
30574         keys_conv.inner = untag_ptr(keys);
30575         keys_conv.is_owned = ptr_is_owned(keys);
30576         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30577         keys_conv.is_owned = false;
30578         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30579         CHECK_ACCESS(min_value_msat_ptr);
30580         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30581         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30582         LDKThirtyTwoBytes payment_hash_ref;
30583         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30584         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30585         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30586         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
30587         return tag_ptr(ret_conv, true);
30588 }
30589
30590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30591         LDKDecodeError this_obj_conv;
30592         this_obj_conv.inner = untag_ptr(this_obj);
30593         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30595         DecodeError_free(this_obj_conv);
30596 }
30597
30598 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30599         LDKDecodeError ret_var = DecodeError_clone(arg);
30600         int64_t ret_ref = 0;
30601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30603         return ret_ref;
30604 }
30605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30606         LDKDecodeError arg_conv;
30607         arg_conv.inner = untag_ptr(arg);
30608         arg_conv.is_owned = ptr_is_owned(arg);
30609         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30610         arg_conv.is_owned = false;
30611         int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
30612         return ret_conv;
30613 }
30614
30615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30616         LDKDecodeError orig_conv;
30617         orig_conv.inner = untag_ptr(orig);
30618         orig_conv.is_owned = ptr_is_owned(orig);
30619         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30620         orig_conv.is_owned = false;
30621         LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
30622         int64_t ret_ref = 0;
30623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30625         return ret_ref;
30626 }
30627
30628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30629         LDKInit this_obj_conv;
30630         this_obj_conv.inner = untag_ptr(this_obj);
30631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30633         Init_free(this_obj_conv);
30634 }
30635
30636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30637         LDKInit this_ptr_conv;
30638         this_ptr_conv.inner = untag_ptr(this_ptr);
30639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30641         this_ptr_conv.is_owned = false;
30642         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30643         int64_t ret_ref = 0;
30644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30646         return ret_ref;
30647 }
30648
30649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30650         LDKInit this_ptr_conv;
30651         this_ptr_conv.inner = untag_ptr(this_ptr);
30652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30654         this_ptr_conv.is_owned = false;
30655         LDKInitFeatures val_conv;
30656         val_conv.inner = untag_ptr(val);
30657         val_conv.is_owned = ptr_is_owned(val);
30658         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30659         val_conv = InitFeatures_clone(&val_conv);
30660         Init_set_features(&this_ptr_conv, val_conv);
30661 }
30662
30663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
30664         LDKInit this_ptr_conv;
30665         this_ptr_conv.inner = untag_ptr(this_ptr);
30666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30668         this_ptr_conv.is_owned = false;
30669         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30670         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30671         int64_t ret_ref = tag_ptr(ret_copy, true);
30672         return ret_ref;
30673 }
30674
30675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30676         LDKInit this_ptr_conv;
30677         this_ptr_conv.inner = untag_ptr(this_ptr);
30678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30680         this_ptr_conv.is_owned = false;
30681         void* val_ptr = untag_ptr(val);
30682         CHECK_ACCESS(val_ptr);
30683         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30684         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30685         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30686 }
30687
30688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t remote_network_address_arg) {
30689         LDKInitFeatures features_arg_conv;
30690         features_arg_conv.inner = untag_ptr(features_arg);
30691         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30692         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30693         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30694         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30695         CHECK_ACCESS(remote_network_address_arg_ptr);
30696         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30697         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30698         int64_t ret_ref = 0;
30699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30701         return ret_ref;
30702 }
30703
30704 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30705         LDKInit ret_var = Init_clone(arg);
30706         int64_t ret_ref = 0;
30707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30709         return ret_ref;
30710 }
30711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30712         LDKInit arg_conv;
30713         arg_conv.inner = untag_ptr(arg);
30714         arg_conv.is_owned = ptr_is_owned(arg);
30715         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30716         arg_conv.is_owned = false;
30717         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30718         return ret_conv;
30719 }
30720
30721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30722         LDKInit orig_conv;
30723         orig_conv.inner = untag_ptr(orig);
30724         orig_conv.is_owned = ptr_is_owned(orig);
30725         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30726         orig_conv.is_owned = false;
30727         LDKInit ret_var = Init_clone(&orig_conv);
30728         int64_t ret_ref = 0;
30729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30731         return ret_ref;
30732 }
30733
30734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30735         LDKErrorMessage this_obj_conv;
30736         this_obj_conv.inner = untag_ptr(this_obj);
30737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30739         ErrorMessage_free(this_obj_conv);
30740 }
30741
30742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30743         LDKErrorMessage this_ptr_conv;
30744         this_ptr_conv.inner = untag_ptr(this_ptr);
30745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30747         this_ptr_conv.is_owned = false;
30748         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30749         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
30750         return ret_arr;
30751 }
30752
30753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30754         LDKErrorMessage this_ptr_conv;
30755         this_ptr_conv.inner = untag_ptr(this_ptr);
30756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30758         this_ptr_conv.is_owned = false;
30759         LDKThirtyTwoBytes val_ref;
30760         CHECK((*env)->GetArrayLength(env, val) == 32);
30761         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30762         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30763 }
30764
30765 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30766         LDKErrorMessage this_ptr_conv;
30767         this_ptr_conv.inner = untag_ptr(this_ptr);
30768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30770         this_ptr_conv.is_owned = false;
30771         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30772         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30773         Str_free(ret_str);
30774         return ret_conv;
30775 }
30776
30777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30778         LDKErrorMessage this_ptr_conv;
30779         this_ptr_conv.inner = untag_ptr(this_ptr);
30780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30782         this_ptr_conv.is_owned = false;
30783         LDKStr val_conv = java_to_owned_str(env, val);
30784         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30785 }
30786
30787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30788         LDKThirtyTwoBytes channel_id_arg_ref;
30789         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30790         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30791         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30792         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30793         int64_t ret_ref = 0;
30794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30796         return ret_ref;
30797 }
30798
30799 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30800         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30801         int64_t ret_ref = 0;
30802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30804         return ret_ref;
30805 }
30806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30807         LDKErrorMessage arg_conv;
30808         arg_conv.inner = untag_ptr(arg);
30809         arg_conv.is_owned = ptr_is_owned(arg);
30810         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30811         arg_conv.is_owned = false;
30812         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30813         return ret_conv;
30814 }
30815
30816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30817         LDKErrorMessage orig_conv;
30818         orig_conv.inner = untag_ptr(orig);
30819         orig_conv.is_owned = ptr_is_owned(orig);
30820         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30821         orig_conv.is_owned = false;
30822         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30823         int64_t ret_ref = 0;
30824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30826         return ret_ref;
30827 }
30828
30829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30830         LDKWarningMessage this_obj_conv;
30831         this_obj_conv.inner = untag_ptr(this_obj);
30832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30834         WarningMessage_free(this_obj_conv);
30835 }
30836
30837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30838         LDKWarningMessage this_ptr_conv;
30839         this_ptr_conv.inner = untag_ptr(this_ptr);
30840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30842         this_ptr_conv.is_owned = false;
30843         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30844         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
30845         return ret_arr;
30846 }
30847
30848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30849         LDKWarningMessage this_ptr_conv;
30850         this_ptr_conv.inner = untag_ptr(this_ptr);
30851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30853         this_ptr_conv.is_owned = false;
30854         LDKThirtyTwoBytes val_ref;
30855         CHECK((*env)->GetArrayLength(env, val) == 32);
30856         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30857         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30858 }
30859
30860 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30861         LDKWarningMessage this_ptr_conv;
30862         this_ptr_conv.inner = untag_ptr(this_ptr);
30863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30865         this_ptr_conv.is_owned = false;
30866         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30867         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30868         Str_free(ret_str);
30869         return ret_conv;
30870 }
30871
30872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30873         LDKWarningMessage this_ptr_conv;
30874         this_ptr_conv.inner = untag_ptr(this_ptr);
30875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30877         this_ptr_conv.is_owned = false;
30878         LDKStr val_conv = java_to_owned_str(env, val);
30879         WarningMessage_set_data(&this_ptr_conv, val_conv);
30880 }
30881
30882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30883         LDKThirtyTwoBytes channel_id_arg_ref;
30884         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30885         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30886         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30887         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30888         int64_t ret_ref = 0;
30889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30891         return ret_ref;
30892 }
30893
30894 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30895         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30896         int64_t ret_ref = 0;
30897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30899         return ret_ref;
30900 }
30901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30902         LDKWarningMessage arg_conv;
30903         arg_conv.inner = untag_ptr(arg);
30904         arg_conv.is_owned = ptr_is_owned(arg);
30905         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30906         arg_conv.is_owned = false;
30907         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30908         return ret_conv;
30909 }
30910
30911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30912         LDKWarningMessage orig_conv;
30913         orig_conv.inner = untag_ptr(orig);
30914         orig_conv.is_owned = ptr_is_owned(orig);
30915         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30916         orig_conv.is_owned = false;
30917         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30918         int64_t ret_ref = 0;
30919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30921         return ret_ref;
30922 }
30923
30924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30925         LDKPing this_obj_conv;
30926         this_obj_conv.inner = untag_ptr(this_obj);
30927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30929         Ping_free(this_obj_conv);
30930 }
30931
30932 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30933         LDKPing this_ptr_conv;
30934         this_ptr_conv.inner = untag_ptr(this_ptr);
30935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30937         this_ptr_conv.is_owned = false;
30938         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30939         return ret_conv;
30940 }
30941
30942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30943         LDKPing this_ptr_conv;
30944         this_ptr_conv.inner = untag_ptr(this_ptr);
30945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30947         this_ptr_conv.is_owned = false;
30948         Ping_set_ponglen(&this_ptr_conv, val);
30949 }
30950
30951 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30952         LDKPing this_ptr_conv;
30953         this_ptr_conv.inner = untag_ptr(this_ptr);
30954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30956         this_ptr_conv.is_owned = false;
30957         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30958         return ret_conv;
30959 }
30960
30961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30962         LDKPing this_ptr_conv;
30963         this_ptr_conv.inner = untag_ptr(this_ptr);
30964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30966         this_ptr_conv.is_owned = false;
30967         Ping_set_byteslen(&this_ptr_conv, val);
30968 }
30969
30970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
30971         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30972         int64_t ret_ref = 0;
30973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30975         return ret_ref;
30976 }
30977
30978 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30979         LDKPing ret_var = Ping_clone(arg);
30980         int64_t ret_ref = 0;
30981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30983         return ret_ref;
30984 }
30985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30986         LDKPing arg_conv;
30987         arg_conv.inner = untag_ptr(arg);
30988         arg_conv.is_owned = ptr_is_owned(arg);
30989         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30990         arg_conv.is_owned = false;
30991         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30992         return ret_conv;
30993 }
30994
30995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30996         LDKPing orig_conv;
30997         orig_conv.inner = untag_ptr(orig);
30998         orig_conv.is_owned = ptr_is_owned(orig);
30999         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31000         orig_conv.is_owned = false;
31001         LDKPing ret_var = Ping_clone(&orig_conv);
31002         int64_t ret_ref = 0;
31003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31005         return ret_ref;
31006 }
31007
31008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31009         LDKPong this_obj_conv;
31010         this_obj_conv.inner = untag_ptr(this_obj);
31011         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31013         Pong_free(this_obj_conv);
31014 }
31015
31016 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
31017         LDKPong this_ptr_conv;
31018         this_ptr_conv.inner = untag_ptr(this_ptr);
31019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31021         this_ptr_conv.is_owned = false;
31022         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
31023         return ret_conv;
31024 }
31025
31026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31027         LDKPong this_ptr_conv;
31028         this_ptr_conv.inner = untag_ptr(this_ptr);
31029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31031         this_ptr_conv.is_owned = false;
31032         Pong_set_byteslen(&this_ptr_conv, val);
31033 }
31034
31035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
31036         LDKPong ret_var = Pong_new(byteslen_arg);
31037         int64_t ret_ref = 0;
31038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31040         return ret_ref;
31041 }
31042
31043 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
31044         LDKPong ret_var = Pong_clone(arg);
31045         int64_t ret_ref = 0;
31046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31048         return ret_ref;
31049 }
31050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31051         LDKPong arg_conv;
31052         arg_conv.inner = untag_ptr(arg);
31053         arg_conv.is_owned = ptr_is_owned(arg);
31054         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31055         arg_conv.is_owned = false;
31056         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
31057         return ret_conv;
31058 }
31059
31060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31061         LDKPong orig_conv;
31062         orig_conv.inner = untag_ptr(orig);
31063         orig_conv.is_owned = ptr_is_owned(orig);
31064         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31065         orig_conv.is_owned = false;
31066         LDKPong ret_var = Pong_clone(&orig_conv);
31067         int64_t ret_ref = 0;
31068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31070         return ret_ref;
31071 }
31072
31073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31074         LDKOpenChannel this_obj_conv;
31075         this_obj_conv.inner = untag_ptr(this_obj);
31076         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31078         OpenChannel_free(this_obj_conv);
31079 }
31080
31081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31082         LDKOpenChannel this_ptr_conv;
31083         this_ptr_conv.inner = untag_ptr(this_ptr);
31084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31086         this_ptr_conv.is_owned = false;
31087         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31088         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
31089         return ret_arr;
31090 }
31091
31092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31093         LDKOpenChannel this_ptr_conv;
31094         this_ptr_conv.inner = untag_ptr(this_ptr);
31095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31097         this_ptr_conv.is_owned = false;
31098         LDKThirtyTwoBytes val_ref;
31099         CHECK((*env)->GetArrayLength(env, val) == 32);
31100         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31101         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
31102 }
31103
31104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31105         LDKOpenChannel this_ptr_conv;
31106         this_ptr_conv.inner = untag_ptr(this_ptr);
31107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31109         this_ptr_conv.is_owned = false;
31110         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31111         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
31112         return ret_arr;
31113 }
31114
31115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31116         LDKOpenChannel this_ptr_conv;
31117         this_ptr_conv.inner = untag_ptr(this_ptr);
31118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31120         this_ptr_conv.is_owned = false;
31121         LDKThirtyTwoBytes val_ref;
31122         CHECK((*env)->GetArrayLength(env, val) == 32);
31123         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31124         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31125 }
31126
31127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31128         LDKOpenChannel this_ptr_conv;
31129         this_ptr_conv.inner = untag_ptr(this_ptr);
31130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31132         this_ptr_conv.is_owned = false;
31133         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
31134         return ret_conv;
31135 }
31136
31137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31138         LDKOpenChannel this_ptr_conv;
31139         this_ptr_conv.inner = untag_ptr(this_ptr);
31140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31142         this_ptr_conv.is_owned = false;
31143         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
31144 }
31145
31146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31147         LDKOpenChannel this_ptr_conv;
31148         this_ptr_conv.inner = untag_ptr(this_ptr);
31149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31151         this_ptr_conv.is_owned = false;
31152         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
31153         return ret_conv;
31154 }
31155
31156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31157         LDKOpenChannel this_ptr_conv;
31158         this_ptr_conv.inner = untag_ptr(this_ptr);
31159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31161         this_ptr_conv.is_owned = false;
31162         OpenChannel_set_push_msat(&this_ptr_conv, val);
31163 }
31164
31165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31166         LDKOpenChannel this_ptr_conv;
31167         this_ptr_conv.inner = untag_ptr(this_ptr);
31168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31170         this_ptr_conv.is_owned = false;
31171         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
31172         return ret_conv;
31173 }
31174
31175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31176         LDKOpenChannel this_ptr_conv;
31177         this_ptr_conv.inner = untag_ptr(this_ptr);
31178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31180         this_ptr_conv.is_owned = false;
31181         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31182 }
31183
31184 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) {
31185         LDKOpenChannel this_ptr_conv;
31186         this_ptr_conv.inner = untag_ptr(this_ptr);
31187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31189         this_ptr_conv.is_owned = false;
31190         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31191         return ret_conv;
31192 }
31193
31194 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) {
31195         LDKOpenChannel this_ptr_conv;
31196         this_ptr_conv.inner = untag_ptr(this_ptr);
31197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31199         this_ptr_conv.is_owned = false;
31200         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31201 }
31202
31203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31204         LDKOpenChannel this_ptr_conv;
31205         this_ptr_conv.inner = untag_ptr(this_ptr);
31206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31208         this_ptr_conv.is_owned = false;
31209         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31210         return ret_conv;
31211 }
31212
31213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31214         LDKOpenChannel this_ptr_conv;
31215         this_ptr_conv.inner = untag_ptr(this_ptr);
31216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31218         this_ptr_conv.is_owned = false;
31219         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31220 }
31221
31222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31223         LDKOpenChannel this_ptr_conv;
31224         this_ptr_conv.inner = untag_ptr(this_ptr);
31225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31227         this_ptr_conv.is_owned = false;
31228         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
31229         return ret_conv;
31230 }
31231
31232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31233         LDKOpenChannel this_ptr_conv;
31234         this_ptr_conv.inner = untag_ptr(this_ptr);
31235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31237         this_ptr_conv.is_owned = false;
31238         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31239 }
31240
31241 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
31242         LDKOpenChannel this_ptr_conv;
31243         this_ptr_conv.inner = untag_ptr(this_ptr);
31244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31246         this_ptr_conv.is_owned = false;
31247         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
31248         return ret_conv;
31249 }
31250
31251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31252         LDKOpenChannel this_ptr_conv;
31253         this_ptr_conv.inner = untag_ptr(this_ptr);
31254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31256         this_ptr_conv.is_owned = false;
31257         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
31258 }
31259
31260 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31261         LDKOpenChannel this_ptr_conv;
31262         this_ptr_conv.inner = untag_ptr(this_ptr);
31263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31265         this_ptr_conv.is_owned = false;
31266         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
31267         return ret_conv;
31268 }
31269
31270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31271         LDKOpenChannel this_ptr_conv;
31272         this_ptr_conv.inner = untag_ptr(this_ptr);
31273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31275         this_ptr_conv.is_owned = false;
31276         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
31277 }
31278
31279 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31280         LDKOpenChannel this_ptr_conv;
31281         this_ptr_conv.inner = untag_ptr(this_ptr);
31282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31284         this_ptr_conv.is_owned = false;
31285         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
31286         return ret_conv;
31287 }
31288
31289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31290         LDKOpenChannel this_ptr_conv;
31291         this_ptr_conv.inner = untag_ptr(this_ptr);
31292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31294         this_ptr_conv.is_owned = false;
31295         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31296 }
31297
31298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31299         LDKOpenChannel this_ptr_conv;
31300         this_ptr_conv.inner = untag_ptr(this_ptr);
31301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31303         this_ptr_conv.is_owned = false;
31304         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31305         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31306         return ret_arr;
31307 }
31308
31309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31310         LDKOpenChannel this_ptr_conv;
31311         this_ptr_conv.inner = untag_ptr(this_ptr);
31312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31314         this_ptr_conv.is_owned = false;
31315         LDKPublicKey val_ref;
31316         CHECK((*env)->GetArrayLength(env, val) == 33);
31317         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31318         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31319 }
31320
31321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31322         LDKOpenChannel this_ptr_conv;
31323         this_ptr_conv.inner = untag_ptr(this_ptr);
31324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31326         this_ptr_conv.is_owned = false;
31327         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31328         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31329         return ret_arr;
31330 }
31331
31332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31333         LDKOpenChannel this_ptr_conv;
31334         this_ptr_conv.inner = untag_ptr(this_ptr);
31335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31337         this_ptr_conv.is_owned = false;
31338         LDKPublicKey val_ref;
31339         CHECK((*env)->GetArrayLength(env, val) == 33);
31340         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31341         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31342 }
31343
31344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31345         LDKOpenChannel this_ptr_conv;
31346         this_ptr_conv.inner = untag_ptr(this_ptr);
31347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31349         this_ptr_conv.is_owned = false;
31350         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31351         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
31352         return ret_arr;
31353 }
31354
31355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31356         LDKOpenChannel this_ptr_conv;
31357         this_ptr_conv.inner = untag_ptr(this_ptr);
31358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31360         this_ptr_conv.is_owned = false;
31361         LDKPublicKey val_ref;
31362         CHECK((*env)->GetArrayLength(env, val) == 33);
31363         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31364         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31365 }
31366
31367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31368         LDKOpenChannel this_ptr_conv;
31369         this_ptr_conv.inner = untag_ptr(this_ptr);
31370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31372         this_ptr_conv.is_owned = false;
31373         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31374         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31375         return ret_arr;
31376 }
31377
31378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31379         LDKOpenChannel this_ptr_conv;
31380         this_ptr_conv.inner = untag_ptr(this_ptr);
31381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31383         this_ptr_conv.is_owned = false;
31384         LDKPublicKey val_ref;
31385         CHECK((*env)->GetArrayLength(env, val) == 33);
31386         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31387         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31388 }
31389
31390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31391         LDKOpenChannel this_ptr_conv;
31392         this_ptr_conv.inner = untag_ptr(this_ptr);
31393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31395         this_ptr_conv.is_owned = false;
31396         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31397         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31398         return ret_arr;
31399 }
31400
31401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31402         LDKOpenChannel this_ptr_conv;
31403         this_ptr_conv.inner = untag_ptr(this_ptr);
31404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31406         this_ptr_conv.is_owned = false;
31407         LDKPublicKey val_ref;
31408         CHECK((*env)->GetArrayLength(env, val) == 33);
31409         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31410         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31411 }
31412
31413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31414         LDKOpenChannel this_ptr_conv;
31415         this_ptr_conv.inner = untag_ptr(this_ptr);
31416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31418         this_ptr_conv.is_owned = false;
31419         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31420         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31421         return ret_arr;
31422 }
31423
31424 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) {
31425         LDKOpenChannel this_ptr_conv;
31426         this_ptr_conv.inner = untag_ptr(this_ptr);
31427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31429         this_ptr_conv.is_owned = false;
31430         LDKPublicKey val_ref;
31431         CHECK((*env)->GetArrayLength(env, val) == 33);
31432         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31433         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31434 }
31435
31436 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
31437         LDKOpenChannel this_ptr_conv;
31438         this_ptr_conv.inner = untag_ptr(this_ptr);
31439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31441         this_ptr_conv.is_owned = false;
31442         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31443         return ret_conv;
31444 }
31445
31446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
31447         LDKOpenChannel this_ptr_conv;
31448         this_ptr_conv.inner = untag_ptr(this_ptr);
31449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31451         this_ptr_conv.is_owned = false;
31452         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31453 }
31454
31455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31456         LDKOpenChannel this_ptr_conv;
31457         this_ptr_conv.inner = untag_ptr(this_ptr);
31458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31460         this_ptr_conv.is_owned = false;
31461         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31462         int64_t ret_ref = 0;
31463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31465         return ret_ref;
31466 }
31467
31468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31469         LDKOpenChannel this_ptr_conv;
31470         this_ptr_conv.inner = untag_ptr(this_ptr);
31471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31473         this_ptr_conv.is_owned = false;
31474         LDKChannelTypeFeatures val_conv;
31475         val_conv.inner = untag_ptr(val);
31476         val_conv.is_owned = ptr_is_owned(val);
31477         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31478         val_conv = ChannelTypeFeatures_clone(&val_conv);
31479         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31480 }
31481
31482 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31483         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31484         int64_t ret_ref = 0;
31485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31487         return ret_ref;
31488 }
31489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31490         LDKOpenChannel arg_conv;
31491         arg_conv.inner = untag_ptr(arg);
31492         arg_conv.is_owned = ptr_is_owned(arg);
31493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31494         arg_conv.is_owned = false;
31495         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31496         return ret_conv;
31497 }
31498
31499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31500         LDKOpenChannel orig_conv;
31501         orig_conv.inner = untag_ptr(orig);
31502         orig_conv.is_owned = ptr_is_owned(orig);
31503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31504         orig_conv.is_owned = false;
31505         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31506         int64_t ret_ref = 0;
31507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31509         return ret_ref;
31510 }
31511
31512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31513         LDKAcceptChannel this_obj_conv;
31514         this_obj_conv.inner = untag_ptr(this_obj);
31515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31517         AcceptChannel_free(this_obj_conv);
31518 }
31519
31520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31521         LDKAcceptChannel this_ptr_conv;
31522         this_ptr_conv.inner = untag_ptr(this_ptr);
31523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31525         this_ptr_conv.is_owned = false;
31526         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31527         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
31528         return ret_arr;
31529 }
31530
31531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31532         LDKAcceptChannel this_ptr_conv;
31533         this_ptr_conv.inner = untag_ptr(this_ptr);
31534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31536         this_ptr_conv.is_owned = false;
31537         LDKThirtyTwoBytes val_ref;
31538         CHECK((*env)->GetArrayLength(env, val) == 32);
31539         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31540         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31541 }
31542
31543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31544         LDKAcceptChannel this_ptr_conv;
31545         this_ptr_conv.inner = untag_ptr(this_ptr);
31546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31548         this_ptr_conv.is_owned = false;
31549         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31550         return ret_conv;
31551 }
31552
31553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31554         LDKAcceptChannel this_ptr_conv;
31555         this_ptr_conv.inner = untag_ptr(this_ptr);
31556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31558         this_ptr_conv.is_owned = false;
31559         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31560 }
31561
31562 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) {
31563         LDKAcceptChannel this_ptr_conv;
31564         this_ptr_conv.inner = untag_ptr(this_ptr);
31565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31567         this_ptr_conv.is_owned = false;
31568         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31569         return ret_conv;
31570 }
31571
31572 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) {
31573         LDKAcceptChannel this_ptr_conv;
31574         this_ptr_conv.inner = untag_ptr(this_ptr);
31575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31577         this_ptr_conv.is_owned = false;
31578         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31579 }
31580
31581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31582         LDKAcceptChannel this_ptr_conv;
31583         this_ptr_conv.inner = untag_ptr(this_ptr);
31584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31586         this_ptr_conv.is_owned = false;
31587         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31588         return ret_conv;
31589 }
31590
31591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31592         LDKAcceptChannel this_ptr_conv;
31593         this_ptr_conv.inner = untag_ptr(this_ptr);
31594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31596         this_ptr_conv.is_owned = false;
31597         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31598 }
31599
31600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31601         LDKAcceptChannel this_ptr_conv;
31602         this_ptr_conv.inner = untag_ptr(this_ptr);
31603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31605         this_ptr_conv.is_owned = false;
31606         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31607         return ret_conv;
31608 }
31609
31610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31611         LDKAcceptChannel this_ptr_conv;
31612         this_ptr_conv.inner = untag_ptr(this_ptr);
31613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31615         this_ptr_conv.is_owned = false;
31616         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31617 }
31618
31619 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
31620         LDKAcceptChannel this_ptr_conv;
31621         this_ptr_conv.inner = untag_ptr(this_ptr);
31622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31624         this_ptr_conv.is_owned = false;
31625         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31626         return ret_conv;
31627 }
31628
31629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31630         LDKAcceptChannel this_ptr_conv;
31631         this_ptr_conv.inner = untag_ptr(this_ptr);
31632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31634         this_ptr_conv.is_owned = false;
31635         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31636 }
31637
31638 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31639         LDKAcceptChannel this_ptr_conv;
31640         this_ptr_conv.inner = untag_ptr(this_ptr);
31641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31643         this_ptr_conv.is_owned = false;
31644         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31645         return ret_conv;
31646 }
31647
31648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31649         LDKAcceptChannel this_ptr_conv;
31650         this_ptr_conv.inner = untag_ptr(this_ptr);
31651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31653         this_ptr_conv.is_owned = false;
31654         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31655 }
31656
31657 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31658         LDKAcceptChannel this_ptr_conv;
31659         this_ptr_conv.inner = untag_ptr(this_ptr);
31660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31662         this_ptr_conv.is_owned = false;
31663         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31664         return ret_conv;
31665 }
31666
31667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31668         LDKAcceptChannel this_ptr_conv;
31669         this_ptr_conv.inner = untag_ptr(this_ptr);
31670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31672         this_ptr_conv.is_owned = false;
31673         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31674 }
31675
31676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31677         LDKAcceptChannel this_ptr_conv;
31678         this_ptr_conv.inner = untag_ptr(this_ptr);
31679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31681         this_ptr_conv.is_owned = false;
31682         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31683         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31684         return ret_arr;
31685 }
31686
31687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31688         LDKAcceptChannel this_ptr_conv;
31689         this_ptr_conv.inner = untag_ptr(this_ptr);
31690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31692         this_ptr_conv.is_owned = false;
31693         LDKPublicKey val_ref;
31694         CHECK((*env)->GetArrayLength(env, val) == 33);
31695         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31696         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31697 }
31698
31699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31700         LDKAcceptChannel this_ptr_conv;
31701         this_ptr_conv.inner = untag_ptr(this_ptr);
31702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31704         this_ptr_conv.is_owned = false;
31705         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31706         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31707         return ret_arr;
31708 }
31709
31710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31711         LDKAcceptChannel this_ptr_conv;
31712         this_ptr_conv.inner = untag_ptr(this_ptr);
31713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31715         this_ptr_conv.is_owned = false;
31716         LDKPublicKey val_ref;
31717         CHECK((*env)->GetArrayLength(env, val) == 33);
31718         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31719         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31720 }
31721
31722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31723         LDKAcceptChannel this_ptr_conv;
31724         this_ptr_conv.inner = untag_ptr(this_ptr);
31725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31727         this_ptr_conv.is_owned = false;
31728         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31729         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
31730         return ret_arr;
31731 }
31732
31733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31734         LDKAcceptChannel this_ptr_conv;
31735         this_ptr_conv.inner = untag_ptr(this_ptr);
31736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31738         this_ptr_conv.is_owned = false;
31739         LDKPublicKey val_ref;
31740         CHECK((*env)->GetArrayLength(env, val) == 33);
31741         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31742         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31743 }
31744
31745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31746         LDKAcceptChannel this_ptr_conv;
31747         this_ptr_conv.inner = untag_ptr(this_ptr);
31748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31750         this_ptr_conv.is_owned = false;
31751         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31752         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31753         return ret_arr;
31754 }
31755
31756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31757         LDKAcceptChannel this_ptr_conv;
31758         this_ptr_conv.inner = untag_ptr(this_ptr);
31759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31761         this_ptr_conv.is_owned = false;
31762         LDKPublicKey val_ref;
31763         CHECK((*env)->GetArrayLength(env, val) == 33);
31764         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31765         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31766 }
31767
31768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31769         LDKAcceptChannel this_ptr_conv;
31770         this_ptr_conv.inner = untag_ptr(this_ptr);
31771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31773         this_ptr_conv.is_owned = false;
31774         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31775         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31776         return ret_arr;
31777 }
31778
31779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31780         LDKAcceptChannel this_ptr_conv;
31781         this_ptr_conv.inner = untag_ptr(this_ptr);
31782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31784         this_ptr_conv.is_owned = false;
31785         LDKPublicKey val_ref;
31786         CHECK((*env)->GetArrayLength(env, val) == 33);
31787         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31788         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31789 }
31790
31791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31792         LDKAcceptChannel this_ptr_conv;
31793         this_ptr_conv.inner = untag_ptr(this_ptr);
31794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31796         this_ptr_conv.is_owned = false;
31797         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31798         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31799         return ret_arr;
31800 }
31801
31802 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) {
31803         LDKAcceptChannel this_ptr_conv;
31804         this_ptr_conv.inner = untag_ptr(this_ptr);
31805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31807         this_ptr_conv.is_owned = false;
31808         LDKPublicKey val_ref;
31809         CHECK((*env)->GetArrayLength(env, val) == 33);
31810         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31811         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31812 }
31813
31814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31815         LDKAcceptChannel this_ptr_conv;
31816         this_ptr_conv.inner = untag_ptr(this_ptr);
31817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31819         this_ptr_conv.is_owned = false;
31820         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31821         int64_t ret_ref = 0;
31822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31824         return ret_ref;
31825 }
31826
31827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31828         LDKAcceptChannel this_ptr_conv;
31829         this_ptr_conv.inner = untag_ptr(this_ptr);
31830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31832         this_ptr_conv.is_owned = false;
31833         LDKChannelTypeFeatures val_conv;
31834         val_conv.inner = untag_ptr(val);
31835         val_conv.is_owned = ptr_is_owned(val);
31836         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31837         val_conv = ChannelTypeFeatures_clone(&val_conv);
31838         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31839 }
31840
31841 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31842         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31843         int64_t ret_ref = 0;
31844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31846         return ret_ref;
31847 }
31848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31849         LDKAcceptChannel arg_conv;
31850         arg_conv.inner = untag_ptr(arg);
31851         arg_conv.is_owned = ptr_is_owned(arg);
31852         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31853         arg_conv.is_owned = false;
31854         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31855         return ret_conv;
31856 }
31857
31858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31859         LDKAcceptChannel orig_conv;
31860         orig_conv.inner = untag_ptr(orig);
31861         orig_conv.is_owned = ptr_is_owned(orig);
31862         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31863         orig_conv.is_owned = false;
31864         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31865         int64_t ret_ref = 0;
31866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31868         return ret_ref;
31869 }
31870
31871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31872         LDKFundingCreated this_obj_conv;
31873         this_obj_conv.inner = untag_ptr(this_obj);
31874         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31876         FundingCreated_free(this_obj_conv);
31877 }
31878
31879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31880         LDKFundingCreated this_ptr_conv;
31881         this_ptr_conv.inner = untag_ptr(this_ptr);
31882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31884         this_ptr_conv.is_owned = false;
31885         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31886         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
31887         return ret_arr;
31888 }
31889
31890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31891         LDKFundingCreated this_ptr_conv;
31892         this_ptr_conv.inner = untag_ptr(this_ptr);
31893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31895         this_ptr_conv.is_owned = false;
31896         LDKThirtyTwoBytes val_ref;
31897         CHECK((*env)->GetArrayLength(env, val) == 32);
31898         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31899         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31900 }
31901
31902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
31903         LDKFundingCreated this_ptr_conv;
31904         this_ptr_conv.inner = untag_ptr(this_ptr);
31905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31907         this_ptr_conv.is_owned = false;
31908         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31909         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
31910         return ret_arr;
31911 }
31912
31913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31914         LDKFundingCreated this_ptr_conv;
31915         this_ptr_conv.inner = untag_ptr(this_ptr);
31916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31918         this_ptr_conv.is_owned = false;
31919         LDKThirtyTwoBytes val_ref;
31920         CHECK((*env)->GetArrayLength(env, val) == 32);
31921         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31922         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31923 }
31924
31925 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
31926         LDKFundingCreated this_ptr_conv;
31927         this_ptr_conv.inner = untag_ptr(this_ptr);
31928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31930         this_ptr_conv.is_owned = false;
31931         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31932         return ret_conv;
31933 }
31934
31935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31936         LDKFundingCreated this_ptr_conv;
31937         this_ptr_conv.inner = untag_ptr(this_ptr);
31938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31940         this_ptr_conv.is_owned = false;
31941         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31942 }
31943
31944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31945         LDKFundingCreated this_ptr_conv;
31946         this_ptr_conv.inner = untag_ptr(this_ptr);
31947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31949         this_ptr_conv.is_owned = false;
31950         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31951         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
31952         return ret_arr;
31953 }
31954
31955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31956         LDKFundingCreated this_ptr_conv;
31957         this_ptr_conv.inner = untag_ptr(this_ptr);
31958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31960         this_ptr_conv.is_owned = false;
31961         LDKSignature val_ref;
31962         CHECK((*env)->GetArrayLength(env, val) == 64);
31963         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31964         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31965 }
31966
31967 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) {
31968         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31969         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
31970         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
31971         LDKThirtyTwoBytes funding_txid_arg_ref;
31972         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
31973         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
31974         LDKSignature signature_arg_ref;
31975         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31976         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31977         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31978         int64_t ret_ref = 0;
31979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31981         return ret_ref;
31982 }
31983
31984 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31985         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31986         int64_t ret_ref = 0;
31987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31989         return ret_ref;
31990 }
31991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31992         LDKFundingCreated arg_conv;
31993         arg_conv.inner = untag_ptr(arg);
31994         arg_conv.is_owned = ptr_is_owned(arg);
31995         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31996         arg_conv.is_owned = false;
31997         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31998         return ret_conv;
31999 }
32000
32001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32002         LDKFundingCreated orig_conv;
32003         orig_conv.inner = untag_ptr(orig);
32004         orig_conv.is_owned = ptr_is_owned(orig);
32005         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32006         orig_conv.is_owned = false;
32007         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
32008         int64_t ret_ref = 0;
32009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32011         return ret_ref;
32012 }
32013
32014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32015         LDKFundingSigned this_obj_conv;
32016         this_obj_conv.inner = untag_ptr(this_obj);
32017         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32019         FundingSigned_free(this_obj_conv);
32020 }
32021
32022 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32023         LDKFundingSigned this_ptr_conv;
32024         this_ptr_conv.inner = untag_ptr(this_ptr);
32025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32027         this_ptr_conv.is_owned = false;
32028         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32029         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
32030         return ret_arr;
32031 }
32032
32033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32034         LDKFundingSigned this_ptr_conv;
32035         this_ptr_conv.inner = untag_ptr(this_ptr);
32036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32038         this_ptr_conv.is_owned = false;
32039         LDKThirtyTwoBytes val_ref;
32040         CHECK((*env)->GetArrayLength(env, val) == 32);
32041         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32042         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
32043 }
32044
32045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32046         LDKFundingSigned this_ptr_conv;
32047         this_ptr_conv.inner = untag_ptr(this_ptr);
32048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32050         this_ptr_conv.is_owned = false;
32051         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32052         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
32053         return ret_arr;
32054 }
32055
32056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32057         LDKFundingSigned this_ptr_conv;
32058         this_ptr_conv.inner = untag_ptr(this_ptr);
32059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32061         this_ptr_conv.is_owned = false;
32062         LDKSignature val_ref;
32063         CHECK((*env)->GetArrayLength(env, val) == 64);
32064         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32065         FundingSigned_set_signature(&this_ptr_conv, val_ref);
32066 }
32067
32068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
32069         LDKThirtyTwoBytes channel_id_arg_ref;
32070         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32071         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32072         LDKSignature signature_arg_ref;
32073         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32074         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32075         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
32076         int64_t ret_ref = 0;
32077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32079         return ret_ref;
32080 }
32081
32082 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
32083         LDKFundingSigned ret_var = FundingSigned_clone(arg);
32084         int64_t ret_ref = 0;
32085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32087         return ret_ref;
32088 }
32089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32090         LDKFundingSigned arg_conv;
32091         arg_conv.inner = untag_ptr(arg);
32092         arg_conv.is_owned = ptr_is_owned(arg);
32093         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32094         arg_conv.is_owned = false;
32095         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
32096         return ret_conv;
32097 }
32098
32099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32100         LDKFundingSigned orig_conv;
32101         orig_conv.inner = untag_ptr(orig);
32102         orig_conv.is_owned = ptr_is_owned(orig);
32103         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32104         orig_conv.is_owned = false;
32105         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
32106         int64_t ret_ref = 0;
32107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32109         return ret_ref;
32110 }
32111
32112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32113         LDKChannelReady this_obj_conv;
32114         this_obj_conv.inner = untag_ptr(this_obj);
32115         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32117         ChannelReady_free(this_obj_conv);
32118 }
32119
32120 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32121         LDKChannelReady this_ptr_conv;
32122         this_ptr_conv.inner = untag_ptr(this_ptr);
32123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32125         this_ptr_conv.is_owned = false;
32126         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32127         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
32128         return ret_arr;
32129 }
32130
32131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32132         LDKChannelReady this_ptr_conv;
32133         this_ptr_conv.inner = untag_ptr(this_ptr);
32134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32136         this_ptr_conv.is_owned = false;
32137         LDKThirtyTwoBytes val_ref;
32138         CHECK((*env)->GetArrayLength(env, val) == 32);
32139         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32140         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
32141 }
32142
32143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32144         LDKChannelReady this_ptr_conv;
32145         this_ptr_conv.inner = untag_ptr(this_ptr);
32146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32148         this_ptr_conv.is_owned = false;
32149         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32150         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
32151         return ret_arr;
32152 }
32153
32154 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) {
32155         LDKChannelReady this_ptr_conv;
32156         this_ptr_conv.inner = untag_ptr(this_ptr);
32157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32159         this_ptr_conv.is_owned = false;
32160         LDKPublicKey val_ref;
32161         CHECK((*env)->GetArrayLength(env, val) == 33);
32162         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32163         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32164 }
32165
32166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
32167         LDKChannelReady this_ptr_conv;
32168         this_ptr_conv.inner = untag_ptr(this_ptr);
32169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32171         this_ptr_conv.is_owned = false;
32172         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32173         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
32174         int64_t ret_ref = tag_ptr(ret_copy, true);
32175         return ret_ref;
32176 }
32177
32178 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) {
32179         LDKChannelReady this_ptr_conv;
32180         this_ptr_conv.inner = untag_ptr(this_ptr);
32181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32183         this_ptr_conv.is_owned = false;
32184         void* val_ptr = untag_ptr(val);
32185         CHECK_ACCESS(val_ptr);
32186         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32187         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32188         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
32189 }
32190
32191 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) {
32192         LDKThirtyTwoBytes channel_id_arg_ref;
32193         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32194         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32195         LDKPublicKey next_per_commitment_point_arg_ref;
32196         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
32197         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
32198         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
32199         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
32200         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
32201         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
32202         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
32203         int64_t ret_ref = 0;
32204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32206         return ret_ref;
32207 }
32208
32209 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
32210         LDKChannelReady ret_var = ChannelReady_clone(arg);
32211         int64_t ret_ref = 0;
32212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32214         return ret_ref;
32215 }
32216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32217         LDKChannelReady arg_conv;
32218         arg_conv.inner = untag_ptr(arg);
32219         arg_conv.is_owned = ptr_is_owned(arg);
32220         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32221         arg_conv.is_owned = false;
32222         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
32223         return ret_conv;
32224 }
32225
32226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32227         LDKChannelReady orig_conv;
32228         orig_conv.inner = untag_ptr(orig);
32229         orig_conv.is_owned = ptr_is_owned(orig);
32230         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32231         orig_conv.is_owned = false;
32232         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
32233         int64_t ret_ref = 0;
32234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32236         return ret_ref;
32237 }
32238
32239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32240         LDKShutdown this_obj_conv;
32241         this_obj_conv.inner = untag_ptr(this_obj);
32242         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32244         Shutdown_free(this_obj_conv);
32245 }
32246
32247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32248         LDKShutdown this_ptr_conv;
32249         this_ptr_conv.inner = untag_ptr(this_ptr);
32250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32252         this_ptr_conv.is_owned = false;
32253         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32254         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
32255         return ret_arr;
32256 }
32257
32258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32259         LDKShutdown this_ptr_conv;
32260         this_ptr_conv.inner = untag_ptr(this_ptr);
32261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32263         this_ptr_conv.is_owned = false;
32264         LDKThirtyTwoBytes val_ref;
32265         CHECK((*env)->GetArrayLength(env, val) == 32);
32266         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32267         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32268 }
32269
32270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32271         LDKShutdown this_ptr_conv;
32272         this_ptr_conv.inner = untag_ptr(this_ptr);
32273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32275         this_ptr_conv.is_owned = false;
32276         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32277         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32278         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32279         return ret_arr;
32280 }
32281
32282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32283         LDKShutdown this_ptr_conv;
32284         this_ptr_conv.inner = untag_ptr(this_ptr);
32285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32287         this_ptr_conv.is_owned = false;
32288         LDKCVec_u8Z val_ref;
32289         val_ref.datalen = (*env)->GetArrayLength(env, val);
32290         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32291         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
32292         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32293 }
32294
32295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32296         LDKThirtyTwoBytes channel_id_arg_ref;
32297         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32298         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32299         LDKCVec_u8Z scriptpubkey_arg_ref;
32300         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
32301         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32302         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
32303         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32304         int64_t ret_ref = 0;
32305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32307         return ret_ref;
32308 }
32309
32310 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32311         LDKShutdown ret_var = Shutdown_clone(arg);
32312         int64_t ret_ref = 0;
32313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32315         return ret_ref;
32316 }
32317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32318         LDKShutdown arg_conv;
32319         arg_conv.inner = untag_ptr(arg);
32320         arg_conv.is_owned = ptr_is_owned(arg);
32321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32322         arg_conv.is_owned = false;
32323         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32324         return ret_conv;
32325 }
32326
32327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32328         LDKShutdown orig_conv;
32329         orig_conv.inner = untag_ptr(orig);
32330         orig_conv.is_owned = ptr_is_owned(orig);
32331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32332         orig_conv.is_owned = false;
32333         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32334         int64_t ret_ref = 0;
32335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32337         return ret_ref;
32338 }
32339
32340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32341         LDKClosingSignedFeeRange this_obj_conv;
32342         this_obj_conv.inner = untag_ptr(this_obj);
32343         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32345         ClosingSignedFeeRange_free(this_obj_conv);
32346 }
32347
32348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32349         LDKClosingSignedFeeRange this_ptr_conv;
32350         this_ptr_conv.inner = untag_ptr(this_ptr);
32351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32353         this_ptr_conv.is_owned = false;
32354         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32355         return ret_conv;
32356 }
32357
32358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32359         LDKClosingSignedFeeRange this_ptr_conv;
32360         this_ptr_conv.inner = untag_ptr(this_ptr);
32361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32363         this_ptr_conv.is_owned = false;
32364         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32365 }
32366
32367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32368         LDKClosingSignedFeeRange this_ptr_conv;
32369         this_ptr_conv.inner = untag_ptr(this_ptr);
32370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32372         this_ptr_conv.is_owned = false;
32373         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32374         return ret_conv;
32375 }
32376
32377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32378         LDKClosingSignedFeeRange this_ptr_conv;
32379         this_ptr_conv.inner = untag_ptr(this_ptr);
32380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32382         this_ptr_conv.is_owned = false;
32383         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32384 }
32385
32386 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) {
32387         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32388         int64_t ret_ref = 0;
32389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32391         return ret_ref;
32392 }
32393
32394 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32395         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32396         int64_t ret_ref = 0;
32397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32399         return ret_ref;
32400 }
32401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32402         LDKClosingSignedFeeRange arg_conv;
32403         arg_conv.inner = untag_ptr(arg);
32404         arg_conv.is_owned = ptr_is_owned(arg);
32405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32406         arg_conv.is_owned = false;
32407         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32408         return ret_conv;
32409 }
32410
32411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32412         LDKClosingSignedFeeRange orig_conv;
32413         orig_conv.inner = untag_ptr(orig);
32414         orig_conv.is_owned = ptr_is_owned(orig);
32415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32416         orig_conv.is_owned = false;
32417         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32418         int64_t ret_ref = 0;
32419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32421         return ret_ref;
32422 }
32423
32424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32425         LDKClosingSigned this_obj_conv;
32426         this_obj_conv.inner = untag_ptr(this_obj);
32427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32429         ClosingSigned_free(this_obj_conv);
32430 }
32431
32432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32433         LDKClosingSigned this_ptr_conv;
32434         this_ptr_conv.inner = untag_ptr(this_ptr);
32435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32437         this_ptr_conv.is_owned = false;
32438         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32439         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
32440         return ret_arr;
32441 }
32442
32443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32444         LDKClosingSigned this_ptr_conv;
32445         this_ptr_conv.inner = untag_ptr(this_ptr);
32446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32448         this_ptr_conv.is_owned = false;
32449         LDKThirtyTwoBytes val_ref;
32450         CHECK((*env)->GetArrayLength(env, val) == 32);
32451         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32452         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32453 }
32454
32455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32456         LDKClosingSigned this_ptr_conv;
32457         this_ptr_conv.inner = untag_ptr(this_ptr);
32458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32460         this_ptr_conv.is_owned = false;
32461         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32462         return ret_conv;
32463 }
32464
32465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32466         LDKClosingSigned this_ptr_conv;
32467         this_ptr_conv.inner = untag_ptr(this_ptr);
32468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32470         this_ptr_conv.is_owned = false;
32471         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32472 }
32473
32474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32475         LDKClosingSigned this_ptr_conv;
32476         this_ptr_conv.inner = untag_ptr(this_ptr);
32477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32479         this_ptr_conv.is_owned = false;
32480         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32481         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
32482         return ret_arr;
32483 }
32484
32485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32486         LDKClosingSigned this_ptr_conv;
32487         this_ptr_conv.inner = untag_ptr(this_ptr);
32488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32490         this_ptr_conv.is_owned = false;
32491         LDKSignature val_ref;
32492         CHECK((*env)->GetArrayLength(env, val) == 64);
32493         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32494         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32495 }
32496
32497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
32498         LDKClosingSigned this_ptr_conv;
32499         this_ptr_conv.inner = untag_ptr(this_ptr);
32500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32502         this_ptr_conv.is_owned = false;
32503         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32504         int64_t ret_ref = 0;
32505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32507         return ret_ref;
32508 }
32509
32510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32511         LDKClosingSigned this_ptr_conv;
32512         this_ptr_conv.inner = untag_ptr(this_ptr);
32513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32515         this_ptr_conv.is_owned = false;
32516         LDKClosingSignedFeeRange val_conv;
32517         val_conv.inner = untag_ptr(val);
32518         val_conv.is_owned = ptr_is_owned(val);
32519         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32520         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32521         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32522 }
32523
32524 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) {
32525         LDKThirtyTwoBytes channel_id_arg_ref;
32526         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32527         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32528         LDKSignature signature_arg_ref;
32529         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32530         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32531         LDKClosingSignedFeeRange fee_range_arg_conv;
32532         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32533         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32534         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32535         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32536         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32537         int64_t ret_ref = 0;
32538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32540         return ret_ref;
32541 }
32542
32543 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32544         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32545         int64_t ret_ref = 0;
32546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32548         return ret_ref;
32549 }
32550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32551         LDKClosingSigned arg_conv;
32552         arg_conv.inner = untag_ptr(arg);
32553         arg_conv.is_owned = ptr_is_owned(arg);
32554         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32555         arg_conv.is_owned = false;
32556         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32557         return ret_conv;
32558 }
32559
32560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32561         LDKClosingSigned orig_conv;
32562         orig_conv.inner = untag_ptr(orig);
32563         orig_conv.is_owned = ptr_is_owned(orig);
32564         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32565         orig_conv.is_owned = false;
32566         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32567         int64_t ret_ref = 0;
32568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32570         return ret_ref;
32571 }
32572
32573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32574         LDKUpdateAddHTLC this_obj_conv;
32575         this_obj_conv.inner = untag_ptr(this_obj);
32576         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32578         UpdateAddHTLC_free(this_obj_conv);
32579 }
32580
32581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32582         LDKUpdateAddHTLC this_ptr_conv;
32583         this_ptr_conv.inner = untag_ptr(this_ptr);
32584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32586         this_ptr_conv.is_owned = false;
32587         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32588         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
32589         return ret_arr;
32590 }
32591
32592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32593         LDKUpdateAddHTLC this_ptr_conv;
32594         this_ptr_conv.inner = untag_ptr(this_ptr);
32595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32597         this_ptr_conv.is_owned = false;
32598         LDKThirtyTwoBytes val_ref;
32599         CHECK((*env)->GetArrayLength(env, val) == 32);
32600         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32601         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32602 }
32603
32604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32605         LDKUpdateAddHTLC this_ptr_conv;
32606         this_ptr_conv.inner = untag_ptr(this_ptr);
32607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32609         this_ptr_conv.is_owned = false;
32610         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32611         return ret_conv;
32612 }
32613
32614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32615         LDKUpdateAddHTLC this_ptr_conv;
32616         this_ptr_conv.inner = untag_ptr(this_ptr);
32617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32619         this_ptr_conv.is_owned = false;
32620         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32621 }
32622
32623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32624         LDKUpdateAddHTLC this_ptr_conv;
32625         this_ptr_conv.inner = untag_ptr(this_ptr);
32626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32628         this_ptr_conv.is_owned = false;
32629         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32630         return ret_conv;
32631 }
32632
32633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32634         LDKUpdateAddHTLC this_ptr_conv;
32635         this_ptr_conv.inner = untag_ptr(this_ptr);
32636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32638         this_ptr_conv.is_owned = false;
32639         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32640 }
32641
32642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32643         LDKUpdateAddHTLC this_ptr_conv;
32644         this_ptr_conv.inner = untag_ptr(this_ptr);
32645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32647         this_ptr_conv.is_owned = false;
32648         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32649         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
32650         return ret_arr;
32651 }
32652
32653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32654         LDKUpdateAddHTLC this_ptr_conv;
32655         this_ptr_conv.inner = untag_ptr(this_ptr);
32656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32658         this_ptr_conv.is_owned = false;
32659         LDKThirtyTwoBytes val_ref;
32660         CHECK((*env)->GetArrayLength(env, val) == 32);
32661         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32662         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32663 }
32664
32665 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
32666         LDKUpdateAddHTLC this_ptr_conv;
32667         this_ptr_conv.inner = untag_ptr(this_ptr);
32668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32670         this_ptr_conv.is_owned = false;
32671         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32672         return ret_conv;
32673 }
32674
32675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32676         LDKUpdateAddHTLC this_ptr_conv;
32677         this_ptr_conv.inner = untag_ptr(this_ptr);
32678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32680         this_ptr_conv.is_owned = false;
32681         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32682 }
32683
32684 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32685         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32686         int64_t ret_ref = 0;
32687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32689         return ret_ref;
32690 }
32691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32692         LDKUpdateAddHTLC arg_conv;
32693         arg_conv.inner = untag_ptr(arg);
32694         arg_conv.is_owned = ptr_is_owned(arg);
32695         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32696         arg_conv.is_owned = false;
32697         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32698         return ret_conv;
32699 }
32700
32701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32702         LDKUpdateAddHTLC orig_conv;
32703         orig_conv.inner = untag_ptr(orig);
32704         orig_conv.is_owned = ptr_is_owned(orig);
32705         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32706         orig_conv.is_owned = false;
32707         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32708         int64_t ret_ref = 0;
32709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32711         return ret_ref;
32712 }
32713
32714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32715         LDKUpdateFulfillHTLC this_obj_conv;
32716         this_obj_conv.inner = untag_ptr(this_obj);
32717         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32719         UpdateFulfillHTLC_free(this_obj_conv);
32720 }
32721
32722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32723         LDKUpdateFulfillHTLC this_ptr_conv;
32724         this_ptr_conv.inner = untag_ptr(this_ptr);
32725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32727         this_ptr_conv.is_owned = false;
32728         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32729         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
32730         return ret_arr;
32731 }
32732
32733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32734         LDKUpdateFulfillHTLC this_ptr_conv;
32735         this_ptr_conv.inner = untag_ptr(this_ptr);
32736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32738         this_ptr_conv.is_owned = false;
32739         LDKThirtyTwoBytes val_ref;
32740         CHECK((*env)->GetArrayLength(env, val) == 32);
32741         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32742         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32743 }
32744
32745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32746         LDKUpdateFulfillHTLC this_ptr_conv;
32747         this_ptr_conv.inner = untag_ptr(this_ptr);
32748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32750         this_ptr_conv.is_owned = false;
32751         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32752         return ret_conv;
32753 }
32754
32755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32756         LDKUpdateFulfillHTLC this_ptr_conv;
32757         this_ptr_conv.inner = untag_ptr(this_ptr);
32758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32760         this_ptr_conv.is_owned = false;
32761         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32762 }
32763
32764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
32765         LDKUpdateFulfillHTLC this_ptr_conv;
32766         this_ptr_conv.inner = untag_ptr(this_ptr);
32767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32769         this_ptr_conv.is_owned = false;
32770         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32771         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
32772         return ret_arr;
32773 }
32774
32775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32776         LDKUpdateFulfillHTLC this_ptr_conv;
32777         this_ptr_conv.inner = untag_ptr(this_ptr);
32778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32780         this_ptr_conv.is_owned = false;
32781         LDKThirtyTwoBytes val_ref;
32782         CHECK((*env)->GetArrayLength(env, val) == 32);
32783         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32784         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32785 }
32786
32787 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) {
32788         LDKThirtyTwoBytes channel_id_arg_ref;
32789         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32790         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32791         LDKThirtyTwoBytes payment_preimage_arg_ref;
32792         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
32793         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
32794         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32795         int64_t ret_ref = 0;
32796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32798         return ret_ref;
32799 }
32800
32801 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32802         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32803         int64_t ret_ref = 0;
32804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32806         return ret_ref;
32807 }
32808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32809         LDKUpdateFulfillHTLC arg_conv;
32810         arg_conv.inner = untag_ptr(arg);
32811         arg_conv.is_owned = ptr_is_owned(arg);
32812         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32813         arg_conv.is_owned = false;
32814         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32815         return ret_conv;
32816 }
32817
32818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32819         LDKUpdateFulfillHTLC orig_conv;
32820         orig_conv.inner = untag_ptr(orig);
32821         orig_conv.is_owned = ptr_is_owned(orig);
32822         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32823         orig_conv.is_owned = false;
32824         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32825         int64_t ret_ref = 0;
32826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32828         return ret_ref;
32829 }
32830
32831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32832         LDKUpdateFailHTLC this_obj_conv;
32833         this_obj_conv.inner = untag_ptr(this_obj);
32834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32836         UpdateFailHTLC_free(this_obj_conv);
32837 }
32838
32839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32840         LDKUpdateFailHTLC this_ptr_conv;
32841         this_ptr_conv.inner = untag_ptr(this_ptr);
32842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32844         this_ptr_conv.is_owned = false;
32845         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32846         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
32847         return ret_arr;
32848 }
32849
32850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32851         LDKUpdateFailHTLC this_ptr_conv;
32852         this_ptr_conv.inner = untag_ptr(this_ptr);
32853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32855         this_ptr_conv.is_owned = false;
32856         LDKThirtyTwoBytes val_ref;
32857         CHECK((*env)->GetArrayLength(env, val) == 32);
32858         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32859         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32860 }
32861
32862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32863         LDKUpdateFailHTLC this_ptr_conv;
32864         this_ptr_conv.inner = untag_ptr(this_ptr);
32865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32867         this_ptr_conv.is_owned = false;
32868         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32869         return ret_conv;
32870 }
32871
32872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32873         LDKUpdateFailHTLC this_ptr_conv;
32874         this_ptr_conv.inner = untag_ptr(this_ptr);
32875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32877         this_ptr_conv.is_owned = false;
32878         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32879 }
32880
32881 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32882         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32883         int64_t ret_ref = 0;
32884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32886         return ret_ref;
32887 }
32888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32889         LDKUpdateFailHTLC arg_conv;
32890         arg_conv.inner = untag_ptr(arg);
32891         arg_conv.is_owned = ptr_is_owned(arg);
32892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32893         arg_conv.is_owned = false;
32894         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32895         return ret_conv;
32896 }
32897
32898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32899         LDKUpdateFailHTLC orig_conv;
32900         orig_conv.inner = untag_ptr(orig);
32901         orig_conv.is_owned = ptr_is_owned(orig);
32902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32903         orig_conv.is_owned = false;
32904         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32905         int64_t ret_ref = 0;
32906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32908         return ret_ref;
32909 }
32910
32911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32912         LDKUpdateFailMalformedHTLC this_obj_conv;
32913         this_obj_conv.inner = untag_ptr(this_obj);
32914         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32916         UpdateFailMalformedHTLC_free(this_obj_conv);
32917 }
32918
32919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32920         LDKUpdateFailMalformedHTLC this_ptr_conv;
32921         this_ptr_conv.inner = untag_ptr(this_ptr);
32922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32924         this_ptr_conv.is_owned = false;
32925         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32926         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
32927         return ret_arr;
32928 }
32929
32930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32931         LDKUpdateFailMalformedHTLC this_ptr_conv;
32932         this_ptr_conv.inner = untag_ptr(this_ptr);
32933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32935         this_ptr_conv.is_owned = false;
32936         LDKThirtyTwoBytes val_ref;
32937         CHECK((*env)->GetArrayLength(env, val) == 32);
32938         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32939         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32940 }
32941
32942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32943         LDKUpdateFailMalformedHTLC this_ptr_conv;
32944         this_ptr_conv.inner = untag_ptr(this_ptr);
32945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32947         this_ptr_conv.is_owned = false;
32948         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32949         return ret_conv;
32950 }
32951
32952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32953         LDKUpdateFailMalformedHTLC this_ptr_conv;
32954         this_ptr_conv.inner = untag_ptr(this_ptr);
32955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32957         this_ptr_conv.is_owned = false;
32958         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32959 }
32960
32961 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
32962         LDKUpdateFailMalformedHTLC this_ptr_conv;
32963         this_ptr_conv.inner = untag_ptr(this_ptr);
32964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32966         this_ptr_conv.is_owned = false;
32967         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32968         return ret_conv;
32969 }
32970
32971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32972         LDKUpdateFailMalformedHTLC this_ptr_conv;
32973         this_ptr_conv.inner = untag_ptr(this_ptr);
32974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32976         this_ptr_conv.is_owned = false;
32977         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32978 }
32979
32980 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32981         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32982         int64_t ret_ref = 0;
32983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32985         return ret_ref;
32986 }
32987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32988         LDKUpdateFailMalformedHTLC arg_conv;
32989         arg_conv.inner = untag_ptr(arg);
32990         arg_conv.is_owned = ptr_is_owned(arg);
32991         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32992         arg_conv.is_owned = false;
32993         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32994         return ret_conv;
32995 }
32996
32997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32998         LDKUpdateFailMalformedHTLC orig_conv;
32999         orig_conv.inner = untag_ptr(orig);
33000         orig_conv.is_owned = ptr_is_owned(orig);
33001         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33002         orig_conv.is_owned = false;
33003         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
33004         int64_t ret_ref = 0;
33005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33007         return ret_ref;
33008 }
33009
33010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33011         LDKCommitmentSigned this_obj_conv;
33012         this_obj_conv.inner = untag_ptr(this_obj);
33013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33015         CommitmentSigned_free(this_obj_conv);
33016 }
33017
33018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33019         LDKCommitmentSigned this_ptr_conv;
33020         this_ptr_conv.inner = untag_ptr(this_ptr);
33021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33023         this_ptr_conv.is_owned = false;
33024         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33025         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
33026         return ret_arr;
33027 }
33028
33029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33030         LDKCommitmentSigned this_ptr_conv;
33031         this_ptr_conv.inner = untag_ptr(this_ptr);
33032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33034         this_ptr_conv.is_owned = false;
33035         LDKThirtyTwoBytes val_ref;
33036         CHECK((*env)->GetArrayLength(env, val) == 32);
33037         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33038         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
33039 }
33040
33041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33042         LDKCommitmentSigned this_ptr_conv;
33043         this_ptr_conv.inner = untag_ptr(this_ptr);
33044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33046         this_ptr_conv.is_owned = false;
33047         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33048         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
33049         return ret_arr;
33050 }
33051
33052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33053         LDKCommitmentSigned this_ptr_conv;
33054         this_ptr_conv.inner = untag_ptr(this_ptr);
33055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33057         this_ptr_conv.is_owned = false;
33058         LDKSignature val_ref;
33059         CHECK((*env)->GetArrayLength(env, val) == 64);
33060         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33061         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
33062 }
33063
33064 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
33065         LDKCommitmentSigned this_ptr_conv;
33066         this_ptr_conv.inner = untag_ptr(this_ptr);
33067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33069         this_ptr_conv.is_owned = false;
33070         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
33071         jobjectArray ret_arr = NULL;
33072         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
33073         ;
33074         for (size_t i = 0; i < ret_var.datalen; i++) {
33075                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
33076                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
33077                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
33078         }
33079         
33080         FREE(ret_var.data);
33081         return ret_arr;
33082 }
33083
33084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
33085         LDKCommitmentSigned this_ptr_conv;
33086         this_ptr_conv.inner = untag_ptr(this_ptr);
33087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33089         this_ptr_conv.is_owned = false;
33090         LDKCVec_SignatureZ val_constr;
33091         val_constr.datalen = (*env)->GetArrayLength(env, val);
33092         if (val_constr.datalen > 0)
33093                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33094         else
33095                 val_constr.data = NULL;
33096         for (size_t i = 0; i < val_constr.datalen; i++) {
33097                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
33098                 LDKSignature val_conv_8_ref;
33099                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
33100                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
33101                 val_constr.data[i] = val_conv_8_ref;
33102         }
33103         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33104 }
33105
33106 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) {
33107         LDKThirtyTwoBytes channel_id_arg_ref;
33108         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33109         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33110         LDKSignature signature_arg_ref;
33111         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33112         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33113         LDKCVec_SignatureZ htlc_signatures_arg_constr;
33114         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
33115         if (htlc_signatures_arg_constr.datalen > 0)
33116                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33117         else
33118                 htlc_signatures_arg_constr.data = NULL;
33119         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
33120                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
33121                 LDKSignature htlc_signatures_arg_conv_8_ref;
33122                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
33123                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
33124                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
33125         }
33126         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33127         int64_t ret_ref = 0;
33128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33130         return ret_ref;
33131 }
33132
33133 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33134         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33135         int64_t ret_ref = 0;
33136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33138         return ret_ref;
33139 }
33140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33141         LDKCommitmentSigned arg_conv;
33142         arg_conv.inner = untag_ptr(arg);
33143         arg_conv.is_owned = ptr_is_owned(arg);
33144         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33145         arg_conv.is_owned = false;
33146         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33147         return ret_conv;
33148 }
33149
33150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33151         LDKCommitmentSigned orig_conv;
33152         orig_conv.inner = untag_ptr(orig);
33153         orig_conv.is_owned = ptr_is_owned(orig);
33154         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33155         orig_conv.is_owned = false;
33156         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33157         int64_t ret_ref = 0;
33158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33160         return ret_ref;
33161 }
33162
33163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33164         LDKRevokeAndACK this_obj_conv;
33165         this_obj_conv.inner = untag_ptr(this_obj);
33166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33168         RevokeAndACK_free(this_obj_conv);
33169 }
33170
33171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33172         LDKRevokeAndACK this_ptr_conv;
33173         this_ptr_conv.inner = untag_ptr(this_ptr);
33174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33176         this_ptr_conv.is_owned = false;
33177         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33178         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
33179         return ret_arr;
33180 }
33181
33182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33183         LDKRevokeAndACK this_ptr_conv;
33184         this_ptr_conv.inner = untag_ptr(this_ptr);
33185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33187         this_ptr_conv.is_owned = false;
33188         LDKThirtyTwoBytes val_ref;
33189         CHECK((*env)->GetArrayLength(env, val) == 32);
33190         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33191         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33192 }
33193
33194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33195         LDKRevokeAndACK this_ptr_conv;
33196         this_ptr_conv.inner = untag_ptr(this_ptr);
33197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33199         this_ptr_conv.is_owned = false;
33200         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33201         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
33202         return ret_arr;
33203 }
33204
33205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33206         LDKRevokeAndACK this_ptr_conv;
33207         this_ptr_conv.inner = untag_ptr(this_ptr);
33208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33210         this_ptr_conv.is_owned = false;
33211         LDKThirtyTwoBytes val_ref;
33212         CHECK((*env)->GetArrayLength(env, val) == 32);
33213         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33214         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33215 }
33216
33217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33218         LDKRevokeAndACK this_ptr_conv;
33219         this_ptr_conv.inner = untag_ptr(this_ptr);
33220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33222         this_ptr_conv.is_owned = false;
33223         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33224         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
33225         return ret_arr;
33226 }
33227
33228 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) {
33229         LDKRevokeAndACK this_ptr_conv;
33230         this_ptr_conv.inner = untag_ptr(this_ptr);
33231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33233         this_ptr_conv.is_owned = false;
33234         LDKPublicKey val_ref;
33235         CHECK((*env)->GetArrayLength(env, val) == 33);
33236         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33237         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33238 }
33239
33240 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) {
33241         LDKThirtyTwoBytes channel_id_arg_ref;
33242         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33243         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33244         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33245         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
33246         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
33247         LDKPublicKey next_per_commitment_point_arg_ref;
33248         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
33249         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
33250         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33251         int64_t ret_ref = 0;
33252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33254         return ret_ref;
33255 }
33256
33257 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33258         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33259         int64_t ret_ref = 0;
33260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33262         return ret_ref;
33263 }
33264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33265         LDKRevokeAndACK arg_conv;
33266         arg_conv.inner = untag_ptr(arg);
33267         arg_conv.is_owned = ptr_is_owned(arg);
33268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33269         arg_conv.is_owned = false;
33270         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33271         return ret_conv;
33272 }
33273
33274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33275         LDKRevokeAndACK orig_conv;
33276         orig_conv.inner = untag_ptr(orig);
33277         orig_conv.is_owned = ptr_is_owned(orig);
33278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33279         orig_conv.is_owned = false;
33280         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33281         int64_t ret_ref = 0;
33282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33284         return ret_ref;
33285 }
33286
33287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33288         LDKUpdateFee this_obj_conv;
33289         this_obj_conv.inner = untag_ptr(this_obj);
33290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33292         UpdateFee_free(this_obj_conv);
33293 }
33294
33295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33296         LDKUpdateFee this_ptr_conv;
33297         this_ptr_conv.inner = untag_ptr(this_ptr);
33298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33300         this_ptr_conv.is_owned = false;
33301         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33302         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
33303         return ret_arr;
33304 }
33305
33306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33307         LDKUpdateFee this_ptr_conv;
33308         this_ptr_conv.inner = untag_ptr(this_ptr);
33309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33311         this_ptr_conv.is_owned = false;
33312         LDKThirtyTwoBytes val_ref;
33313         CHECK((*env)->GetArrayLength(env, val) == 32);
33314         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33315         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33316 }
33317
33318 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
33319         LDKUpdateFee this_ptr_conv;
33320         this_ptr_conv.inner = untag_ptr(this_ptr);
33321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33323         this_ptr_conv.is_owned = false;
33324         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33325         return ret_conv;
33326 }
33327
33328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33329         LDKUpdateFee this_ptr_conv;
33330         this_ptr_conv.inner = untag_ptr(this_ptr);
33331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33333         this_ptr_conv.is_owned = false;
33334         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33335 }
33336
33337 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) {
33338         LDKThirtyTwoBytes channel_id_arg_ref;
33339         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33340         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33341         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33342         int64_t ret_ref = 0;
33343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33345         return ret_ref;
33346 }
33347
33348 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33349         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33350         int64_t ret_ref = 0;
33351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33353         return ret_ref;
33354 }
33355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33356         LDKUpdateFee arg_conv;
33357         arg_conv.inner = untag_ptr(arg);
33358         arg_conv.is_owned = ptr_is_owned(arg);
33359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33360         arg_conv.is_owned = false;
33361         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33362         return ret_conv;
33363 }
33364
33365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33366         LDKUpdateFee orig_conv;
33367         orig_conv.inner = untag_ptr(orig);
33368         orig_conv.is_owned = ptr_is_owned(orig);
33369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33370         orig_conv.is_owned = false;
33371         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33372         int64_t ret_ref = 0;
33373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33375         return ret_ref;
33376 }
33377
33378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33379         LDKDataLossProtect this_obj_conv;
33380         this_obj_conv.inner = untag_ptr(this_obj);
33381         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33383         DataLossProtect_free(this_obj_conv);
33384 }
33385
33386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33387         LDKDataLossProtect this_ptr_conv;
33388         this_ptr_conv.inner = untag_ptr(this_ptr);
33389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33391         this_ptr_conv.is_owned = false;
33392         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33393         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
33394         return ret_arr;
33395 }
33396
33397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33398         LDKDataLossProtect this_ptr_conv;
33399         this_ptr_conv.inner = untag_ptr(this_ptr);
33400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33402         this_ptr_conv.is_owned = false;
33403         LDKThirtyTwoBytes val_ref;
33404         CHECK((*env)->GetArrayLength(env, val) == 32);
33405         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33406         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33407 }
33408
33409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33410         LDKDataLossProtect this_ptr_conv;
33411         this_ptr_conv.inner = untag_ptr(this_ptr);
33412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33414         this_ptr_conv.is_owned = false;
33415         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33416         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
33417         return ret_arr;
33418 }
33419
33420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33421         LDKDataLossProtect this_ptr_conv;
33422         this_ptr_conv.inner = untag_ptr(this_ptr);
33423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33425         this_ptr_conv.is_owned = false;
33426         LDKPublicKey val_ref;
33427         CHECK((*env)->GetArrayLength(env, val) == 33);
33428         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33429         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33430 }
33431
33432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv *env, jclass clz, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
33433         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33434         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
33435         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
33436         LDKPublicKey my_current_per_commitment_point_arg_ref;
33437         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
33438         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
33439         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33440         int64_t ret_ref = 0;
33441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33443         return ret_ref;
33444 }
33445
33446 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33447         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33448         int64_t ret_ref = 0;
33449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33451         return ret_ref;
33452 }
33453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33454         LDKDataLossProtect arg_conv;
33455         arg_conv.inner = untag_ptr(arg);
33456         arg_conv.is_owned = ptr_is_owned(arg);
33457         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33458         arg_conv.is_owned = false;
33459         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33460         return ret_conv;
33461 }
33462
33463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33464         LDKDataLossProtect orig_conv;
33465         orig_conv.inner = untag_ptr(orig);
33466         orig_conv.is_owned = ptr_is_owned(orig);
33467         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33468         orig_conv.is_owned = false;
33469         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33470         int64_t ret_ref = 0;
33471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33473         return ret_ref;
33474 }
33475
33476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33477         LDKChannelReestablish this_obj_conv;
33478         this_obj_conv.inner = untag_ptr(this_obj);
33479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33481         ChannelReestablish_free(this_obj_conv);
33482 }
33483
33484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33485         LDKChannelReestablish this_ptr_conv;
33486         this_ptr_conv.inner = untag_ptr(this_ptr);
33487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33489         this_ptr_conv.is_owned = false;
33490         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33491         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
33492         return ret_arr;
33493 }
33494
33495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33496         LDKChannelReestablish this_ptr_conv;
33497         this_ptr_conv.inner = untag_ptr(this_ptr);
33498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33500         this_ptr_conv.is_owned = false;
33501         LDKThirtyTwoBytes val_ref;
33502         CHECK((*env)->GetArrayLength(env, val) == 32);
33503         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33504         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33505 }
33506
33507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
33508         LDKChannelReestablish this_ptr_conv;
33509         this_ptr_conv.inner = untag_ptr(this_ptr);
33510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33512         this_ptr_conv.is_owned = false;
33513         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33514         return ret_conv;
33515 }
33516
33517 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) {
33518         LDKChannelReestablish this_ptr_conv;
33519         this_ptr_conv.inner = untag_ptr(this_ptr);
33520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33522         this_ptr_conv.is_owned = false;
33523         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33524 }
33525
33526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
33527         LDKChannelReestablish this_ptr_conv;
33528         this_ptr_conv.inner = untag_ptr(this_ptr);
33529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33531         this_ptr_conv.is_owned = false;
33532         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33533         return ret_conv;
33534 }
33535
33536 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) {
33537         LDKChannelReestablish this_ptr_conv;
33538         this_ptr_conv.inner = untag_ptr(this_ptr);
33539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33541         this_ptr_conv.is_owned = false;
33542         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33543 }
33544
33545 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33546         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33547         int64_t ret_ref = 0;
33548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33550         return ret_ref;
33551 }
33552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33553         LDKChannelReestablish arg_conv;
33554         arg_conv.inner = untag_ptr(arg);
33555         arg_conv.is_owned = ptr_is_owned(arg);
33556         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33557         arg_conv.is_owned = false;
33558         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33559         return ret_conv;
33560 }
33561
33562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33563         LDKChannelReestablish orig_conv;
33564         orig_conv.inner = untag_ptr(orig);
33565         orig_conv.is_owned = ptr_is_owned(orig);
33566         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33567         orig_conv.is_owned = false;
33568         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33569         int64_t ret_ref = 0;
33570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33572         return ret_ref;
33573 }
33574
33575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33576         LDKAnnouncementSignatures this_obj_conv;
33577         this_obj_conv.inner = untag_ptr(this_obj);
33578         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33580         AnnouncementSignatures_free(this_obj_conv);
33581 }
33582
33583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33584         LDKAnnouncementSignatures this_ptr_conv;
33585         this_ptr_conv.inner = untag_ptr(this_ptr);
33586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33588         this_ptr_conv.is_owned = false;
33589         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33590         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
33591         return ret_arr;
33592 }
33593
33594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33595         LDKAnnouncementSignatures this_ptr_conv;
33596         this_ptr_conv.inner = untag_ptr(this_ptr);
33597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33599         this_ptr_conv.is_owned = false;
33600         LDKThirtyTwoBytes val_ref;
33601         CHECK((*env)->GetArrayLength(env, val) == 32);
33602         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33603         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33604 }
33605
33606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33607         LDKAnnouncementSignatures this_ptr_conv;
33608         this_ptr_conv.inner = untag_ptr(this_ptr);
33609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33611         this_ptr_conv.is_owned = false;
33612         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33613         return ret_conv;
33614 }
33615
33616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33617         LDKAnnouncementSignatures this_ptr_conv;
33618         this_ptr_conv.inner = untag_ptr(this_ptr);
33619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33621         this_ptr_conv.is_owned = false;
33622         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33623 }
33624
33625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33626         LDKAnnouncementSignatures this_ptr_conv;
33627         this_ptr_conv.inner = untag_ptr(this_ptr);
33628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33630         this_ptr_conv.is_owned = false;
33631         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33632         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
33633         return ret_arr;
33634 }
33635
33636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33637         LDKAnnouncementSignatures this_ptr_conv;
33638         this_ptr_conv.inner = untag_ptr(this_ptr);
33639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33641         this_ptr_conv.is_owned = false;
33642         LDKSignature val_ref;
33643         CHECK((*env)->GetArrayLength(env, val) == 64);
33644         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33645         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33646 }
33647
33648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33649         LDKAnnouncementSignatures this_ptr_conv;
33650         this_ptr_conv.inner = untag_ptr(this_ptr);
33651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33653         this_ptr_conv.is_owned = false;
33654         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33655         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
33656         return ret_arr;
33657 }
33658
33659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33660         LDKAnnouncementSignatures this_ptr_conv;
33661         this_ptr_conv.inner = untag_ptr(this_ptr);
33662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33664         this_ptr_conv.is_owned = false;
33665         LDKSignature val_ref;
33666         CHECK((*env)->GetArrayLength(env, val) == 64);
33667         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33668         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33669 }
33670
33671 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) {
33672         LDKThirtyTwoBytes channel_id_arg_ref;
33673         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33674         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33675         LDKSignature node_signature_arg_ref;
33676         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
33677         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
33678         LDKSignature bitcoin_signature_arg_ref;
33679         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
33680         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
33681         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33682         int64_t ret_ref = 0;
33683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33685         return ret_ref;
33686 }
33687
33688 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33689         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33690         int64_t ret_ref = 0;
33691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33693         return ret_ref;
33694 }
33695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33696         LDKAnnouncementSignatures arg_conv;
33697         arg_conv.inner = untag_ptr(arg);
33698         arg_conv.is_owned = ptr_is_owned(arg);
33699         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33700         arg_conv.is_owned = false;
33701         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33702         return ret_conv;
33703 }
33704
33705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33706         LDKAnnouncementSignatures orig_conv;
33707         orig_conv.inner = untag_ptr(orig);
33708         orig_conv.is_owned = ptr_is_owned(orig);
33709         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33710         orig_conv.is_owned = false;
33711         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33712         int64_t ret_ref = 0;
33713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33715         return ret_ref;
33716 }
33717
33718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33719         if (!ptr_is_owned(this_ptr)) return;
33720         void* this_ptr_ptr = untag_ptr(this_ptr);
33721         CHECK_ACCESS(this_ptr_ptr);
33722         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33723         FREE(untag_ptr(this_ptr));
33724         NetAddress_free(this_ptr_conv);
33725 }
33726
33727 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33728         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33729         *ret_copy = NetAddress_clone(arg);
33730         int64_t ret_ref = tag_ptr(ret_copy, true);
33731         return ret_ref;
33732 }
33733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33734         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33735         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33736         return ret_conv;
33737 }
33738
33739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33740         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33741         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33742         *ret_copy = NetAddress_clone(orig_conv);
33743         int64_t ret_ref = tag_ptr(ret_copy, true);
33744         return ret_ref;
33745 }
33746
33747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33748         LDKFourBytes addr_ref;
33749         CHECK((*env)->GetArrayLength(env, addr) == 4);
33750         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
33751         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33752         *ret_copy = NetAddress_ipv4(addr_ref, port);
33753         int64_t ret_ref = tag_ptr(ret_copy, true);
33754         return ret_ref;
33755 }
33756
33757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33758         LDKSixteenBytes addr_ref;
33759         CHECK((*env)->GetArrayLength(env, addr) == 16);
33760         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
33761         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33762         *ret_copy = NetAddress_ipv6(addr_ref, port);
33763         int64_t ret_ref = tag_ptr(ret_copy, true);
33764         return ret_ref;
33765 }
33766
33767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
33768         LDKTwelveBytes a_ref;
33769         CHECK((*env)->GetArrayLength(env, a) == 12);
33770         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
33771         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33772         *ret_copy = NetAddress_onion_v2(a_ref);
33773         int64_t ret_ref = tag_ptr(ret_copy, true);
33774         return ret_ref;
33775 }
33776
33777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
33778         LDKThirtyTwoBytes ed25519_pubkey_ref;
33779         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
33780         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
33781         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33782         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33783         int64_t ret_ref = tag_ptr(ret_copy, true);
33784         return ret_ref;
33785 }
33786
33787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
33788         LDKHostname hostname_conv;
33789         hostname_conv.inner = untag_ptr(hostname);
33790         hostname_conv.is_owned = ptr_is_owned(hostname);
33791         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33792         hostname_conv = Hostname_clone(&hostname_conv);
33793         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33794         *ret_copy = NetAddress_hostname(hostname_conv, port);
33795         int64_t ret_ref = tag_ptr(ret_copy, true);
33796         return ret_ref;
33797 }
33798
33799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
33800         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33801         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33802         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33803         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33804         CVec_u8Z_free(ret_var);
33805         return ret_arr;
33806 }
33807
33808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33809         LDKu8slice ser_ref;
33810         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33811         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33812         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33813         *ret_conv = NetAddress_read(ser_ref);
33814         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33815         return tag_ptr(ret_conv, true);
33816 }
33817
33818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33819         LDKUnsignedNodeAnnouncement this_obj_conv;
33820         this_obj_conv.inner = untag_ptr(this_obj);
33821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33823         UnsignedNodeAnnouncement_free(this_obj_conv);
33824 }
33825
33826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
33827         LDKUnsignedNodeAnnouncement this_ptr_conv;
33828         this_ptr_conv.inner = untag_ptr(this_ptr);
33829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33831         this_ptr_conv.is_owned = false;
33832         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33833         int64_t ret_ref = 0;
33834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33836         return ret_ref;
33837 }
33838
33839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33840         LDKUnsignedNodeAnnouncement this_ptr_conv;
33841         this_ptr_conv.inner = untag_ptr(this_ptr);
33842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33844         this_ptr_conv.is_owned = false;
33845         LDKNodeFeatures val_conv;
33846         val_conv.inner = untag_ptr(val);
33847         val_conv.is_owned = ptr_is_owned(val);
33848         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33849         val_conv = NodeFeatures_clone(&val_conv);
33850         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33851 }
33852
33853 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33854         LDKUnsignedNodeAnnouncement this_ptr_conv;
33855         this_ptr_conv.inner = untag_ptr(this_ptr);
33856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33858         this_ptr_conv.is_owned = false;
33859         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33860         return ret_conv;
33861 }
33862
33863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33864         LDKUnsignedNodeAnnouncement this_ptr_conv;
33865         this_ptr_conv.inner = untag_ptr(this_ptr);
33866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33868         this_ptr_conv.is_owned = false;
33869         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33870 }
33871
33872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33873         LDKUnsignedNodeAnnouncement this_ptr_conv;
33874         this_ptr_conv.inner = untag_ptr(this_ptr);
33875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33877         this_ptr_conv.is_owned = false;
33878         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33879         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
33880         return ret_arr;
33881 }
33882
33883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33884         LDKUnsignedNodeAnnouncement this_ptr_conv;
33885         this_ptr_conv.inner = untag_ptr(this_ptr);
33886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33888         this_ptr_conv.is_owned = false;
33889         LDKPublicKey val_ref;
33890         CHECK((*env)->GetArrayLength(env, val) == 33);
33891         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33892         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
33893 }
33894
33895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
33896         LDKUnsignedNodeAnnouncement this_ptr_conv;
33897         this_ptr_conv.inner = untag_ptr(this_ptr);
33898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33900         this_ptr_conv.is_owned = false;
33901         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
33902         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
33903         return ret_arr;
33904 }
33905
33906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33907         LDKUnsignedNodeAnnouncement this_ptr_conv;
33908         this_ptr_conv.inner = untag_ptr(this_ptr);
33909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33911         this_ptr_conv.is_owned = false;
33912         LDKThreeBytes val_ref;
33913         CHECK((*env)->GetArrayLength(env, val) == 3);
33914         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
33915         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
33916 }
33917
33918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
33919         LDKUnsignedNodeAnnouncement this_ptr_conv;
33920         this_ptr_conv.inner = untag_ptr(this_ptr);
33921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33923         this_ptr_conv.is_owned = false;
33924         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33925         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
33926         return ret_arr;
33927 }
33928
33929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33930         LDKUnsignedNodeAnnouncement this_ptr_conv;
33931         this_ptr_conv.inner = untag_ptr(this_ptr);
33932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33934         this_ptr_conv.is_owned = false;
33935         LDKThirtyTwoBytes val_ref;
33936         CHECK((*env)->GetArrayLength(env, val) == 32);
33937         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33938         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
33939 }
33940
33941 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
33942         LDKUnsignedNodeAnnouncement this_ptr_conv;
33943         this_ptr_conv.inner = untag_ptr(this_ptr);
33944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33946         this_ptr_conv.is_owned = false;
33947         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
33948         int64_tArray ret_arr = NULL;
33949         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33950         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33951         for (size_t m = 0; m < ret_var.datalen; m++) {
33952                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33953                 *ret_conv_12_copy = ret_var.data[m];
33954                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
33955                 ret_arr_ptr[m] = ret_conv_12_ref;
33956         }
33957         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33958         FREE(ret_var.data);
33959         return ret_arr;
33960 }
33961
33962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33963         LDKUnsignedNodeAnnouncement this_ptr_conv;
33964         this_ptr_conv.inner = untag_ptr(this_ptr);
33965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33967         this_ptr_conv.is_owned = false;
33968         LDKCVec_NetAddressZ val_constr;
33969         val_constr.datalen = (*env)->GetArrayLength(env, val);
33970         if (val_constr.datalen > 0)
33971                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
33972         else
33973                 val_constr.data = NULL;
33974         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33975         for (size_t m = 0; m < val_constr.datalen; m++) {
33976                 int64_t val_conv_12 = val_vals[m];
33977                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
33978                 CHECK_ACCESS(val_conv_12_ptr);
33979                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
33980                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
33981                 val_constr.data[m] = val_conv_12_conv;
33982         }
33983         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33984         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
33985 }
33986
33987 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
33988         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
33989         int64_t ret_ref = 0;
33990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33992         return ret_ref;
33993 }
33994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33995         LDKUnsignedNodeAnnouncement arg_conv;
33996         arg_conv.inner = untag_ptr(arg);
33997         arg_conv.is_owned = ptr_is_owned(arg);
33998         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33999         arg_conv.is_owned = false;
34000         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
34001         return ret_conv;
34002 }
34003
34004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34005         LDKUnsignedNodeAnnouncement orig_conv;
34006         orig_conv.inner = untag_ptr(orig);
34007         orig_conv.is_owned = ptr_is_owned(orig);
34008         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34009         orig_conv.is_owned = false;
34010         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34011         int64_t ret_ref = 0;
34012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34014         return ret_ref;
34015 }
34016
34017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34018         LDKNodeAnnouncement this_obj_conv;
34019         this_obj_conv.inner = untag_ptr(this_obj);
34020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34022         NodeAnnouncement_free(this_obj_conv);
34023 }
34024
34025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34026         LDKNodeAnnouncement this_ptr_conv;
34027         this_ptr_conv.inner = untag_ptr(this_ptr);
34028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34030         this_ptr_conv.is_owned = false;
34031         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34032         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
34033         return ret_arr;
34034 }
34035
34036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34037         LDKNodeAnnouncement this_ptr_conv;
34038         this_ptr_conv.inner = untag_ptr(this_ptr);
34039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34041         this_ptr_conv.is_owned = false;
34042         LDKSignature val_ref;
34043         CHECK((*env)->GetArrayLength(env, val) == 64);
34044         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34045         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34046 }
34047
34048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34049         LDKNodeAnnouncement this_ptr_conv;
34050         this_ptr_conv.inner = untag_ptr(this_ptr);
34051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34053         this_ptr_conv.is_owned = false;
34054         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34055         int64_t ret_ref = 0;
34056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34058         return ret_ref;
34059 }
34060
34061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34062         LDKNodeAnnouncement this_ptr_conv;
34063         this_ptr_conv.inner = untag_ptr(this_ptr);
34064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34066         this_ptr_conv.is_owned = false;
34067         LDKUnsignedNodeAnnouncement val_conv;
34068         val_conv.inner = untag_ptr(val);
34069         val_conv.is_owned = ptr_is_owned(val);
34070         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34071         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34072         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34073 }
34074
34075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34076         LDKSignature signature_arg_ref;
34077         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34078         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34079         LDKUnsignedNodeAnnouncement contents_arg_conv;
34080         contents_arg_conv.inner = untag_ptr(contents_arg);
34081         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34082         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34083         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34084         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34085         int64_t ret_ref = 0;
34086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34088         return ret_ref;
34089 }
34090
34091 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34092         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34093         int64_t ret_ref = 0;
34094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34096         return ret_ref;
34097 }
34098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34099         LDKNodeAnnouncement arg_conv;
34100         arg_conv.inner = untag_ptr(arg);
34101         arg_conv.is_owned = ptr_is_owned(arg);
34102         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34103         arg_conv.is_owned = false;
34104         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34105         return ret_conv;
34106 }
34107
34108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34109         LDKNodeAnnouncement orig_conv;
34110         orig_conv.inner = untag_ptr(orig);
34111         orig_conv.is_owned = ptr_is_owned(orig);
34112         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34113         orig_conv.is_owned = false;
34114         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34115         int64_t ret_ref = 0;
34116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34118         return ret_ref;
34119 }
34120
34121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34122         LDKUnsignedChannelAnnouncement this_obj_conv;
34123         this_obj_conv.inner = untag_ptr(this_obj);
34124         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34126         UnsignedChannelAnnouncement_free(this_obj_conv);
34127 }
34128
34129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
34130         LDKUnsignedChannelAnnouncement this_ptr_conv;
34131         this_ptr_conv.inner = untag_ptr(this_ptr);
34132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34134         this_ptr_conv.is_owned = false;
34135         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34136         int64_t ret_ref = 0;
34137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34139         return ret_ref;
34140 }
34141
34142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34143         LDKUnsignedChannelAnnouncement this_ptr_conv;
34144         this_ptr_conv.inner = untag_ptr(this_ptr);
34145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34147         this_ptr_conv.is_owned = false;
34148         LDKChannelFeatures val_conv;
34149         val_conv.inner = untag_ptr(val);
34150         val_conv.is_owned = ptr_is_owned(val);
34151         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34152         val_conv = ChannelFeatures_clone(&val_conv);
34153         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34154 }
34155
34156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34157         LDKUnsignedChannelAnnouncement this_ptr_conv;
34158         this_ptr_conv.inner = untag_ptr(this_ptr);
34159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34161         this_ptr_conv.is_owned = false;
34162         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34163         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
34164         return ret_arr;
34165 }
34166
34167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34168         LDKUnsignedChannelAnnouncement this_ptr_conv;
34169         this_ptr_conv.inner = untag_ptr(this_ptr);
34170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34172         this_ptr_conv.is_owned = false;
34173         LDKThirtyTwoBytes val_ref;
34174         CHECK((*env)->GetArrayLength(env, val) == 32);
34175         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34176         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34177 }
34178
34179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34180         LDKUnsignedChannelAnnouncement this_ptr_conv;
34181         this_ptr_conv.inner = untag_ptr(this_ptr);
34182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34184         this_ptr_conv.is_owned = false;
34185         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34186         return ret_conv;
34187 }
34188
34189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34190         LDKUnsignedChannelAnnouncement this_ptr_conv;
34191         this_ptr_conv.inner = untag_ptr(this_ptr);
34192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34194         this_ptr_conv.is_owned = false;
34195         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34196 }
34197
34198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34199         LDKUnsignedChannelAnnouncement this_ptr_conv;
34200         this_ptr_conv.inner = untag_ptr(this_ptr);
34201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34203         this_ptr_conv.is_owned = false;
34204         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34205         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
34206         return ret_arr;
34207 }
34208
34209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34210         LDKUnsignedChannelAnnouncement this_ptr_conv;
34211         this_ptr_conv.inner = untag_ptr(this_ptr);
34212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34214         this_ptr_conv.is_owned = false;
34215         LDKPublicKey val_ref;
34216         CHECK((*env)->GetArrayLength(env, val) == 33);
34217         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34218         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
34219 }
34220
34221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34222         LDKUnsignedChannelAnnouncement this_ptr_conv;
34223         this_ptr_conv.inner = untag_ptr(this_ptr);
34224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34226         this_ptr_conv.is_owned = false;
34227         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34228         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
34229         return ret_arr;
34230 }
34231
34232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34233         LDKUnsignedChannelAnnouncement this_ptr_conv;
34234         this_ptr_conv.inner = untag_ptr(this_ptr);
34235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34237         this_ptr_conv.is_owned = false;
34238         LDKPublicKey val_ref;
34239         CHECK((*env)->GetArrayLength(env, val) == 33);
34240         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34241         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
34242 }
34243
34244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34245         LDKUnsignedChannelAnnouncement this_ptr_conv;
34246         this_ptr_conv.inner = untag_ptr(this_ptr);
34247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34249         this_ptr_conv.is_owned = false;
34250         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34251         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
34252         return ret_arr;
34253 }
34254
34255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34256         LDKUnsignedChannelAnnouncement this_ptr_conv;
34257         this_ptr_conv.inner = untag_ptr(this_ptr);
34258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34260         this_ptr_conv.is_owned = false;
34261         LDKPublicKey val_ref;
34262         CHECK((*env)->GetArrayLength(env, val) == 33);
34263         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34264         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
34265 }
34266
34267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34268         LDKUnsignedChannelAnnouncement this_ptr_conv;
34269         this_ptr_conv.inner = untag_ptr(this_ptr);
34270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34272         this_ptr_conv.is_owned = false;
34273         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34274         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
34275         return ret_arr;
34276 }
34277
34278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34279         LDKUnsignedChannelAnnouncement this_ptr_conv;
34280         this_ptr_conv.inner = untag_ptr(this_ptr);
34281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34283         this_ptr_conv.is_owned = false;
34284         LDKPublicKey val_ref;
34285         CHECK((*env)->GetArrayLength(env, val) == 33);
34286         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34287         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
34288 }
34289
34290 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34291         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34292         int64_t ret_ref = 0;
34293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34295         return ret_ref;
34296 }
34297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34298         LDKUnsignedChannelAnnouncement arg_conv;
34299         arg_conv.inner = untag_ptr(arg);
34300         arg_conv.is_owned = ptr_is_owned(arg);
34301         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34302         arg_conv.is_owned = false;
34303         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34304         return ret_conv;
34305 }
34306
34307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34308         LDKUnsignedChannelAnnouncement orig_conv;
34309         orig_conv.inner = untag_ptr(orig);
34310         orig_conv.is_owned = ptr_is_owned(orig);
34311         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34312         orig_conv.is_owned = false;
34313         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34314         int64_t ret_ref = 0;
34315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34317         return ret_ref;
34318 }
34319
34320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34321         LDKChannelAnnouncement this_obj_conv;
34322         this_obj_conv.inner = untag_ptr(this_obj);
34323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34325         ChannelAnnouncement_free(this_obj_conv);
34326 }
34327
34328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34329         LDKChannelAnnouncement this_ptr_conv;
34330         this_ptr_conv.inner = untag_ptr(this_ptr);
34331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34333         this_ptr_conv.is_owned = false;
34334         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34335         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
34336         return ret_arr;
34337 }
34338
34339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34340         LDKChannelAnnouncement this_ptr_conv;
34341         this_ptr_conv.inner = untag_ptr(this_ptr);
34342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34344         this_ptr_conv.is_owned = false;
34345         LDKSignature val_ref;
34346         CHECK((*env)->GetArrayLength(env, val) == 64);
34347         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34348         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34349 }
34350
34351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34352         LDKChannelAnnouncement this_ptr_conv;
34353         this_ptr_conv.inner = untag_ptr(this_ptr);
34354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34356         this_ptr_conv.is_owned = false;
34357         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34358         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
34359         return ret_arr;
34360 }
34361
34362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34363         LDKChannelAnnouncement this_ptr_conv;
34364         this_ptr_conv.inner = untag_ptr(this_ptr);
34365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34367         this_ptr_conv.is_owned = false;
34368         LDKSignature val_ref;
34369         CHECK((*env)->GetArrayLength(env, val) == 64);
34370         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34371         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34372 }
34373
34374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34375         LDKChannelAnnouncement this_ptr_conv;
34376         this_ptr_conv.inner = untag_ptr(this_ptr);
34377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34379         this_ptr_conv.is_owned = false;
34380         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34381         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
34382         return ret_arr;
34383 }
34384
34385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34386         LDKChannelAnnouncement this_ptr_conv;
34387         this_ptr_conv.inner = untag_ptr(this_ptr);
34388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34390         this_ptr_conv.is_owned = false;
34391         LDKSignature val_ref;
34392         CHECK((*env)->GetArrayLength(env, val) == 64);
34393         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34394         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34395 }
34396
34397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34398         LDKChannelAnnouncement this_ptr_conv;
34399         this_ptr_conv.inner = untag_ptr(this_ptr);
34400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34402         this_ptr_conv.is_owned = false;
34403         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34404         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
34405         return ret_arr;
34406 }
34407
34408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34409         LDKChannelAnnouncement this_ptr_conv;
34410         this_ptr_conv.inner = untag_ptr(this_ptr);
34411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34413         this_ptr_conv.is_owned = false;
34414         LDKSignature val_ref;
34415         CHECK((*env)->GetArrayLength(env, val) == 64);
34416         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34417         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34418 }
34419
34420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34421         LDKChannelAnnouncement this_ptr_conv;
34422         this_ptr_conv.inner = untag_ptr(this_ptr);
34423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34425         this_ptr_conv.is_owned = false;
34426         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34427         int64_t ret_ref = 0;
34428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34430         return ret_ref;
34431 }
34432
34433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34434         LDKChannelAnnouncement this_ptr_conv;
34435         this_ptr_conv.inner = untag_ptr(this_ptr);
34436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34438         this_ptr_conv.is_owned = false;
34439         LDKUnsignedChannelAnnouncement val_conv;
34440         val_conv.inner = untag_ptr(val);
34441         val_conv.is_owned = ptr_is_owned(val);
34442         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34443         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34444         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34445 }
34446
34447 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) {
34448         LDKSignature node_signature_1_arg_ref;
34449         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
34450         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
34451         LDKSignature node_signature_2_arg_ref;
34452         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
34453         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
34454         LDKSignature bitcoin_signature_1_arg_ref;
34455         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
34456         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
34457         LDKSignature bitcoin_signature_2_arg_ref;
34458         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
34459         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
34460         LDKUnsignedChannelAnnouncement contents_arg_conv;
34461         contents_arg_conv.inner = untag_ptr(contents_arg);
34462         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34463         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34464         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34465         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);
34466         int64_t ret_ref = 0;
34467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34469         return ret_ref;
34470 }
34471
34472 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34473         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34474         int64_t ret_ref = 0;
34475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34477         return ret_ref;
34478 }
34479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34480         LDKChannelAnnouncement arg_conv;
34481         arg_conv.inner = untag_ptr(arg);
34482         arg_conv.is_owned = ptr_is_owned(arg);
34483         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34484         arg_conv.is_owned = false;
34485         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34486         return ret_conv;
34487 }
34488
34489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34490         LDKChannelAnnouncement orig_conv;
34491         orig_conv.inner = untag_ptr(orig);
34492         orig_conv.is_owned = ptr_is_owned(orig);
34493         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34494         orig_conv.is_owned = false;
34495         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34496         int64_t ret_ref = 0;
34497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34499         return ret_ref;
34500 }
34501
34502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34503         LDKUnsignedChannelUpdate this_obj_conv;
34504         this_obj_conv.inner = untag_ptr(this_obj);
34505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34507         UnsignedChannelUpdate_free(this_obj_conv);
34508 }
34509
34510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34511         LDKUnsignedChannelUpdate this_ptr_conv;
34512         this_ptr_conv.inner = untag_ptr(this_ptr);
34513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34515         this_ptr_conv.is_owned = false;
34516         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34517         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
34518         return ret_arr;
34519 }
34520
34521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34522         LDKUnsignedChannelUpdate this_ptr_conv;
34523         this_ptr_conv.inner = untag_ptr(this_ptr);
34524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34526         this_ptr_conv.is_owned = false;
34527         LDKThirtyTwoBytes val_ref;
34528         CHECK((*env)->GetArrayLength(env, val) == 32);
34529         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34530         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34531 }
34532
34533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34534         LDKUnsignedChannelUpdate this_ptr_conv;
34535         this_ptr_conv.inner = untag_ptr(this_ptr);
34536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34538         this_ptr_conv.is_owned = false;
34539         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34540         return ret_conv;
34541 }
34542
34543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34544         LDKUnsignedChannelUpdate this_ptr_conv;
34545         this_ptr_conv.inner = untag_ptr(this_ptr);
34546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34548         this_ptr_conv.is_owned = false;
34549         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34550 }
34551
34552 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34553         LDKUnsignedChannelUpdate this_ptr_conv;
34554         this_ptr_conv.inner = untag_ptr(this_ptr);
34555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34557         this_ptr_conv.is_owned = false;
34558         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34559         return ret_conv;
34560 }
34561
34562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34563         LDKUnsignedChannelUpdate this_ptr_conv;
34564         this_ptr_conv.inner = untag_ptr(this_ptr);
34565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34567         this_ptr_conv.is_owned = false;
34568         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34569 }
34570
34571 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
34572         LDKUnsignedChannelUpdate this_ptr_conv;
34573         this_ptr_conv.inner = untag_ptr(this_ptr);
34574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34576         this_ptr_conv.is_owned = false;
34577         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34578         return ret_conv;
34579 }
34580
34581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
34582         LDKUnsignedChannelUpdate this_ptr_conv;
34583         this_ptr_conv.inner = untag_ptr(this_ptr);
34584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34586         this_ptr_conv.is_owned = false;
34587         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34588 }
34589
34590 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
34591         LDKUnsignedChannelUpdate this_ptr_conv;
34592         this_ptr_conv.inner = untag_ptr(this_ptr);
34593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34595         this_ptr_conv.is_owned = false;
34596         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34597         return ret_conv;
34598 }
34599
34600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34601         LDKUnsignedChannelUpdate this_ptr_conv;
34602         this_ptr_conv.inner = untag_ptr(this_ptr);
34603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34605         this_ptr_conv.is_owned = false;
34606         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34607 }
34608
34609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34610         LDKUnsignedChannelUpdate this_ptr_conv;
34611         this_ptr_conv.inner = untag_ptr(this_ptr);
34612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34614         this_ptr_conv.is_owned = false;
34615         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34616         return ret_conv;
34617 }
34618
34619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34620         LDKUnsignedChannelUpdate this_ptr_conv;
34621         this_ptr_conv.inner = untag_ptr(this_ptr);
34622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34624         this_ptr_conv.is_owned = false;
34625         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34626 }
34627
34628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34629         LDKUnsignedChannelUpdate this_ptr_conv;
34630         this_ptr_conv.inner = untag_ptr(this_ptr);
34631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34633         this_ptr_conv.is_owned = false;
34634         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34635         return ret_conv;
34636 }
34637
34638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34639         LDKUnsignedChannelUpdate this_ptr_conv;
34640         this_ptr_conv.inner = untag_ptr(this_ptr);
34641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34643         this_ptr_conv.is_owned = false;
34644         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34645 }
34646
34647 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34648         LDKUnsignedChannelUpdate this_ptr_conv;
34649         this_ptr_conv.inner = untag_ptr(this_ptr);
34650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34652         this_ptr_conv.is_owned = false;
34653         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34654         return ret_conv;
34655 }
34656
34657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34658         LDKUnsignedChannelUpdate this_ptr_conv;
34659         this_ptr_conv.inner = untag_ptr(this_ptr);
34660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34662         this_ptr_conv.is_owned = false;
34663         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34664 }
34665
34666 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34667         LDKUnsignedChannelUpdate this_ptr_conv;
34668         this_ptr_conv.inner = untag_ptr(this_ptr);
34669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34671         this_ptr_conv.is_owned = false;
34672         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34673         return ret_conv;
34674 }
34675
34676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34677         LDKUnsignedChannelUpdate this_ptr_conv;
34678         this_ptr_conv.inner = untag_ptr(this_ptr);
34679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34681         this_ptr_conv.is_owned = false;
34682         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34683 }
34684
34685 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
34686         LDKUnsignedChannelUpdate this_ptr_conv;
34687         this_ptr_conv.inner = untag_ptr(this_ptr);
34688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34690         this_ptr_conv.is_owned = false;
34691         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34692         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34693         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34694         CVec_u8Z_free(ret_var);
34695         return ret_arr;
34696 }
34697
34698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34699         LDKUnsignedChannelUpdate this_ptr_conv;
34700         this_ptr_conv.inner = untag_ptr(this_ptr);
34701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34703         this_ptr_conv.is_owned = false;
34704         LDKCVec_u8Z val_ref;
34705         val_ref.datalen = (*env)->GetArrayLength(env, val);
34706         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34707         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
34708         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34709 }
34710
34711 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) {
34712         LDKThirtyTwoBytes chain_hash_arg_ref;
34713         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34714         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34715         LDKCVec_u8Z excess_data_arg_ref;
34716         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
34717         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34718         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
34719         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);
34720         int64_t ret_ref = 0;
34721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34723         return ret_ref;
34724 }
34725
34726 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34727         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34728         int64_t ret_ref = 0;
34729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34731         return ret_ref;
34732 }
34733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34734         LDKUnsignedChannelUpdate arg_conv;
34735         arg_conv.inner = untag_ptr(arg);
34736         arg_conv.is_owned = ptr_is_owned(arg);
34737         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34738         arg_conv.is_owned = false;
34739         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34740         return ret_conv;
34741 }
34742
34743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34744         LDKUnsignedChannelUpdate orig_conv;
34745         orig_conv.inner = untag_ptr(orig);
34746         orig_conv.is_owned = ptr_is_owned(orig);
34747         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34748         orig_conv.is_owned = false;
34749         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34750         int64_t ret_ref = 0;
34751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34753         return ret_ref;
34754 }
34755
34756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34757         LDKChannelUpdate this_obj_conv;
34758         this_obj_conv.inner = untag_ptr(this_obj);
34759         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34761         ChannelUpdate_free(this_obj_conv);
34762 }
34763
34764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34765         LDKChannelUpdate this_ptr_conv;
34766         this_ptr_conv.inner = untag_ptr(this_ptr);
34767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34769         this_ptr_conv.is_owned = false;
34770         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34771         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
34772         return ret_arr;
34773 }
34774
34775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34776         LDKChannelUpdate this_ptr_conv;
34777         this_ptr_conv.inner = untag_ptr(this_ptr);
34778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34780         this_ptr_conv.is_owned = false;
34781         LDKSignature val_ref;
34782         CHECK((*env)->GetArrayLength(env, val) == 64);
34783         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34784         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34785 }
34786
34787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34788         LDKChannelUpdate this_ptr_conv;
34789         this_ptr_conv.inner = untag_ptr(this_ptr);
34790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34792         this_ptr_conv.is_owned = false;
34793         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34794         int64_t ret_ref = 0;
34795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34797         return ret_ref;
34798 }
34799
34800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34801         LDKChannelUpdate this_ptr_conv;
34802         this_ptr_conv.inner = untag_ptr(this_ptr);
34803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34805         this_ptr_conv.is_owned = false;
34806         LDKUnsignedChannelUpdate val_conv;
34807         val_conv.inner = untag_ptr(val);
34808         val_conv.is_owned = ptr_is_owned(val);
34809         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34810         val_conv = UnsignedChannelUpdate_clone(&val_conv);
34811         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34812 }
34813
34814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34815         LDKSignature signature_arg_ref;
34816         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34817         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34818         LDKUnsignedChannelUpdate contents_arg_conv;
34819         contents_arg_conv.inner = untag_ptr(contents_arg);
34820         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34821         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34822         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
34823         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
34824         int64_t ret_ref = 0;
34825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34827         return ret_ref;
34828 }
34829
34830 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
34831         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
34832         int64_t ret_ref = 0;
34833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34835         return ret_ref;
34836 }
34837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34838         LDKChannelUpdate arg_conv;
34839         arg_conv.inner = untag_ptr(arg);
34840         arg_conv.is_owned = ptr_is_owned(arg);
34841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34842         arg_conv.is_owned = false;
34843         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
34844         return ret_conv;
34845 }
34846
34847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34848         LDKChannelUpdate orig_conv;
34849         orig_conv.inner = untag_ptr(orig);
34850         orig_conv.is_owned = ptr_is_owned(orig);
34851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34852         orig_conv.is_owned = false;
34853         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
34854         int64_t ret_ref = 0;
34855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34857         return ret_ref;
34858 }
34859
34860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34861         LDKQueryChannelRange this_obj_conv;
34862         this_obj_conv.inner = untag_ptr(this_obj);
34863         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34865         QueryChannelRange_free(this_obj_conv);
34866 }
34867
34868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34869         LDKQueryChannelRange this_ptr_conv;
34870         this_ptr_conv.inner = untag_ptr(this_ptr);
34871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34873         this_ptr_conv.is_owned = false;
34874         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34875         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
34876         return ret_arr;
34877 }
34878
34879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34880         LDKQueryChannelRange this_ptr_conv;
34881         this_ptr_conv.inner = untag_ptr(this_ptr);
34882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34884         this_ptr_conv.is_owned = false;
34885         LDKThirtyTwoBytes val_ref;
34886         CHECK((*env)->GetArrayLength(env, val) == 32);
34887         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34888         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34889 }
34890
34891 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
34892         LDKQueryChannelRange this_ptr_conv;
34893         this_ptr_conv.inner = untag_ptr(this_ptr);
34894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34896         this_ptr_conv.is_owned = false;
34897         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
34898         return ret_conv;
34899 }
34900
34901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34902         LDKQueryChannelRange this_ptr_conv;
34903         this_ptr_conv.inner = untag_ptr(this_ptr);
34904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34906         this_ptr_conv.is_owned = false;
34907         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
34908 }
34909
34910 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
34911         LDKQueryChannelRange this_ptr_conv;
34912         this_ptr_conv.inner = untag_ptr(this_ptr);
34913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34915         this_ptr_conv.is_owned = false;
34916         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
34917         return ret_conv;
34918 }
34919
34920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34921         LDKQueryChannelRange this_ptr_conv;
34922         this_ptr_conv.inner = untag_ptr(this_ptr);
34923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34925         this_ptr_conv.is_owned = false;
34926         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34927 }
34928
34929 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) {
34930         LDKThirtyTwoBytes chain_hash_arg_ref;
34931         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34932         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34933         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
34934         int64_t ret_ref = 0;
34935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34937         return ret_ref;
34938 }
34939
34940 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
34941         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
34942         int64_t ret_ref = 0;
34943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34945         return ret_ref;
34946 }
34947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34948         LDKQueryChannelRange arg_conv;
34949         arg_conv.inner = untag_ptr(arg);
34950         arg_conv.is_owned = ptr_is_owned(arg);
34951         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34952         arg_conv.is_owned = false;
34953         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
34954         return ret_conv;
34955 }
34956
34957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34958         LDKQueryChannelRange orig_conv;
34959         orig_conv.inner = untag_ptr(orig);
34960         orig_conv.is_owned = ptr_is_owned(orig);
34961         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34962         orig_conv.is_owned = false;
34963         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
34964         int64_t ret_ref = 0;
34965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34967         return ret_ref;
34968 }
34969
34970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34971         LDKReplyChannelRange this_obj_conv;
34972         this_obj_conv.inner = untag_ptr(this_obj);
34973         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34975         ReplyChannelRange_free(this_obj_conv);
34976 }
34977
34978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34979         LDKReplyChannelRange this_ptr_conv;
34980         this_ptr_conv.inner = untag_ptr(this_ptr);
34981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34983         this_ptr_conv.is_owned = false;
34984         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34985         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
34986         return ret_arr;
34987 }
34988
34989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34990         LDKReplyChannelRange this_ptr_conv;
34991         this_ptr_conv.inner = untag_ptr(this_ptr);
34992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34994         this_ptr_conv.is_owned = false;
34995         LDKThirtyTwoBytes val_ref;
34996         CHECK((*env)->GetArrayLength(env, val) == 32);
34997         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34998         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34999 }
35000
35001 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
35002         LDKReplyChannelRange this_ptr_conv;
35003         this_ptr_conv.inner = untag_ptr(this_ptr);
35004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35006         this_ptr_conv.is_owned = false;
35007         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35008         return ret_conv;
35009 }
35010
35011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35012         LDKReplyChannelRange this_ptr_conv;
35013         this_ptr_conv.inner = untag_ptr(this_ptr);
35014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35016         this_ptr_conv.is_owned = false;
35017         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35018 }
35019
35020 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
35021         LDKReplyChannelRange this_ptr_conv;
35022         this_ptr_conv.inner = untag_ptr(this_ptr);
35023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35025         this_ptr_conv.is_owned = false;
35026         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35027         return ret_conv;
35028 }
35029
35030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35031         LDKReplyChannelRange this_ptr_conv;
35032         this_ptr_conv.inner = untag_ptr(this_ptr);
35033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35035         this_ptr_conv.is_owned = false;
35036         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35037 }
35038
35039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
35040         LDKReplyChannelRange this_ptr_conv;
35041         this_ptr_conv.inner = untag_ptr(this_ptr);
35042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35044         this_ptr_conv.is_owned = false;
35045         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35046         return ret_conv;
35047 }
35048
35049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35050         LDKReplyChannelRange this_ptr_conv;
35051         this_ptr_conv.inner = untag_ptr(this_ptr);
35052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35054         this_ptr_conv.is_owned = false;
35055         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35056 }
35057
35058 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
35059         LDKReplyChannelRange this_ptr_conv;
35060         this_ptr_conv.inner = untag_ptr(this_ptr);
35061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35063         this_ptr_conv.is_owned = false;
35064         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
35065         int64_tArray ret_arr = NULL;
35066         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35067         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35068         for (size_t g = 0; g < ret_var.datalen; g++) {
35069                 int64_t ret_conv_6_conv = ret_var.data[g];
35070                 ret_arr_ptr[g] = ret_conv_6_conv;
35071         }
35072         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35073         FREE(ret_var.data);
35074         return ret_arr;
35075 }
35076
35077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35078         LDKReplyChannelRange this_ptr_conv;
35079         this_ptr_conv.inner = untag_ptr(this_ptr);
35080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35082         this_ptr_conv.is_owned = false;
35083         LDKCVec_u64Z val_constr;
35084         val_constr.datalen = (*env)->GetArrayLength(env, val);
35085         if (val_constr.datalen > 0)
35086                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35087         else
35088                 val_constr.data = NULL;
35089         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35090         for (size_t g = 0; g < val_constr.datalen; g++) {
35091                 int64_t val_conv_6 = val_vals[g];
35092                 val_constr.data[g] = val_conv_6;
35093         }
35094         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35095         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35096 }
35097
35098 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) {
35099         LDKThirtyTwoBytes chain_hash_arg_ref;
35100         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35101         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35102         LDKCVec_u64Z short_channel_ids_arg_constr;
35103         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35104         if (short_channel_ids_arg_constr.datalen > 0)
35105                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35106         else
35107                 short_channel_ids_arg_constr.data = NULL;
35108         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35109         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35110                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35111                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35112         }
35113         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35114         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35115         int64_t ret_ref = 0;
35116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35118         return ret_ref;
35119 }
35120
35121 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35122         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35123         int64_t ret_ref = 0;
35124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35126         return ret_ref;
35127 }
35128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35129         LDKReplyChannelRange arg_conv;
35130         arg_conv.inner = untag_ptr(arg);
35131         arg_conv.is_owned = ptr_is_owned(arg);
35132         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35133         arg_conv.is_owned = false;
35134         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35135         return ret_conv;
35136 }
35137
35138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35139         LDKReplyChannelRange orig_conv;
35140         orig_conv.inner = untag_ptr(orig);
35141         orig_conv.is_owned = ptr_is_owned(orig);
35142         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35143         orig_conv.is_owned = false;
35144         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35145         int64_t ret_ref = 0;
35146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35148         return ret_ref;
35149 }
35150
35151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35152         LDKQueryShortChannelIds this_obj_conv;
35153         this_obj_conv.inner = untag_ptr(this_obj);
35154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35156         QueryShortChannelIds_free(this_obj_conv);
35157 }
35158
35159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35160         LDKQueryShortChannelIds this_ptr_conv;
35161         this_ptr_conv.inner = untag_ptr(this_ptr);
35162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35164         this_ptr_conv.is_owned = false;
35165         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35166         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
35167         return ret_arr;
35168 }
35169
35170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35171         LDKQueryShortChannelIds this_ptr_conv;
35172         this_ptr_conv.inner = untag_ptr(this_ptr);
35173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35175         this_ptr_conv.is_owned = false;
35176         LDKThirtyTwoBytes val_ref;
35177         CHECK((*env)->GetArrayLength(env, val) == 32);
35178         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35179         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35180 }
35181
35182 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
35183         LDKQueryShortChannelIds this_ptr_conv;
35184         this_ptr_conv.inner = untag_ptr(this_ptr);
35185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35187         this_ptr_conv.is_owned = false;
35188         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
35189         int64_tArray ret_arr = NULL;
35190         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35191         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35192         for (size_t g = 0; g < ret_var.datalen; g++) {
35193                 int64_t ret_conv_6_conv = ret_var.data[g];
35194                 ret_arr_ptr[g] = ret_conv_6_conv;
35195         }
35196         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35197         FREE(ret_var.data);
35198         return ret_arr;
35199 }
35200
35201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35202         LDKQueryShortChannelIds this_ptr_conv;
35203         this_ptr_conv.inner = untag_ptr(this_ptr);
35204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35206         this_ptr_conv.is_owned = false;
35207         LDKCVec_u64Z val_constr;
35208         val_constr.datalen = (*env)->GetArrayLength(env, val);
35209         if (val_constr.datalen > 0)
35210                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35211         else
35212                 val_constr.data = NULL;
35213         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35214         for (size_t g = 0; g < val_constr.datalen; g++) {
35215                 int64_t val_conv_6 = val_vals[g];
35216                 val_constr.data[g] = val_conv_6;
35217         }
35218         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35219         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35220 }
35221
35222 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) {
35223         LDKThirtyTwoBytes chain_hash_arg_ref;
35224         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35225         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35226         LDKCVec_u64Z short_channel_ids_arg_constr;
35227         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35228         if (short_channel_ids_arg_constr.datalen > 0)
35229                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35230         else
35231                 short_channel_ids_arg_constr.data = NULL;
35232         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35233         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35234                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35235                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35236         }
35237         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35238         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35239         int64_t ret_ref = 0;
35240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35242         return ret_ref;
35243 }
35244
35245 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35246         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35247         int64_t ret_ref = 0;
35248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35250         return ret_ref;
35251 }
35252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35253         LDKQueryShortChannelIds arg_conv;
35254         arg_conv.inner = untag_ptr(arg);
35255         arg_conv.is_owned = ptr_is_owned(arg);
35256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35257         arg_conv.is_owned = false;
35258         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35259         return ret_conv;
35260 }
35261
35262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35263         LDKQueryShortChannelIds orig_conv;
35264         orig_conv.inner = untag_ptr(orig);
35265         orig_conv.is_owned = ptr_is_owned(orig);
35266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35267         orig_conv.is_owned = false;
35268         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35269         int64_t ret_ref = 0;
35270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35272         return ret_ref;
35273 }
35274
35275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35276         LDKReplyShortChannelIdsEnd this_obj_conv;
35277         this_obj_conv.inner = untag_ptr(this_obj);
35278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35280         ReplyShortChannelIdsEnd_free(this_obj_conv);
35281 }
35282
35283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35284         LDKReplyShortChannelIdsEnd this_ptr_conv;
35285         this_ptr_conv.inner = untag_ptr(this_ptr);
35286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35288         this_ptr_conv.is_owned = false;
35289         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35290         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
35291         return ret_arr;
35292 }
35293
35294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35295         LDKReplyShortChannelIdsEnd this_ptr_conv;
35296         this_ptr_conv.inner = untag_ptr(this_ptr);
35297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35299         this_ptr_conv.is_owned = false;
35300         LDKThirtyTwoBytes val_ref;
35301         CHECK((*env)->GetArrayLength(env, val) == 32);
35302         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35303         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35304 }
35305
35306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
35307         LDKReplyShortChannelIdsEnd this_ptr_conv;
35308         this_ptr_conv.inner = untag_ptr(this_ptr);
35309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35311         this_ptr_conv.is_owned = false;
35312         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35313         return ret_conv;
35314 }
35315
35316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35317         LDKReplyShortChannelIdsEnd this_ptr_conv;
35318         this_ptr_conv.inner = untag_ptr(this_ptr);
35319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35321         this_ptr_conv.is_owned = false;
35322         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35323 }
35324
35325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
35326         LDKThirtyTwoBytes chain_hash_arg_ref;
35327         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35328         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35329         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35330         int64_t ret_ref = 0;
35331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35333         return ret_ref;
35334 }
35335
35336 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35337         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35338         int64_t ret_ref = 0;
35339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35341         return ret_ref;
35342 }
35343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35344         LDKReplyShortChannelIdsEnd arg_conv;
35345         arg_conv.inner = untag_ptr(arg);
35346         arg_conv.is_owned = ptr_is_owned(arg);
35347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35348         arg_conv.is_owned = false;
35349         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35350         return ret_conv;
35351 }
35352
35353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35354         LDKReplyShortChannelIdsEnd orig_conv;
35355         orig_conv.inner = untag_ptr(orig);
35356         orig_conv.is_owned = ptr_is_owned(orig);
35357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35358         orig_conv.is_owned = false;
35359         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35360         int64_t ret_ref = 0;
35361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35363         return ret_ref;
35364 }
35365
35366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35367         LDKGossipTimestampFilter this_obj_conv;
35368         this_obj_conv.inner = untag_ptr(this_obj);
35369         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35371         GossipTimestampFilter_free(this_obj_conv);
35372 }
35373
35374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35375         LDKGossipTimestampFilter this_ptr_conv;
35376         this_ptr_conv.inner = untag_ptr(this_ptr);
35377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35379         this_ptr_conv.is_owned = false;
35380         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35381         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
35382         return ret_arr;
35383 }
35384
35385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35386         LDKGossipTimestampFilter this_ptr_conv;
35387         this_ptr_conv.inner = untag_ptr(this_ptr);
35388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35390         this_ptr_conv.is_owned = false;
35391         LDKThirtyTwoBytes val_ref;
35392         CHECK((*env)->GetArrayLength(env, val) == 32);
35393         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35394         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35395 }
35396
35397 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35398         LDKGossipTimestampFilter this_ptr_conv;
35399         this_ptr_conv.inner = untag_ptr(this_ptr);
35400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35402         this_ptr_conv.is_owned = false;
35403         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35404         return ret_conv;
35405 }
35406
35407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35408         LDKGossipTimestampFilter this_ptr_conv;
35409         this_ptr_conv.inner = untag_ptr(this_ptr);
35410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35412         this_ptr_conv.is_owned = false;
35413         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35414 }
35415
35416 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
35417         LDKGossipTimestampFilter this_ptr_conv;
35418         this_ptr_conv.inner = untag_ptr(this_ptr);
35419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35421         this_ptr_conv.is_owned = false;
35422         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35423         return ret_conv;
35424 }
35425
35426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35427         LDKGossipTimestampFilter this_ptr_conv;
35428         this_ptr_conv.inner = untag_ptr(this_ptr);
35429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35431         this_ptr_conv.is_owned = false;
35432         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35433 }
35434
35435 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) {
35436         LDKThirtyTwoBytes chain_hash_arg_ref;
35437         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35438         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35439         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35440         int64_t ret_ref = 0;
35441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35443         return ret_ref;
35444 }
35445
35446 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35447         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35448         int64_t ret_ref = 0;
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35451         return ret_ref;
35452 }
35453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35454         LDKGossipTimestampFilter arg_conv;
35455         arg_conv.inner = untag_ptr(arg);
35456         arg_conv.is_owned = ptr_is_owned(arg);
35457         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35458         arg_conv.is_owned = false;
35459         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35460         return ret_conv;
35461 }
35462
35463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35464         LDKGossipTimestampFilter orig_conv;
35465         orig_conv.inner = untag_ptr(orig);
35466         orig_conv.is_owned = ptr_is_owned(orig);
35467         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35468         orig_conv.is_owned = false;
35469         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35470         int64_t ret_ref = 0;
35471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35473         return ret_ref;
35474 }
35475
35476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35477         if (!ptr_is_owned(this_ptr)) return;
35478         void* this_ptr_ptr = untag_ptr(this_ptr);
35479         CHECK_ACCESS(this_ptr_ptr);
35480         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35481         FREE(untag_ptr(this_ptr));
35482         ErrorAction_free(this_ptr_conv);
35483 }
35484
35485 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35486         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35487         *ret_copy = ErrorAction_clone(arg);
35488         int64_t ret_ref = tag_ptr(ret_copy, true);
35489         return ret_ref;
35490 }
35491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35492         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35493         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35494         return ret_conv;
35495 }
35496
35497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35498         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35499         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35500         *ret_copy = ErrorAction_clone(orig_conv);
35501         int64_t ret_ref = tag_ptr(ret_copy, true);
35502         return ret_ref;
35503 }
35504
35505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
35506         LDKErrorMessage msg_conv;
35507         msg_conv.inner = untag_ptr(msg);
35508         msg_conv.is_owned = ptr_is_owned(msg);
35509         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35510         msg_conv = ErrorMessage_clone(&msg_conv);
35511         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35512         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35513         int64_t ret_ref = tag_ptr(ret_copy, true);
35514         return ret_ref;
35515 }
35516
35517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
35518         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35519         *ret_copy = ErrorAction_ignore_error();
35520         int64_t ret_ref = tag_ptr(ret_copy, true);
35521         return ret_ref;
35522 }
35523
35524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
35525         LDKLevel a_conv = LDKLevel_from_java(env, a);
35526         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35527         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35528         int64_t ret_ref = tag_ptr(ret_copy, true);
35529         return ret_ref;
35530 }
35531
35532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
35533         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35534         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35535         int64_t ret_ref = tag_ptr(ret_copy, true);
35536         return ret_ref;
35537 }
35538
35539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
35540         LDKErrorMessage msg_conv;
35541         msg_conv.inner = untag_ptr(msg);
35542         msg_conv.is_owned = ptr_is_owned(msg);
35543         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35544         msg_conv = ErrorMessage_clone(&msg_conv);
35545         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35546         *ret_copy = ErrorAction_send_error_message(msg_conv);
35547         int64_t ret_ref = tag_ptr(ret_copy, true);
35548         return ret_ref;
35549 }
35550
35551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
35552         LDKWarningMessage msg_conv;
35553         msg_conv.inner = untag_ptr(msg);
35554         msg_conv.is_owned = ptr_is_owned(msg);
35555         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35556         msg_conv = WarningMessage_clone(&msg_conv);
35557         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
35558         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35559         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35560         int64_t ret_ref = tag_ptr(ret_copy, true);
35561         return ret_ref;
35562 }
35563
35564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35565         LDKLightningError this_obj_conv;
35566         this_obj_conv.inner = untag_ptr(this_obj);
35567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35569         LightningError_free(this_obj_conv);
35570 }
35571
35572 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
35573         LDKLightningError this_ptr_conv;
35574         this_ptr_conv.inner = untag_ptr(this_ptr);
35575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35577         this_ptr_conv.is_owned = false;
35578         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35579         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35580         Str_free(ret_str);
35581         return ret_conv;
35582 }
35583
35584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35585         LDKLightningError this_ptr_conv;
35586         this_ptr_conv.inner = untag_ptr(this_ptr);
35587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35589         this_ptr_conv.is_owned = false;
35590         LDKStr val_conv = java_to_owned_str(env, val);
35591         LightningError_set_err(&this_ptr_conv, val_conv);
35592 }
35593
35594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
35595         LDKLightningError this_ptr_conv;
35596         this_ptr_conv.inner = untag_ptr(this_ptr);
35597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35599         this_ptr_conv.is_owned = false;
35600         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35601         *ret_copy = LightningError_get_action(&this_ptr_conv);
35602         int64_t ret_ref = tag_ptr(ret_copy, true);
35603         return ret_ref;
35604 }
35605
35606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35607         LDKLightningError this_ptr_conv;
35608         this_ptr_conv.inner = untag_ptr(this_ptr);
35609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35611         this_ptr_conv.is_owned = false;
35612         void* val_ptr = untag_ptr(val);
35613         CHECK_ACCESS(val_ptr);
35614         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35615         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35616         LightningError_set_action(&this_ptr_conv, val_conv);
35617 }
35618
35619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
35620         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
35621         void* action_arg_ptr = untag_ptr(action_arg);
35622         CHECK_ACCESS(action_arg_ptr);
35623         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35624         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35625         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35626         int64_t ret_ref = 0;
35627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35629         return ret_ref;
35630 }
35631
35632 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35633         LDKLightningError ret_var = LightningError_clone(arg);
35634         int64_t ret_ref = 0;
35635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35637         return ret_ref;
35638 }
35639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35640         LDKLightningError arg_conv;
35641         arg_conv.inner = untag_ptr(arg);
35642         arg_conv.is_owned = ptr_is_owned(arg);
35643         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35644         arg_conv.is_owned = false;
35645         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35646         return ret_conv;
35647 }
35648
35649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35650         LDKLightningError orig_conv;
35651         orig_conv.inner = untag_ptr(orig);
35652         orig_conv.is_owned = ptr_is_owned(orig);
35653         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35654         orig_conv.is_owned = false;
35655         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35656         int64_t ret_ref = 0;
35657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35659         return ret_ref;
35660 }
35661
35662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35663         LDKCommitmentUpdate this_obj_conv;
35664         this_obj_conv.inner = untag_ptr(this_obj);
35665         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35667         CommitmentUpdate_free(this_obj_conv);
35668 }
35669
35670 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35671         LDKCommitmentUpdate this_ptr_conv;
35672         this_ptr_conv.inner = untag_ptr(this_ptr);
35673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35675         this_ptr_conv.is_owned = false;
35676         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35677         int64_tArray ret_arr = NULL;
35678         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35679         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35680         for (size_t p = 0; p < ret_var.datalen; p++) {
35681                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35682                 int64_t ret_conv_15_ref = 0;
35683                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35684                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35685                 ret_arr_ptr[p] = ret_conv_15_ref;
35686         }
35687         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35688         FREE(ret_var.data);
35689         return ret_arr;
35690 }
35691
35692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35693         LDKCommitmentUpdate this_ptr_conv;
35694         this_ptr_conv.inner = untag_ptr(this_ptr);
35695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35697         this_ptr_conv.is_owned = false;
35698         LDKCVec_UpdateAddHTLCZ val_constr;
35699         val_constr.datalen = (*env)->GetArrayLength(env, val);
35700         if (val_constr.datalen > 0)
35701                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35702         else
35703                 val_constr.data = NULL;
35704         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35705         for (size_t p = 0; p < val_constr.datalen; p++) {
35706                 int64_t val_conv_15 = val_vals[p];
35707                 LDKUpdateAddHTLC val_conv_15_conv;
35708                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35709                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35710                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35711                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35712                 val_constr.data[p] = val_conv_15_conv;
35713         }
35714         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35715         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35716 }
35717
35718 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35719         LDKCommitmentUpdate this_ptr_conv;
35720         this_ptr_conv.inner = untag_ptr(this_ptr);
35721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35723         this_ptr_conv.is_owned = false;
35724         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35725         int64_tArray ret_arr = NULL;
35726         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35727         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35728         for (size_t t = 0; t < ret_var.datalen; t++) {
35729                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35730                 int64_t ret_conv_19_ref = 0;
35731                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35732                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
35733                 ret_arr_ptr[t] = ret_conv_19_ref;
35734         }
35735         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35736         FREE(ret_var.data);
35737         return ret_arr;
35738 }
35739
35740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35741         LDKCommitmentUpdate this_ptr_conv;
35742         this_ptr_conv.inner = untag_ptr(this_ptr);
35743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35745         this_ptr_conv.is_owned = false;
35746         LDKCVec_UpdateFulfillHTLCZ val_constr;
35747         val_constr.datalen = (*env)->GetArrayLength(env, val);
35748         if (val_constr.datalen > 0)
35749                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35750         else
35751                 val_constr.data = NULL;
35752         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35753         for (size_t t = 0; t < val_constr.datalen; t++) {
35754                 int64_t val_conv_19 = val_vals[t];
35755                 LDKUpdateFulfillHTLC val_conv_19_conv;
35756                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
35757                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
35758                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
35759                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
35760                 val_constr.data[t] = val_conv_19_conv;
35761         }
35762         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35763         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
35764 }
35765
35766 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35767         LDKCommitmentUpdate this_ptr_conv;
35768         this_ptr_conv.inner = untag_ptr(this_ptr);
35769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35771         this_ptr_conv.is_owned = false;
35772         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
35773         int64_tArray ret_arr = NULL;
35774         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35775         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35776         for (size_t q = 0; q < ret_var.datalen; q++) {
35777                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
35778                 int64_t ret_conv_16_ref = 0;
35779                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35780                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35781                 ret_arr_ptr[q] = ret_conv_16_ref;
35782         }
35783         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35784         FREE(ret_var.data);
35785         return ret_arr;
35786 }
35787
35788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35789         LDKCommitmentUpdate this_ptr_conv;
35790         this_ptr_conv.inner = untag_ptr(this_ptr);
35791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35793         this_ptr_conv.is_owned = false;
35794         LDKCVec_UpdateFailHTLCZ val_constr;
35795         val_constr.datalen = (*env)->GetArrayLength(env, val);
35796         if (val_constr.datalen > 0)
35797                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35798         else
35799                 val_constr.data = NULL;
35800         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35801         for (size_t q = 0; q < val_constr.datalen; q++) {
35802                 int64_t val_conv_16 = val_vals[q];
35803                 LDKUpdateFailHTLC val_conv_16_conv;
35804                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
35805                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
35806                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35807                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
35808                 val_constr.data[q] = val_conv_16_conv;
35809         }
35810         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35811         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
35812 }
35813
35814 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35815         LDKCommitmentUpdate this_ptr_conv;
35816         this_ptr_conv.inner = untag_ptr(this_ptr);
35817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35819         this_ptr_conv.is_owned = false;
35820         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
35821         int64_tArray ret_arr = NULL;
35822         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35823         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35824         for (size_t z = 0; z < ret_var.datalen; z++) {
35825                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
35826                 int64_t ret_conv_25_ref = 0;
35827                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
35828                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
35829                 ret_arr_ptr[z] = ret_conv_25_ref;
35830         }
35831         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35832         FREE(ret_var.data);
35833         return ret_arr;
35834 }
35835
35836 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) {
35837         LDKCommitmentUpdate this_ptr_conv;
35838         this_ptr_conv.inner = untag_ptr(this_ptr);
35839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35841         this_ptr_conv.is_owned = false;
35842         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
35843         val_constr.datalen = (*env)->GetArrayLength(env, val);
35844         if (val_constr.datalen > 0)
35845                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35846         else
35847                 val_constr.data = NULL;
35848         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35849         for (size_t z = 0; z < val_constr.datalen; z++) {
35850                 int64_t val_conv_25 = val_vals[z];
35851                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
35852                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
35853                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
35854                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
35855                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
35856                 val_constr.data[z] = val_conv_25_conv;
35857         }
35858         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35859         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
35860 }
35861
35862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
35863         LDKCommitmentUpdate this_ptr_conv;
35864         this_ptr_conv.inner = untag_ptr(this_ptr);
35865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35867         this_ptr_conv.is_owned = false;
35868         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
35869         int64_t ret_ref = 0;
35870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35872         return ret_ref;
35873 }
35874
35875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35876         LDKCommitmentUpdate this_ptr_conv;
35877         this_ptr_conv.inner = untag_ptr(this_ptr);
35878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35880         this_ptr_conv.is_owned = false;
35881         LDKUpdateFee val_conv;
35882         val_conv.inner = untag_ptr(val);
35883         val_conv.is_owned = ptr_is_owned(val);
35884         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35885         val_conv = UpdateFee_clone(&val_conv);
35886         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
35887 }
35888
35889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
35890         LDKCommitmentUpdate this_ptr_conv;
35891         this_ptr_conv.inner = untag_ptr(this_ptr);
35892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35894         this_ptr_conv.is_owned = false;
35895         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
35896         int64_t ret_ref = 0;
35897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35899         return ret_ref;
35900 }
35901
35902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35903         LDKCommitmentUpdate this_ptr_conv;
35904         this_ptr_conv.inner = untag_ptr(this_ptr);
35905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35907         this_ptr_conv.is_owned = false;
35908         LDKCommitmentSigned val_conv;
35909         val_conv.inner = untag_ptr(val);
35910         val_conv.is_owned = ptr_is_owned(val);
35911         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35912         val_conv = CommitmentSigned_clone(&val_conv);
35913         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
35914 }
35915
35916 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) {
35917         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
35918         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
35919         if (update_add_htlcs_arg_constr.datalen > 0)
35920                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35921         else
35922                 update_add_htlcs_arg_constr.data = NULL;
35923         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
35924         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
35925                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
35926                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
35927                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
35928                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
35929                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
35930                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
35931                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
35932         }
35933         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
35934         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
35935         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
35936         if (update_fulfill_htlcs_arg_constr.datalen > 0)
35937                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35938         else
35939                 update_fulfill_htlcs_arg_constr.data = NULL;
35940         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
35941         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
35942                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
35943                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
35944                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
35945                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
35946                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
35947                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
35948                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
35949         }
35950         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
35951         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
35952         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
35953         if (update_fail_htlcs_arg_constr.datalen > 0)
35954                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35955         else
35956                 update_fail_htlcs_arg_constr.data = NULL;
35957         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
35958         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
35959                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
35960                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
35961                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
35962                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
35963                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
35964                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
35965                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
35966         }
35967         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
35968         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
35969         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
35970         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
35971                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35972         else
35973                 update_fail_malformed_htlcs_arg_constr.data = NULL;
35974         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
35975         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
35976                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
35977                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
35978                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
35979                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
35980                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
35981                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
35982                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
35983         }
35984         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
35985         LDKUpdateFee update_fee_arg_conv;
35986         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
35987         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
35988         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
35989         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
35990         LDKCommitmentSigned commitment_signed_arg_conv;
35991         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
35992         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
35993         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
35994         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
35995         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);
35996         int64_t ret_ref = 0;
35997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35999         return ret_ref;
36000 }
36001
36002 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36003         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36004         int64_t ret_ref = 0;
36005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36007         return ret_ref;
36008 }
36009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36010         LDKCommitmentUpdate arg_conv;
36011         arg_conv.inner = untag_ptr(arg);
36012         arg_conv.is_owned = ptr_is_owned(arg);
36013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36014         arg_conv.is_owned = false;
36015         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36016         return ret_conv;
36017 }
36018
36019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36020         LDKCommitmentUpdate orig_conv;
36021         orig_conv.inner = untag_ptr(orig);
36022         orig_conv.is_owned = ptr_is_owned(orig);
36023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36024         orig_conv.is_owned = false;
36025         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36026         int64_t ret_ref = 0;
36027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36029         return ret_ref;
36030 }
36031
36032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36033         if (!ptr_is_owned(this_ptr)) return;
36034         void* this_ptr_ptr = untag_ptr(this_ptr);
36035         CHECK_ACCESS(this_ptr_ptr);
36036         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36037         FREE(untag_ptr(this_ptr));
36038         ChannelMessageHandler_free(this_ptr_conv);
36039 }
36040
36041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36042         if (!ptr_is_owned(this_ptr)) return;
36043         void* this_ptr_ptr = untag_ptr(this_ptr);
36044         CHECK_ACCESS(this_ptr_ptr);
36045         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36046         FREE(untag_ptr(this_ptr));
36047         RoutingMessageHandler_free(this_ptr_conv);
36048 }
36049
36050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36051         LDKAcceptChannel obj_conv;
36052         obj_conv.inner = untag_ptr(obj);
36053         obj_conv.is_owned = ptr_is_owned(obj);
36054         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36055         obj_conv.is_owned = false;
36056         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36059         CVec_u8Z_free(ret_var);
36060         return ret_arr;
36061 }
36062
36063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36064         LDKu8slice ser_ref;
36065         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36066         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36067         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36068         *ret_conv = AcceptChannel_read(ser_ref);
36069         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36070         return tag_ptr(ret_conv, true);
36071 }
36072
36073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36074         LDKAnnouncementSignatures obj_conv;
36075         obj_conv.inner = untag_ptr(obj);
36076         obj_conv.is_owned = ptr_is_owned(obj);
36077         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36078         obj_conv.is_owned = false;
36079         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36080         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36081         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36082         CVec_u8Z_free(ret_var);
36083         return ret_arr;
36084 }
36085
36086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36087         LDKu8slice ser_ref;
36088         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36089         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36090         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36091         *ret_conv = AnnouncementSignatures_read(ser_ref);
36092         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36093         return tag_ptr(ret_conv, true);
36094 }
36095
36096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
36097         LDKChannelReestablish obj_conv;
36098         obj_conv.inner = untag_ptr(obj);
36099         obj_conv.is_owned = ptr_is_owned(obj);
36100         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36101         obj_conv.is_owned = false;
36102         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36103         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36104         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36105         CVec_u8Z_free(ret_var);
36106         return ret_arr;
36107 }
36108
36109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36110         LDKu8slice ser_ref;
36111         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36112         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36113         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36114         *ret_conv = ChannelReestablish_read(ser_ref);
36115         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36116         return tag_ptr(ret_conv, true);
36117 }
36118
36119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36120         LDKClosingSigned obj_conv;
36121         obj_conv.inner = untag_ptr(obj);
36122         obj_conv.is_owned = ptr_is_owned(obj);
36123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36124         obj_conv.is_owned = false;
36125         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36126         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36127         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36128         CVec_u8Z_free(ret_var);
36129         return ret_arr;
36130 }
36131
36132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36133         LDKu8slice ser_ref;
36134         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36135         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36136         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36137         *ret_conv = ClosingSigned_read(ser_ref);
36138         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36139         return tag_ptr(ret_conv, true);
36140 }
36141
36142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36143         LDKClosingSignedFeeRange obj_conv;
36144         obj_conv.inner = untag_ptr(obj);
36145         obj_conv.is_owned = ptr_is_owned(obj);
36146         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36147         obj_conv.is_owned = false;
36148         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36149         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36150         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36151         CVec_u8Z_free(ret_var);
36152         return ret_arr;
36153 }
36154
36155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36156         LDKu8slice ser_ref;
36157         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36158         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36159         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36160         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36161         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36162         return tag_ptr(ret_conv, true);
36163 }
36164
36165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36166         LDKCommitmentSigned obj_conv;
36167         obj_conv.inner = untag_ptr(obj);
36168         obj_conv.is_owned = ptr_is_owned(obj);
36169         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36170         obj_conv.is_owned = false;
36171         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36172         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36173         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36174         CVec_u8Z_free(ret_var);
36175         return ret_arr;
36176 }
36177
36178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36179         LDKu8slice ser_ref;
36180         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36181         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36182         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36183         *ret_conv = CommitmentSigned_read(ser_ref);
36184         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36185         return tag_ptr(ret_conv, true);
36186 }
36187
36188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
36189         LDKFundingCreated obj_conv;
36190         obj_conv.inner = untag_ptr(obj);
36191         obj_conv.is_owned = ptr_is_owned(obj);
36192         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36193         obj_conv.is_owned = false;
36194         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36195         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36196         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36197         CVec_u8Z_free(ret_var);
36198         return ret_arr;
36199 }
36200
36201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36202         LDKu8slice ser_ref;
36203         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36204         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36205         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36206         *ret_conv = FundingCreated_read(ser_ref);
36207         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36208         return tag_ptr(ret_conv, true);
36209 }
36210
36211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36212         LDKFundingSigned obj_conv;
36213         obj_conv.inner = untag_ptr(obj);
36214         obj_conv.is_owned = ptr_is_owned(obj);
36215         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36216         obj_conv.is_owned = false;
36217         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36218         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36219         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36220         CVec_u8Z_free(ret_var);
36221         return ret_arr;
36222 }
36223
36224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36225         LDKu8slice ser_ref;
36226         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36227         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36228         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36229         *ret_conv = FundingSigned_read(ser_ref);
36230         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36231         return tag_ptr(ret_conv, true);
36232 }
36233
36234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
36235         LDKChannelReady obj_conv;
36236         obj_conv.inner = untag_ptr(obj);
36237         obj_conv.is_owned = ptr_is_owned(obj);
36238         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36239         obj_conv.is_owned = false;
36240         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36241         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36242         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36243         CVec_u8Z_free(ret_var);
36244         return ret_arr;
36245 }
36246
36247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36248         LDKu8slice ser_ref;
36249         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36250         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36251         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36252         *ret_conv = ChannelReady_read(ser_ref);
36253         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36254         return tag_ptr(ret_conv, true);
36255 }
36256
36257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
36258         LDKInit obj_conv;
36259         obj_conv.inner = untag_ptr(obj);
36260         obj_conv.is_owned = ptr_is_owned(obj);
36261         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36262         obj_conv.is_owned = false;
36263         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36264         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36265         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36266         CVec_u8Z_free(ret_var);
36267         return ret_arr;
36268 }
36269
36270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36271         LDKu8slice ser_ref;
36272         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36273         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36274         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36275         *ret_conv = Init_read(ser_ref);
36276         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36277         return tag_ptr(ret_conv, true);
36278 }
36279
36280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36281         LDKOpenChannel obj_conv;
36282         obj_conv.inner = untag_ptr(obj);
36283         obj_conv.is_owned = ptr_is_owned(obj);
36284         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36285         obj_conv.is_owned = false;
36286         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36287         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36288         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36289         CVec_u8Z_free(ret_var);
36290         return ret_arr;
36291 }
36292
36293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36294         LDKu8slice ser_ref;
36295         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36296         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36297         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36298         *ret_conv = OpenChannel_read(ser_ref);
36299         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36300         return tag_ptr(ret_conv, true);
36301 }
36302
36303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
36304         LDKRevokeAndACK obj_conv;
36305         obj_conv.inner = untag_ptr(obj);
36306         obj_conv.is_owned = ptr_is_owned(obj);
36307         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36308         obj_conv.is_owned = false;
36309         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36310         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36311         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36312         CVec_u8Z_free(ret_var);
36313         return ret_arr;
36314 }
36315
36316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36317         LDKu8slice ser_ref;
36318         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36319         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36320         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36321         *ret_conv = RevokeAndACK_read(ser_ref);
36322         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36323         return tag_ptr(ret_conv, true);
36324 }
36325
36326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
36327         LDKShutdown obj_conv;
36328         obj_conv.inner = untag_ptr(obj);
36329         obj_conv.is_owned = ptr_is_owned(obj);
36330         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36331         obj_conv.is_owned = false;
36332         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36333         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36334         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36335         CVec_u8Z_free(ret_var);
36336         return ret_arr;
36337 }
36338
36339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36340         LDKu8slice ser_ref;
36341         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36342         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36343         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36344         *ret_conv = Shutdown_read(ser_ref);
36345         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36346         return tag_ptr(ret_conv, true);
36347 }
36348
36349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36350         LDKUpdateFailHTLC obj_conv;
36351         obj_conv.inner = untag_ptr(obj);
36352         obj_conv.is_owned = ptr_is_owned(obj);
36353         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36354         obj_conv.is_owned = false;
36355         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36356         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36357         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36358         CVec_u8Z_free(ret_var);
36359         return ret_arr;
36360 }
36361
36362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36363         LDKu8slice ser_ref;
36364         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36365         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36366         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36367         *ret_conv = UpdateFailHTLC_read(ser_ref);
36368         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36369         return tag_ptr(ret_conv, true);
36370 }
36371
36372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36373         LDKUpdateFailMalformedHTLC obj_conv;
36374         obj_conv.inner = untag_ptr(obj);
36375         obj_conv.is_owned = ptr_is_owned(obj);
36376         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36377         obj_conv.is_owned = false;
36378         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36379         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36380         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36381         CVec_u8Z_free(ret_var);
36382         return ret_arr;
36383 }
36384
36385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36386         LDKu8slice ser_ref;
36387         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36388         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36389         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36390         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36391         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36392         return tag_ptr(ret_conv, true);
36393 }
36394
36395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
36396         LDKUpdateFee obj_conv;
36397         obj_conv.inner = untag_ptr(obj);
36398         obj_conv.is_owned = ptr_is_owned(obj);
36399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36400         obj_conv.is_owned = false;
36401         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36402         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36403         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36404         CVec_u8Z_free(ret_var);
36405         return ret_arr;
36406 }
36407
36408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36409         LDKu8slice ser_ref;
36410         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36411         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36412         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36413         *ret_conv = UpdateFee_read(ser_ref);
36414         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36415         return tag_ptr(ret_conv, true);
36416 }
36417
36418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36419         LDKUpdateFulfillHTLC obj_conv;
36420         obj_conv.inner = untag_ptr(obj);
36421         obj_conv.is_owned = ptr_is_owned(obj);
36422         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36423         obj_conv.is_owned = false;
36424         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36425         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36426         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36427         CVec_u8Z_free(ret_var);
36428         return ret_arr;
36429 }
36430
36431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36432         LDKu8slice ser_ref;
36433         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36434         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36435         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36436         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36437         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36438         return tag_ptr(ret_conv, true);
36439 }
36440
36441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36442         LDKUpdateAddHTLC obj_conv;
36443         obj_conv.inner = untag_ptr(obj);
36444         obj_conv.is_owned = ptr_is_owned(obj);
36445         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36446         obj_conv.is_owned = false;
36447         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36448         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36449         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36450         CVec_u8Z_free(ret_var);
36451         return ret_arr;
36452 }
36453
36454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36455         LDKu8slice ser_ref;
36456         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36457         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36458         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36459         *ret_conv = UpdateAddHTLC_read(ser_ref);
36460         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36461         return tag_ptr(ret_conv, true);
36462 }
36463
36464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
36465         LDKPing obj_conv;
36466         obj_conv.inner = untag_ptr(obj);
36467         obj_conv.is_owned = ptr_is_owned(obj);
36468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36469         obj_conv.is_owned = false;
36470         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36471         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36472         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36473         CVec_u8Z_free(ret_var);
36474         return ret_arr;
36475 }
36476
36477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36478         LDKu8slice ser_ref;
36479         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36480         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36481         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36482         *ret_conv = Ping_read(ser_ref);
36483         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36484         return tag_ptr(ret_conv, true);
36485 }
36486
36487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
36488         LDKPong obj_conv;
36489         obj_conv.inner = untag_ptr(obj);
36490         obj_conv.is_owned = ptr_is_owned(obj);
36491         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36492         obj_conv.is_owned = false;
36493         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36494         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36495         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36496         CVec_u8Z_free(ret_var);
36497         return ret_arr;
36498 }
36499
36500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36501         LDKu8slice ser_ref;
36502         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36503         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36504         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36505         *ret_conv = Pong_read(ser_ref);
36506         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36507         return tag_ptr(ret_conv, true);
36508 }
36509
36510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36511         LDKUnsignedChannelAnnouncement obj_conv;
36512         obj_conv.inner = untag_ptr(obj);
36513         obj_conv.is_owned = ptr_is_owned(obj);
36514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36515         obj_conv.is_owned = false;
36516         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36517         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36518         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36519         CVec_u8Z_free(ret_var);
36520         return ret_arr;
36521 }
36522
36523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36524         LDKu8slice ser_ref;
36525         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36526         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36527         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36528         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36529         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36530         return tag_ptr(ret_conv, true);
36531 }
36532
36533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36534         LDKChannelAnnouncement obj_conv;
36535         obj_conv.inner = untag_ptr(obj);
36536         obj_conv.is_owned = ptr_is_owned(obj);
36537         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36538         obj_conv.is_owned = false;
36539         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36540         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36541         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36542         CVec_u8Z_free(ret_var);
36543         return ret_arr;
36544 }
36545
36546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36547         LDKu8slice ser_ref;
36548         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36549         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36550         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36551         *ret_conv = ChannelAnnouncement_read(ser_ref);
36552         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36553         return tag_ptr(ret_conv, true);
36554 }
36555
36556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
36557         LDKUnsignedChannelUpdate obj_conv;
36558         obj_conv.inner = untag_ptr(obj);
36559         obj_conv.is_owned = ptr_is_owned(obj);
36560         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36561         obj_conv.is_owned = false;
36562         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36563         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36564         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36565         CVec_u8Z_free(ret_var);
36566         return ret_arr;
36567 }
36568
36569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36570         LDKu8slice ser_ref;
36571         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36572         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36573         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36574         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36575         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36576         return tag_ptr(ret_conv, true);
36577 }
36578
36579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
36580         LDKChannelUpdate obj_conv;
36581         obj_conv.inner = untag_ptr(obj);
36582         obj_conv.is_owned = ptr_is_owned(obj);
36583         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36584         obj_conv.is_owned = false;
36585         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36586         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36587         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36588         CVec_u8Z_free(ret_var);
36589         return ret_arr;
36590 }
36591
36592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36593         LDKu8slice ser_ref;
36594         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36595         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36596         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36597         *ret_conv = ChannelUpdate_read(ser_ref);
36598         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36599         return tag_ptr(ret_conv, true);
36600 }
36601
36602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
36603         LDKErrorMessage obj_conv;
36604         obj_conv.inner = untag_ptr(obj);
36605         obj_conv.is_owned = ptr_is_owned(obj);
36606         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36607         obj_conv.is_owned = false;
36608         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36609         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36610         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36611         CVec_u8Z_free(ret_var);
36612         return ret_arr;
36613 }
36614
36615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36616         LDKu8slice ser_ref;
36617         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36618         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36619         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36620         *ret_conv = ErrorMessage_read(ser_ref);
36621         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36622         return tag_ptr(ret_conv, true);
36623 }
36624
36625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
36626         LDKWarningMessage obj_conv;
36627         obj_conv.inner = untag_ptr(obj);
36628         obj_conv.is_owned = ptr_is_owned(obj);
36629         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36630         obj_conv.is_owned = false;
36631         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36632         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36633         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36634         CVec_u8Z_free(ret_var);
36635         return ret_arr;
36636 }
36637
36638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36639         LDKu8slice ser_ref;
36640         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36641         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36642         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36643         *ret_conv = WarningMessage_read(ser_ref);
36644         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36645         return tag_ptr(ret_conv, true);
36646 }
36647
36648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36649         LDKUnsignedNodeAnnouncement obj_conv;
36650         obj_conv.inner = untag_ptr(obj);
36651         obj_conv.is_owned = ptr_is_owned(obj);
36652         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36653         obj_conv.is_owned = false;
36654         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36655         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36656         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36657         CVec_u8Z_free(ret_var);
36658         return ret_arr;
36659 }
36660
36661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36662         LDKu8slice ser_ref;
36663         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36664         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36665         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36666         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36667         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36668         return tag_ptr(ret_conv, true);
36669 }
36670
36671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36672         LDKNodeAnnouncement obj_conv;
36673         obj_conv.inner = untag_ptr(obj);
36674         obj_conv.is_owned = ptr_is_owned(obj);
36675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36676         obj_conv.is_owned = false;
36677         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36678         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36679         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36680         CVec_u8Z_free(ret_var);
36681         return ret_arr;
36682 }
36683
36684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36685         LDKu8slice ser_ref;
36686         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36687         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36688         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36689         *ret_conv = NodeAnnouncement_read(ser_ref);
36690         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36691         return tag_ptr(ret_conv, true);
36692 }
36693
36694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36695         LDKu8slice ser_ref;
36696         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36697         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36698         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36699         *ret_conv = QueryShortChannelIds_read(ser_ref);
36700         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36701         return tag_ptr(ret_conv, true);
36702 }
36703
36704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
36705         LDKQueryShortChannelIds obj_conv;
36706         obj_conv.inner = untag_ptr(obj);
36707         obj_conv.is_owned = ptr_is_owned(obj);
36708         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36709         obj_conv.is_owned = false;
36710         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
36711         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36712         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36713         CVec_u8Z_free(ret_var);
36714         return ret_arr;
36715 }
36716
36717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
36718         LDKReplyShortChannelIdsEnd obj_conv;
36719         obj_conv.inner = untag_ptr(obj);
36720         obj_conv.is_owned = ptr_is_owned(obj);
36721         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36722         obj_conv.is_owned = false;
36723         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
36724         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36725         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36726         CVec_u8Z_free(ret_var);
36727         return ret_arr;
36728 }
36729
36730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36731         LDKu8slice ser_ref;
36732         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36733         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36734         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36735         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
36736         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36737         return tag_ptr(ret_conv, true);
36738 }
36739
36740 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
36741         LDKQueryChannelRange this_arg_conv;
36742         this_arg_conv.inner = untag_ptr(this_arg);
36743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36745         this_arg_conv.is_owned = false;
36746         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
36747         return ret_conv;
36748 }
36749
36750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36751         LDKQueryChannelRange obj_conv;
36752         obj_conv.inner = untag_ptr(obj);
36753         obj_conv.is_owned = ptr_is_owned(obj);
36754         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36755         obj_conv.is_owned = false;
36756         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
36757         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36758         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36759         CVec_u8Z_free(ret_var);
36760         return ret_arr;
36761 }
36762
36763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36764         LDKu8slice ser_ref;
36765         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36766         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36767         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36768         *ret_conv = QueryChannelRange_read(ser_ref);
36769         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36770         return tag_ptr(ret_conv, true);
36771 }
36772
36773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36774         LDKu8slice ser_ref;
36775         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36776         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36777         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36778         *ret_conv = ReplyChannelRange_read(ser_ref);
36779         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36780         return tag_ptr(ret_conv, true);
36781 }
36782
36783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36784         LDKReplyChannelRange obj_conv;
36785         obj_conv.inner = untag_ptr(obj);
36786         obj_conv.is_owned = ptr_is_owned(obj);
36787         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36788         obj_conv.is_owned = false;
36789         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
36790         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36791         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36792         CVec_u8Z_free(ret_var);
36793         return ret_arr;
36794 }
36795
36796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
36797         LDKGossipTimestampFilter obj_conv;
36798         obj_conv.inner = untag_ptr(obj);
36799         obj_conv.is_owned = ptr_is_owned(obj);
36800         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36801         obj_conv.is_owned = false;
36802         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
36803         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36804         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36805         CVec_u8Z_free(ret_var);
36806         return ret_arr;
36807 }
36808
36809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36810         LDKu8slice ser_ref;
36811         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36812         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36813         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36814         *ret_conv = GossipTimestampFilter_read(ser_ref);
36815         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36816         return tag_ptr(ret_conv, true);
36817 }
36818
36819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36820         if (!ptr_is_owned(this_ptr)) return;
36821         void* this_ptr_ptr = untag_ptr(this_ptr);
36822         CHECK_ACCESS(this_ptr_ptr);
36823         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
36824         FREE(untag_ptr(this_ptr));
36825         CustomMessageHandler_free(this_ptr_conv);
36826 }
36827
36828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36829         LDKIgnoringMessageHandler this_obj_conv;
36830         this_obj_conv.inner = untag_ptr(this_obj);
36831         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36833         IgnoringMessageHandler_free(this_obj_conv);
36834 }
36835
36836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
36837         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
36838         int64_t ret_ref = 0;
36839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36841         return ret_ref;
36842 }
36843
36844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36845         LDKIgnoringMessageHandler this_arg_conv;
36846         this_arg_conv.inner = untag_ptr(this_arg);
36847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36849         this_arg_conv.is_owned = false;
36850         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36851         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36852         return tag_ptr(ret_ret, true);
36853 }
36854
36855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36856         LDKIgnoringMessageHandler this_arg_conv;
36857         this_arg_conv.inner = untag_ptr(this_arg);
36858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36860         this_arg_conv.is_owned = false;
36861         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
36862         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
36863         return tag_ptr(ret_ret, true);
36864 }
36865
36866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
36867         LDKIgnoringMessageHandler this_arg_conv;
36868         this_arg_conv.inner = untag_ptr(this_arg);
36869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36871         this_arg_conv.is_owned = false;
36872         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
36873         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
36874         return tag_ptr(ret_ret, true);
36875 }
36876
36877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36878         LDKIgnoringMessageHandler this_arg_conv;
36879         this_arg_conv.inner = untag_ptr(this_arg);
36880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36882         this_arg_conv.is_owned = false;
36883         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
36884         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
36885         return tag_ptr(ret_ret, true);
36886 }
36887
36888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36889         LDKErroringMessageHandler this_obj_conv;
36890         this_obj_conv.inner = untag_ptr(this_obj);
36891         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36893         ErroringMessageHandler_free(this_obj_conv);
36894 }
36895
36896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
36897         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
36898         int64_t ret_ref = 0;
36899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36901         return ret_ref;
36902 }
36903
36904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36905         LDKErroringMessageHandler this_arg_conv;
36906         this_arg_conv.inner = untag_ptr(this_arg);
36907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36909         this_arg_conv.is_owned = false;
36910         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36911         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36912         return tag_ptr(ret_ret, true);
36913 }
36914
36915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36916         LDKErroringMessageHandler this_arg_conv;
36917         this_arg_conv.inner = untag_ptr(this_arg);
36918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36920         this_arg_conv.is_owned = false;
36921         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36922         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
36923         return tag_ptr(ret_ret, true);
36924 }
36925
36926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36927         LDKMessageHandler this_obj_conv;
36928         this_obj_conv.inner = untag_ptr(this_obj);
36929         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36931         MessageHandler_free(this_obj_conv);
36932 }
36933
36934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36935         LDKMessageHandler this_ptr_conv;
36936         this_ptr_conv.inner = untag_ptr(this_ptr);
36937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36939         this_ptr_conv.is_owned = false;
36940         // WARNING: This object doesn't live past this scope, needs clone!
36941         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
36942         return ret_ret;
36943 }
36944
36945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36946         LDKMessageHandler this_ptr_conv;
36947         this_ptr_conv.inner = untag_ptr(this_ptr);
36948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36950         this_ptr_conv.is_owned = false;
36951         void* val_ptr = untag_ptr(val);
36952         CHECK_ACCESS(val_ptr);
36953         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
36954         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
36955                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36956                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
36957         }
36958         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
36959 }
36960
36961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36962         LDKMessageHandler this_ptr_conv;
36963         this_ptr_conv.inner = untag_ptr(this_ptr);
36964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36966         this_ptr_conv.is_owned = false;
36967         // WARNING: This object doesn't live past this scope, needs clone!
36968         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
36969         return ret_ret;
36970 }
36971
36972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36973         LDKMessageHandler this_ptr_conv;
36974         this_ptr_conv.inner = untag_ptr(this_ptr);
36975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36977         this_ptr_conv.is_owned = false;
36978         void* val_ptr = untag_ptr(val);
36979         CHECK_ACCESS(val_ptr);
36980         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
36981         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36982                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36983                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
36984         }
36985         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
36986 }
36987
36988 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) {
36989         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
36990         CHECK_ACCESS(chan_handler_arg_ptr);
36991         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
36992         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
36993                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36994                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
36995         }
36996         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
36997         CHECK_ACCESS(route_handler_arg_ptr);
36998         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
36999         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
37000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37001                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37002         }
37003         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
37004         int64_t ret_ref = 0;
37005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37007         return ret_ref;
37008 }
37009
37010 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37011         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37012         *ret_ret = SocketDescriptor_clone(arg);
37013         return tag_ptr(ret_ret, true);
37014 }
37015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37016         void* arg_ptr = untag_ptr(arg);
37017         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37018         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37019         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37020         return ret_conv;
37021 }
37022
37023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37024         void* orig_ptr = untag_ptr(orig);
37025         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37026         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37027         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37028         *ret_ret = SocketDescriptor_clone(orig_conv);
37029         return tag_ptr(ret_ret, true);
37030 }
37031
37032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37033         if (!ptr_is_owned(this_ptr)) return;
37034         void* this_ptr_ptr = untag_ptr(this_ptr);
37035         CHECK_ACCESS(this_ptr_ptr);
37036         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37037         FREE(untag_ptr(this_ptr));
37038         SocketDescriptor_free(this_ptr_conv);
37039 }
37040
37041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37042         LDKPeerHandleError this_obj_conv;
37043         this_obj_conv.inner = untag_ptr(this_obj);
37044         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37046         PeerHandleError_free(this_obj_conv);
37047 }
37048
37049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
37050         LDKPeerHandleError this_ptr_conv;
37051         this_ptr_conv.inner = untag_ptr(this_ptr);
37052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37054         this_ptr_conv.is_owned = false;
37055         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
37056         return ret_conv;
37057 }
37058
37059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37060         LDKPeerHandleError this_ptr_conv;
37061         this_ptr_conv.inner = untag_ptr(this_ptr);
37062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37064         this_ptr_conv.is_owned = false;
37065         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
37066 }
37067
37068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
37069         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
37070         int64_t ret_ref = 0;
37071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37073         return ret_ref;
37074 }
37075
37076 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37077         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37078         int64_t ret_ref = 0;
37079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37081         return ret_ref;
37082 }
37083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37084         LDKPeerHandleError arg_conv;
37085         arg_conv.inner = untag_ptr(arg);
37086         arg_conv.is_owned = ptr_is_owned(arg);
37087         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37088         arg_conv.is_owned = false;
37089         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37090         return ret_conv;
37091 }
37092
37093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37094         LDKPeerHandleError orig_conv;
37095         orig_conv.inner = untag_ptr(orig);
37096         orig_conv.is_owned = ptr_is_owned(orig);
37097         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37098         orig_conv.is_owned = false;
37099         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37100         int64_t ret_ref = 0;
37101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37103         return ret_ref;
37104 }
37105
37106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37107         LDKPeerManager this_obj_conv;
37108         this_obj_conv.inner = untag_ptr(this_obj);
37109         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37111         PeerManager_free(this_obj_conv);
37112 }
37113
37114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) {
37115         LDKMessageHandler message_handler_conv;
37116         message_handler_conv.inner = untag_ptr(message_handler);
37117         message_handler_conv.is_owned = ptr_is_owned(message_handler);
37118         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37119         // WARNING: we need a move here but no clone is available for LDKMessageHandler
37120         
37121         LDKSecretKey our_node_secret_ref;
37122         CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
37123         (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
37124         unsigned char ephemeral_random_data_arr[32];
37125         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
37126         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
37127         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37128         void* logger_ptr = untag_ptr(logger);
37129         CHECK_ACCESS(logger_ptr);
37130         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37131         if (logger_conv.free == LDKLogger_JCalls_free) {
37132                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37133                 LDKLogger_JCalls_cloned(&logger_conv);
37134         }
37135         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
37136         CHECK_ACCESS(custom_message_handler_ptr);
37137         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37138         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37139                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37140                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37141         }
37142         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
37143         int64_t ret_ref = 0;
37144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37146         return ret_ref;
37147 }
37148
37149 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
37150         LDKPeerManager this_arg_conv;
37151         this_arg_conv.inner = untag_ptr(this_arg);
37152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37154         this_arg_conv.is_owned = false;
37155         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37156         jobjectArray ret_arr = NULL;
37157         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
37158         ;
37159         for (size_t i = 0; i < ret_var.datalen; i++) {
37160                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
37161                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
37162                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
37163         }
37164         
37165         FREE(ret_var.data);
37166         return ret_arr;
37167 }
37168
37169 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) {
37170         LDKPeerManager this_arg_conv;
37171         this_arg_conv.inner = untag_ptr(this_arg);
37172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37174         this_arg_conv.is_owned = false;
37175         LDKPublicKey their_node_id_ref;
37176         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
37177         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
37178         void* descriptor_ptr = untag_ptr(descriptor);
37179         CHECK_ACCESS(descriptor_ptr);
37180         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37181         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37182                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37183                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37184         }
37185         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37186         CHECK_ACCESS(remote_network_address_ptr);
37187         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37188         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37189         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37190         return tag_ptr(ret_conv, true);
37191 }
37192
37193 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) {
37194         LDKPeerManager this_arg_conv;
37195         this_arg_conv.inner = untag_ptr(this_arg);
37196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37198         this_arg_conv.is_owned = false;
37199         void* descriptor_ptr = untag_ptr(descriptor);
37200         CHECK_ACCESS(descriptor_ptr);
37201         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37202         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37203                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37204                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37205         }
37206         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37207         CHECK_ACCESS(remote_network_address_ptr);
37208         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37209         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37210         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37211         return tag_ptr(ret_conv, true);
37212 }
37213
37214 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) {
37215         LDKPeerManager this_arg_conv;
37216         this_arg_conv.inner = untag_ptr(this_arg);
37217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37219         this_arg_conv.is_owned = false;
37220         void* descriptor_ptr = untag_ptr(descriptor);
37221         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37222         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37223         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37224         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37225         return tag_ptr(ret_conv, true);
37226 }
37227
37228 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) {
37229         LDKPeerManager this_arg_conv;
37230         this_arg_conv.inner = untag_ptr(this_arg);
37231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37233         this_arg_conv.is_owned = false;
37234         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37235         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37236         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37237         LDKu8slice data_ref;
37238         data_ref.datalen = (*env)->GetArrayLength(env, data);
37239         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
37240         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37241         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37242         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
37243         return tag_ptr(ret_conv, true);
37244 }
37245
37246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
37247         LDKPeerManager this_arg_conv;
37248         this_arg_conv.inner = untag_ptr(this_arg);
37249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37251         this_arg_conv.is_owned = false;
37252         PeerManager_process_events(&this_arg_conv);
37253 }
37254
37255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
37256         LDKPeerManager this_arg_conv;
37257         this_arg_conv.inner = untag_ptr(this_arg);
37258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37260         this_arg_conv.is_owned = false;
37261         void* descriptor_ptr = untag_ptr(descriptor);
37262         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37263         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37264         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37265 }
37266
37267 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, jboolean no_connection_possible) {
37268         LDKPeerManager this_arg_conv;
37269         this_arg_conv.inner = untag_ptr(this_arg);
37270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37272         this_arg_conv.is_owned = false;
37273         LDKPublicKey node_id_ref;
37274         CHECK((*env)->GetArrayLength(env, node_id) == 33);
37275         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
37276         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
37277 }
37278
37279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
37280         LDKPeerManager this_arg_conv;
37281         this_arg_conv.inner = untag_ptr(this_arg);
37282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37284         this_arg_conv.is_owned = false;
37285         PeerManager_disconnect_all_peers(&this_arg_conv);
37286 }
37287
37288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
37289         LDKPeerManager this_arg_conv;
37290         this_arg_conv.inner = untag_ptr(this_arg);
37291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37293         this_arg_conv.is_owned = false;
37294         PeerManager_timer_tick_occurred(&this_arg_conv);
37295 }
37296
37297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37298         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37299         return ret_conv;
37300 }
37301
37302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37303         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37304         return ret_conv;
37305 }
37306
37307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
37308         unsigned char commitment_seed_arr[32];
37309         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
37310         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
37311         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
37312         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37313         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
37314         return ret_arr;
37315 }
37316
37317 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) {
37318         LDKCVec_u8Z to_holder_script_ref;
37319         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
37320         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37321         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
37322         LDKCVec_u8Z to_counterparty_script_ref;
37323         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
37324         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37325         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
37326         LDKOutPoint funding_outpoint_conv;
37327         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37328         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37329         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37330         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37331         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);
37332         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37333         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37334         Transaction_free(ret_var);
37335         return ret_arr;
37336 }
37337
37338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37339         LDKCounterpartyCommitmentSecrets this_obj_conv;
37340         this_obj_conv.inner = untag_ptr(this_obj);
37341         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37343         CounterpartyCommitmentSecrets_free(this_obj_conv);
37344 }
37345
37346 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37347         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37348         int64_t ret_ref = 0;
37349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37351         return ret_ref;
37352 }
37353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37354         LDKCounterpartyCommitmentSecrets arg_conv;
37355         arg_conv.inner = untag_ptr(arg);
37356         arg_conv.is_owned = ptr_is_owned(arg);
37357         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37358         arg_conv.is_owned = false;
37359         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37360         return ret_conv;
37361 }
37362
37363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37364         LDKCounterpartyCommitmentSecrets orig_conv;
37365         orig_conv.inner = untag_ptr(orig);
37366         orig_conv.is_owned = ptr_is_owned(orig);
37367         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37368         orig_conv.is_owned = false;
37369         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37370         int64_t ret_ref = 0;
37371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37373         return ret_ref;
37374 }
37375
37376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
37377         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37378         int64_t ret_ref = 0;
37379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37381         return ret_ref;
37382 }
37383
37384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
37385         LDKCounterpartyCommitmentSecrets this_arg_conv;
37386         this_arg_conv.inner = untag_ptr(this_arg);
37387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37389         this_arg_conv.is_owned = false;
37390         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37391         return ret_conv;
37392 }
37393
37394 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) {
37395         LDKCounterpartyCommitmentSecrets this_arg_conv;
37396         this_arg_conv.inner = untag_ptr(this_arg);
37397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37399         this_arg_conv.is_owned = false;
37400         LDKThirtyTwoBytes secret_ref;
37401         CHECK((*env)->GetArrayLength(env, secret) == 32);
37402         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
37403         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37404         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37405         return tag_ptr(ret_conv, true);
37406 }
37407
37408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
37409         LDKCounterpartyCommitmentSecrets this_arg_conv;
37410         this_arg_conv.inner = untag_ptr(this_arg);
37411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37413         this_arg_conv.is_owned = false;
37414         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37415         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
37416         return ret_arr;
37417 }
37418
37419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
37420         LDKCounterpartyCommitmentSecrets obj_conv;
37421         obj_conv.inner = untag_ptr(obj);
37422         obj_conv.is_owned = ptr_is_owned(obj);
37423         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37424         obj_conv.is_owned = false;
37425         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37426         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37427         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37428         CVec_u8Z_free(ret_var);
37429         return ret_arr;
37430 }
37431
37432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37433         LDKu8slice ser_ref;
37434         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37435         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37436         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37437         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37438         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37439         return tag_ptr(ret_conv, true);
37440 }
37441
37442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
37443         LDKPublicKey per_commitment_point_ref;
37444         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37445         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37446         unsigned char base_secret_arr[32];
37447         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
37448         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
37449         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
37450         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
37451         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
37452         return tag_ptr(ret_conv, true);
37453 }
37454
37455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
37456         LDKPublicKey per_commitment_point_ref;
37457         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37458         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37459         LDKPublicKey base_point_ref;
37460         CHECK((*env)->GetArrayLength(env, base_point) == 33);
37461         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
37462         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
37463         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
37464         return tag_ptr(ret_conv, true);
37465 }
37466
37467 JNIEXPORT int64_t 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) {
37468         unsigned char per_commitment_secret_arr[32];
37469         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
37470         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
37471         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37472         unsigned char countersignatory_revocation_base_secret_arr[32];
37473         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
37474         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
37475         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37476         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
37477         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
37478         return tag_ptr(ret_conv, true);
37479 }
37480
37481 JNIEXPORT int64_t 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) {
37482         LDKPublicKey per_commitment_point_ref;
37483         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37484         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37485         LDKPublicKey countersignatory_revocation_base_point_ref;
37486         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
37487         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
37488         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
37489         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
37490         return tag_ptr(ret_conv, true);
37491 }
37492
37493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37494         LDKTxCreationKeys this_obj_conv;
37495         this_obj_conv.inner = untag_ptr(this_obj);
37496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37498         TxCreationKeys_free(this_obj_conv);
37499 }
37500
37501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37502         LDKTxCreationKeys this_ptr_conv;
37503         this_ptr_conv.inner = untag_ptr(this_ptr);
37504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37506         this_ptr_conv.is_owned = false;
37507         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37508         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
37509         return ret_arr;
37510 }
37511
37512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37513         LDKTxCreationKeys this_ptr_conv;
37514         this_ptr_conv.inner = untag_ptr(this_ptr);
37515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37517         this_ptr_conv.is_owned = false;
37518         LDKPublicKey val_ref;
37519         CHECK((*env)->GetArrayLength(env, val) == 33);
37520         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37521         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37522 }
37523
37524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37525         LDKTxCreationKeys this_ptr_conv;
37526         this_ptr_conv.inner = untag_ptr(this_ptr);
37527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37529         this_ptr_conv.is_owned = false;
37530         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37531         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
37532         return ret_arr;
37533 }
37534
37535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37536         LDKTxCreationKeys this_ptr_conv;
37537         this_ptr_conv.inner = untag_ptr(this_ptr);
37538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37540         this_ptr_conv.is_owned = false;
37541         LDKPublicKey val_ref;
37542         CHECK((*env)->GetArrayLength(env, val) == 33);
37543         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37544         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
37545 }
37546
37547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37548         LDKTxCreationKeys this_ptr_conv;
37549         this_ptr_conv.inner = untag_ptr(this_ptr);
37550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37552         this_ptr_conv.is_owned = false;
37553         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37554         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
37555         return ret_arr;
37556 }
37557
37558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37559         LDKTxCreationKeys this_ptr_conv;
37560         this_ptr_conv.inner = untag_ptr(this_ptr);
37561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37563         this_ptr_conv.is_owned = false;
37564         LDKPublicKey val_ref;
37565         CHECK((*env)->GetArrayLength(env, val) == 33);
37566         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37567         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
37568 }
37569
37570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37571         LDKTxCreationKeys this_ptr_conv;
37572         this_ptr_conv.inner = untag_ptr(this_ptr);
37573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37575         this_ptr_conv.is_owned = false;
37576         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37577         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
37578         return ret_arr;
37579 }
37580
37581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37582         LDKTxCreationKeys this_ptr_conv;
37583         this_ptr_conv.inner = untag_ptr(this_ptr);
37584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37586         this_ptr_conv.is_owned = false;
37587         LDKPublicKey val_ref;
37588         CHECK((*env)->GetArrayLength(env, val) == 33);
37589         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37590         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
37591 }
37592
37593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37594         LDKTxCreationKeys this_ptr_conv;
37595         this_ptr_conv.inner = untag_ptr(this_ptr);
37596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37598         this_ptr_conv.is_owned = false;
37599         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37600         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
37601         return ret_arr;
37602 }
37603
37604 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) {
37605         LDKTxCreationKeys this_ptr_conv;
37606         this_ptr_conv.inner = untag_ptr(this_ptr);
37607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37609         this_ptr_conv.is_owned = false;
37610         LDKPublicKey val_ref;
37611         CHECK((*env)->GetArrayLength(env, val) == 33);
37612         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37613         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
37614 }
37615
37616 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) {
37617         LDKPublicKey per_commitment_point_arg_ref;
37618         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
37619         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
37620         LDKPublicKey revocation_key_arg_ref;
37621         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
37622         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
37623         LDKPublicKey broadcaster_htlc_key_arg_ref;
37624         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
37625         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
37626         LDKPublicKey countersignatory_htlc_key_arg_ref;
37627         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
37628         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
37629         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
37630         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
37631         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
37632         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);
37633         int64_t ret_ref = 0;
37634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37636         return ret_ref;
37637 }
37638
37639 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
37640         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
37641         int64_t ret_ref = 0;
37642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37644         return ret_ref;
37645 }
37646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37647         LDKTxCreationKeys arg_conv;
37648         arg_conv.inner = untag_ptr(arg);
37649         arg_conv.is_owned = ptr_is_owned(arg);
37650         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37651         arg_conv.is_owned = false;
37652         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
37653         return ret_conv;
37654 }
37655
37656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37657         LDKTxCreationKeys orig_conv;
37658         orig_conv.inner = untag_ptr(orig);
37659         orig_conv.is_owned = ptr_is_owned(orig);
37660         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37661         orig_conv.is_owned = false;
37662         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
37663         int64_t ret_ref = 0;
37664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37666         return ret_ref;
37667 }
37668
37669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37670         LDKTxCreationKeys obj_conv;
37671         obj_conv.inner = untag_ptr(obj);
37672         obj_conv.is_owned = ptr_is_owned(obj);
37673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37674         obj_conv.is_owned = false;
37675         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
37676         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37677         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37678         CVec_u8Z_free(ret_var);
37679         return ret_arr;
37680 }
37681
37682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37683         LDKu8slice ser_ref;
37684         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37685         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37686         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37687         *ret_conv = TxCreationKeys_read(ser_ref);
37688         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37689         return tag_ptr(ret_conv, true);
37690 }
37691
37692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37693         LDKChannelPublicKeys this_obj_conv;
37694         this_obj_conv.inner = untag_ptr(this_obj);
37695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37697         ChannelPublicKeys_free(this_obj_conv);
37698 }
37699
37700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37701         LDKChannelPublicKeys this_ptr_conv;
37702         this_ptr_conv.inner = untag_ptr(this_ptr);
37703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37705         this_ptr_conv.is_owned = false;
37706         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37707         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
37708         return ret_arr;
37709 }
37710
37711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37712         LDKChannelPublicKeys this_ptr_conv;
37713         this_ptr_conv.inner = untag_ptr(this_ptr);
37714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37716         this_ptr_conv.is_owned = false;
37717         LDKPublicKey val_ref;
37718         CHECK((*env)->GetArrayLength(env, val) == 33);
37719         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37720         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
37721 }
37722
37723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37724         LDKChannelPublicKeys this_ptr_conv;
37725         this_ptr_conv.inner = untag_ptr(this_ptr);
37726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37728         this_ptr_conv.is_owned = false;
37729         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37730         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
37731         return ret_arr;
37732 }
37733
37734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37735         LDKChannelPublicKeys this_ptr_conv;
37736         this_ptr_conv.inner = untag_ptr(this_ptr);
37737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37739         this_ptr_conv.is_owned = false;
37740         LDKPublicKey val_ref;
37741         CHECK((*env)->GetArrayLength(env, val) == 33);
37742         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37743         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
37744 }
37745
37746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37747         LDKChannelPublicKeys this_ptr_conv;
37748         this_ptr_conv.inner = untag_ptr(this_ptr);
37749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37751         this_ptr_conv.is_owned = false;
37752         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37753         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
37754         return ret_arr;
37755 }
37756
37757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37758         LDKChannelPublicKeys this_ptr_conv;
37759         this_ptr_conv.inner = untag_ptr(this_ptr);
37760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37762         this_ptr_conv.is_owned = false;
37763         LDKPublicKey val_ref;
37764         CHECK((*env)->GetArrayLength(env, val) == 33);
37765         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37766         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
37767 }
37768
37769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37770         LDKChannelPublicKeys this_ptr_conv;
37771         this_ptr_conv.inner = untag_ptr(this_ptr);
37772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37774         this_ptr_conv.is_owned = false;
37775         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37776         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
37777         return ret_arr;
37778 }
37779
37780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37781         LDKChannelPublicKeys this_ptr_conv;
37782         this_ptr_conv.inner = untag_ptr(this_ptr);
37783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37785         this_ptr_conv.is_owned = false;
37786         LDKPublicKey val_ref;
37787         CHECK((*env)->GetArrayLength(env, val) == 33);
37788         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37789         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37790 }
37791
37792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37793         LDKChannelPublicKeys this_ptr_conv;
37794         this_ptr_conv.inner = untag_ptr(this_ptr);
37795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37797         this_ptr_conv.is_owned = false;
37798         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37799         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
37800         return ret_arr;
37801 }
37802
37803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37804         LDKChannelPublicKeys this_ptr_conv;
37805         this_ptr_conv.inner = untag_ptr(this_ptr);
37806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37808         this_ptr_conv.is_owned = false;
37809         LDKPublicKey val_ref;
37810         CHECK((*env)->GetArrayLength(env, val) == 33);
37811         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37812         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
37813 }
37814
37815 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) {
37816         LDKPublicKey funding_pubkey_arg_ref;
37817         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
37818         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
37819         LDKPublicKey revocation_basepoint_arg_ref;
37820         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
37821         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
37822         LDKPublicKey payment_point_arg_ref;
37823         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
37824         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
37825         LDKPublicKey delayed_payment_basepoint_arg_ref;
37826         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
37827         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
37828         LDKPublicKey htlc_basepoint_arg_ref;
37829         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
37830         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
37831         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);
37832         int64_t ret_ref = 0;
37833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37835         return ret_ref;
37836 }
37837
37838 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
37839         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
37840         int64_t ret_ref = 0;
37841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37843         return ret_ref;
37844 }
37845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37846         LDKChannelPublicKeys arg_conv;
37847         arg_conv.inner = untag_ptr(arg);
37848         arg_conv.is_owned = ptr_is_owned(arg);
37849         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37850         arg_conv.is_owned = false;
37851         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
37852         return ret_conv;
37853 }
37854
37855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37856         LDKChannelPublicKeys orig_conv;
37857         orig_conv.inner = untag_ptr(orig);
37858         orig_conv.is_owned = ptr_is_owned(orig);
37859         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37860         orig_conv.is_owned = false;
37861         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
37862         int64_t ret_ref = 0;
37863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37865         return ret_ref;
37866 }
37867
37868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37869         LDKChannelPublicKeys obj_conv;
37870         obj_conv.inner = untag_ptr(obj);
37871         obj_conv.is_owned = ptr_is_owned(obj);
37872         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37873         obj_conv.is_owned = false;
37874         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
37875         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37876         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37877         CVec_u8Z_free(ret_var);
37878         return ret_arr;
37879 }
37880
37881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37882         LDKu8slice ser_ref;
37883         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37884         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37885         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37886         *ret_conv = ChannelPublicKeys_read(ser_ref);
37887         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37888         return tag_ptr(ret_conv, true);
37889 }
37890
37891 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) {
37892         LDKPublicKey per_commitment_point_ref;
37893         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37894         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37895         LDKPublicKey broadcaster_delayed_payment_base_ref;
37896         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
37897         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
37898         LDKPublicKey broadcaster_htlc_base_ref;
37899         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
37900         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
37901         LDKPublicKey countersignatory_revocation_base_ref;
37902         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
37903         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
37904         LDKPublicKey countersignatory_htlc_base_ref;
37905         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
37906         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
37907         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37908         *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
37909         return tag_ptr(ret_conv, true);
37910 }
37911
37912 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) {
37913         LDKPublicKey per_commitment_point_ref;
37914         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37915         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37916         LDKChannelPublicKeys broadcaster_keys_conv;
37917         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
37918         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
37919         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37920         broadcaster_keys_conv.is_owned = false;
37921         LDKChannelPublicKeys countersignatory_keys_conv;
37922         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
37923         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
37924         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37925         countersignatory_keys_conv.is_owned = false;
37926         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37927         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
37928         return tag_ptr(ret_conv, true);
37929 }
37930
37931 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) {
37932         LDKPublicKey revocation_key_ref;
37933         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
37934         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
37935         LDKPublicKey broadcaster_delayed_payment_key_ref;
37936         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
37937         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
37938         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
37939         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37940         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37941         CVec_u8Z_free(ret_var);
37942         return ret_arr;
37943 }
37944
37945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37946         LDKHTLCOutputInCommitment this_obj_conv;
37947         this_obj_conv.inner = untag_ptr(this_obj);
37948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37950         HTLCOutputInCommitment_free(this_obj_conv);
37951 }
37952
37953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
37954         LDKHTLCOutputInCommitment this_ptr_conv;
37955         this_ptr_conv.inner = untag_ptr(this_ptr);
37956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37958         this_ptr_conv.is_owned = false;
37959         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
37960         return ret_conv;
37961 }
37962
37963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37964         LDKHTLCOutputInCommitment this_ptr_conv;
37965         this_ptr_conv.inner = untag_ptr(this_ptr);
37966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37968         this_ptr_conv.is_owned = false;
37969         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
37970 }
37971
37972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37973         LDKHTLCOutputInCommitment this_ptr_conv;
37974         this_ptr_conv.inner = untag_ptr(this_ptr);
37975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37977         this_ptr_conv.is_owned = false;
37978         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
37979         return ret_conv;
37980 }
37981
37982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37983         LDKHTLCOutputInCommitment this_ptr_conv;
37984         this_ptr_conv.inner = untag_ptr(this_ptr);
37985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37987         this_ptr_conv.is_owned = false;
37988         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
37989 }
37990
37991 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
37992         LDKHTLCOutputInCommitment this_ptr_conv;
37993         this_ptr_conv.inner = untag_ptr(this_ptr);
37994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37996         this_ptr_conv.is_owned = false;
37997         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
37998         return ret_conv;
37999 }
38000
38001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38002         LDKHTLCOutputInCommitment this_ptr_conv;
38003         this_ptr_conv.inner = untag_ptr(this_ptr);
38004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38006         this_ptr_conv.is_owned = false;
38007         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38008 }
38009
38010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
38011         LDKHTLCOutputInCommitment this_ptr_conv;
38012         this_ptr_conv.inner = untag_ptr(this_ptr);
38013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38015         this_ptr_conv.is_owned = false;
38016         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38017         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
38018         return ret_arr;
38019 }
38020
38021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38022         LDKHTLCOutputInCommitment this_ptr_conv;
38023         this_ptr_conv.inner = untag_ptr(this_ptr);
38024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38026         this_ptr_conv.is_owned = false;
38027         LDKThirtyTwoBytes val_ref;
38028         CHECK((*env)->GetArrayLength(env, val) == 32);
38029         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38030         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38031 }
38032
38033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
38034         LDKHTLCOutputInCommitment this_ptr_conv;
38035         this_ptr_conv.inner = untag_ptr(this_ptr);
38036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38038         this_ptr_conv.is_owned = false;
38039         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38040         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38041         int64_t ret_ref = tag_ptr(ret_copy, true);
38042         return ret_ref;
38043 }
38044
38045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38046         LDKHTLCOutputInCommitment this_ptr_conv;
38047         this_ptr_conv.inner = untag_ptr(this_ptr);
38048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38050         this_ptr_conv.is_owned = false;
38051         void* val_ptr = untag_ptr(val);
38052         CHECK_ACCESS(val_ptr);
38053         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38054         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38055         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38056 }
38057
38058 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) {
38059         LDKThirtyTwoBytes payment_hash_arg_ref;
38060         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
38061         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
38062         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
38063         CHECK_ACCESS(transaction_output_index_arg_ptr);
38064         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38065         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
38066         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38067         int64_t ret_ref = 0;
38068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38070         return ret_ref;
38071 }
38072
38073 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38074         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38075         int64_t ret_ref = 0;
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38078         return ret_ref;
38079 }
38080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38081         LDKHTLCOutputInCommitment arg_conv;
38082         arg_conv.inner = untag_ptr(arg);
38083         arg_conv.is_owned = ptr_is_owned(arg);
38084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38085         arg_conv.is_owned = false;
38086         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38087         return ret_conv;
38088 }
38089
38090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38091         LDKHTLCOutputInCommitment orig_conv;
38092         orig_conv.inner = untag_ptr(orig);
38093         orig_conv.is_owned = ptr_is_owned(orig);
38094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38095         orig_conv.is_owned = false;
38096         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38097         int64_t ret_ref = 0;
38098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38100         return ret_ref;
38101 }
38102
38103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
38104         LDKHTLCOutputInCommitment obj_conv;
38105         obj_conv.inner = untag_ptr(obj);
38106         obj_conv.is_owned = ptr_is_owned(obj);
38107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38108         obj_conv.is_owned = false;
38109         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38110         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38111         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38112         CVec_u8Z_free(ret_var);
38113         return ret_arr;
38114 }
38115
38116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38117         LDKu8slice ser_ref;
38118         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38119         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38120         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38121         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38122         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38123         return tag_ptr(ret_conv, true);
38124 }
38125
38126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, jboolean opt_anchors, int64_t keys) {
38127         LDKHTLCOutputInCommitment htlc_conv;
38128         htlc_conv.inner = untag_ptr(htlc);
38129         htlc_conv.is_owned = ptr_is_owned(htlc);
38130         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38131         htlc_conv.is_owned = false;
38132         LDKTxCreationKeys keys_conv;
38133         keys_conv.inner = untag_ptr(keys);
38134         keys_conv.is_owned = ptr_is_owned(keys);
38135         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38136         keys_conv.is_owned = false;
38137         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38138         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38139         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38140         CVec_u8Z_free(ret_var);
38141         return ret_arr;
38142 }
38143
38144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
38145         LDKPublicKey broadcaster_ref;
38146         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
38147         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
38148         LDKPublicKey countersignatory_ref;
38149         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
38150         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
38151         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38152         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38153         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38154         CVec_u8Z_free(ret_var);
38155         return ret_arr;
38156 }
38157
38158 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, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
38159         unsigned char commitment_txid_arr[32];
38160         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
38161         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
38162         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
38163         LDKHTLCOutputInCommitment htlc_conv;
38164         htlc_conv.inner = untag_ptr(htlc);
38165         htlc_conv.is_owned = ptr_is_owned(htlc);
38166         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38167         htlc_conv.is_owned = false;
38168         LDKPublicKey broadcaster_delayed_payment_key_ref;
38169         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
38170         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
38171         LDKPublicKey revocation_key_ref;
38172         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
38173         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
38174         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
38175         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38176         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38177         Transaction_free(ret_var);
38178         return ret_arr;
38179 }
38180
38181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
38182         LDKPublicKey funding_pubkey_ref;
38183         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
38184         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
38185         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38186         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38187         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38188         CVec_u8Z_free(ret_var);
38189         return ret_arr;
38190 }
38191
38192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38193         LDKChannelTransactionParameters this_obj_conv;
38194         this_obj_conv.inner = untag_ptr(this_obj);
38195         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38197         ChannelTransactionParameters_free(this_obj_conv);
38198 }
38199
38200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
38201         LDKChannelTransactionParameters this_ptr_conv;
38202         this_ptr_conv.inner = untag_ptr(this_ptr);
38203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38205         this_ptr_conv.is_owned = false;
38206         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38207         int64_t ret_ref = 0;
38208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38210         return ret_ref;
38211 }
38212
38213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38214         LDKChannelTransactionParameters this_ptr_conv;
38215         this_ptr_conv.inner = untag_ptr(this_ptr);
38216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38218         this_ptr_conv.is_owned = false;
38219         LDKChannelPublicKeys val_conv;
38220         val_conv.inner = untag_ptr(val);
38221         val_conv.is_owned = ptr_is_owned(val);
38222         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38223         val_conv = ChannelPublicKeys_clone(&val_conv);
38224         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38225 }
38226
38227 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38228         LDKChannelTransactionParameters this_ptr_conv;
38229         this_ptr_conv.inner = untag_ptr(this_ptr);
38230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38232         this_ptr_conv.is_owned = false;
38233         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38234         return ret_conv;
38235 }
38236
38237 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) {
38238         LDKChannelTransactionParameters this_ptr_conv;
38239         this_ptr_conv.inner = untag_ptr(this_ptr);
38240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38242         this_ptr_conv.is_owned = false;
38243         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38244 }
38245
38246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
38247         LDKChannelTransactionParameters this_ptr_conv;
38248         this_ptr_conv.inner = untag_ptr(this_ptr);
38249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38251         this_ptr_conv.is_owned = false;
38252         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38253         return ret_conv;
38254 }
38255
38256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38257         LDKChannelTransactionParameters this_ptr_conv;
38258         this_ptr_conv.inner = untag_ptr(this_ptr);
38259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38261         this_ptr_conv.is_owned = false;
38262         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38263 }
38264
38265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
38266         LDKChannelTransactionParameters this_ptr_conv;
38267         this_ptr_conv.inner = untag_ptr(this_ptr);
38268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38270         this_ptr_conv.is_owned = false;
38271         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38272         int64_t ret_ref = 0;
38273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38275         return ret_ref;
38276 }
38277
38278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38279         LDKChannelTransactionParameters this_ptr_conv;
38280         this_ptr_conv.inner = untag_ptr(this_ptr);
38281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38283         this_ptr_conv.is_owned = false;
38284         LDKCounterpartyChannelTransactionParameters val_conv;
38285         val_conv.inner = untag_ptr(val);
38286         val_conv.is_owned = ptr_is_owned(val);
38287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38288         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38289         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38290 }
38291
38292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38293         LDKChannelTransactionParameters this_ptr_conv;
38294         this_ptr_conv.inner = untag_ptr(this_ptr);
38295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38297         this_ptr_conv.is_owned = false;
38298         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38299         int64_t ret_ref = 0;
38300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38302         return ret_ref;
38303 }
38304
38305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38306         LDKChannelTransactionParameters this_ptr_conv;
38307         this_ptr_conv.inner = untag_ptr(this_ptr);
38308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38310         this_ptr_conv.is_owned = false;
38311         LDKOutPoint val_conv;
38312         val_conv.inner = untag_ptr(val);
38313         val_conv.is_owned = ptr_is_owned(val);
38314         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38315         val_conv = OutPoint_clone(&val_conv);
38316         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38317 }
38318
38319 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
38320         LDKChannelTransactionParameters this_ptr_conv;
38321         this_ptr_conv.inner = untag_ptr(this_ptr);
38322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38324         this_ptr_conv.is_owned = false;
38325         jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38326         return ret_conv;
38327 }
38328
38329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38330         LDKChannelTransactionParameters this_ptr_conv;
38331         this_ptr_conv.inner = untag_ptr(this_ptr);
38332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38334         this_ptr_conv.is_owned = false;
38335         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
38336         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38337 }
38338
38339 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, jclass opt_anchors_arg) {
38340         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38341         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38342         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38343         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38344         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38345         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38346         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38347         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38348         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38349         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38350         LDKOutPoint funding_outpoint_arg_conv;
38351         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38352         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38353         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38354         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38355         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
38356         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, opt_anchors_arg_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 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38364         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38365         int64_t ret_ref = 0;
38366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38368         return ret_ref;
38369 }
38370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38371         LDKChannelTransactionParameters arg_conv;
38372         arg_conv.inner = untag_ptr(arg);
38373         arg_conv.is_owned = ptr_is_owned(arg);
38374         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38375         arg_conv.is_owned = false;
38376         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38377         return ret_conv;
38378 }
38379
38380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38381         LDKChannelTransactionParameters orig_conv;
38382         orig_conv.inner = untag_ptr(orig);
38383         orig_conv.is_owned = ptr_is_owned(orig);
38384         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38385         orig_conv.is_owned = false;
38386         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38387         int64_t ret_ref = 0;
38388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38390         return ret_ref;
38391 }
38392
38393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38394         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38395         this_obj_conv.inner = untag_ptr(this_obj);
38396         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38398         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38399 }
38400
38401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
38402         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38403         this_ptr_conv.inner = untag_ptr(this_ptr);
38404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38406         this_ptr_conv.is_owned = false;
38407         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
38408         int64_t ret_ref = 0;
38409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38411         return ret_ref;
38412 }
38413
38414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38415         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38416         this_ptr_conv.inner = untag_ptr(this_ptr);
38417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38419         this_ptr_conv.is_owned = false;
38420         LDKChannelPublicKeys val_conv;
38421         val_conv.inner = untag_ptr(val);
38422         val_conv.is_owned = ptr_is_owned(val);
38423         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38424         val_conv = ChannelPublicKeys_clone(&val_conv);
38425         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
38426 }
38427
38428 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38429         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38430         this_ptr_conv.inner = untag_ptr(this_ptr);
38431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38433         this_ptr_conv.is_owned = false;
38434         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
38435         return ret_conv;
38436 }
38437
38438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38439         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38440         this_ptr_conv.inner = untag_ptr(this_ptr);
38441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38443         this_ptr_conv.is_owned = false;
38444         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
38445 }
38446
38447 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) {
38448         LDKChannelPublicKeys pubkeys_arg_conv;
38449         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
38450         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
38452         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
38453         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
38454         int64_t ret_ref = 0;
38455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38457         return ret_ref;
38458 }
38459
38460 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
38461         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
38462         int64_t ret_ref = 0;
38463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38465         return ret_ref;
38466 }
38467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38468         LDKCounterpartyChannelTransactionParameters arg_conv;
38469         arg_conv.inner = untag_ptr(arg);
38470         arg_conv.is_owned = ptr_is_owned(arg);
38471         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38472         arg_conv.is_owned = false;
38473         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
38474         return ret_conv;
38475 }
38476
38477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38478         LDKCounterpartyChannelTransactionParameters orig_conv;
38479         orig_conv.inner = untag_ptr(orig);
38480         orig_conv.is_owned = ptr_is_owned(orig);
38481         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38482         orig_conv.is_owned = false;
38483         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
38484         int64_t ret_ref = 0;
38485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38487         return ret_ref;
38488 }
38489
38490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
38491         LDKChannelTransactionParameters this_arg_conv;
38492         this_arg_conv.inner = untag_ptr(this_arg);
38493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38495         this_arg_conv.is_owned = false;
38496         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
38497         return ret_conv;
38498 }
38499
38500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
38501         LDKChannelTransactionParameters 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         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
38507         int64_t ret_ref = 0;
38508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38510         return ret_ref;
38511 }
38512
38513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
38514         LDKChannelTransactionParameters this_arg_conv;
38515         this_arg_conv.inner = untag_ptr(this_arg);
38516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38518         this_arg_conv.is_owned = false;
38519         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
38520         int64_t ret_ref = 0;
38521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38523         return ret_ref;
38524 }
38525
38526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38527         LDKCounterpartyChannelTransactionParameters obj_conv;
38528         obj_conv.inner = untag_ptr(obj);
38529         obj_conv.is_owned = ptr_is_owned(obj);
38530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38531         obj_conv.is_owned = false;
38532         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
38533         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38534         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38535         CVec_u8Z_free(ret_var);
38536         return ret_arr;
38537 }
38538
38539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38540         LDKu8slice ser_ref;
38541         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38542         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38543         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
38544         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
38545         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38546         return tag_ptr(ret_conv, true);
38547 }
38548
38549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38550         LDKChannelTransactionParameters obj_conv;
38551         obj_conv.inner = untag_ptr(obj);
38552         obj_conv.is_owned = ptr_is_owned(obj);
38553         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38554         obj_conv.is_owned = false;
38555         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
38556         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38557         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38558         CVec_u8Z_free(ret_var);
38559         return ret_arr;
38560 }
38561
38562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38563         LDKu8slice ser_ref;
38564         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38565         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38566         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
38567         *ret_conv = ChannelTransactionParameters_read(ser_ref);
38568         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38569         return tag_ptr(ret_conv, true);
38570 }
38571
38572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38573         LDKDirectedChannelTransactionParameters this_obj_conv;
38574         this_obj_conv.inner = untag_ptr(this_obj);
38575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38577         DirectedChannelTransactionParameters_free(this_obj_conv);
38578 }
38579
38580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
38581         LDKDirectedChannelTransactionParameters this_arg_conv;
38582         this_arg_conv.inner = untag_ptr(this_arg);
38583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38585         this_arg_conv.is_owned = false;
38586         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
38587         int64_t ret_ref = 0;
38588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38590         return ret_ref;
38591 }
38592
38593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
38594         LDKDirectedChannelTransactionParameters this_arg_conv;
38595         this_arg_conv.inner = untag_ptr(this_arg);
38596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38598         this_arg_conv.is_owned = false;
38599         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
38600         int64_t ret_ref = 0;
38601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38603         return ret_ref;
38604 }
38605
38606 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
38607         LDKDirectedChannelTransactionParameters this_arg_conv;
38608         this_arg_conv.inner = untag_ptr(this_arg);
38609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38611         this_arg_conv.is_owned = false;
38612         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
38613         return ret_conv;
38614 }
38615
38616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
38617         LDKDirectedChannelTransactionParameters this_arg_conv;
38618         this_arg_conv.inner = untag_ptr(this_arg);
38619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38621         this_arg_conv.is_owned = false;
38622         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
38623         return ret_conv;
38624 }
38625
38626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
38627         LDKDirectedChannelTransactionParameters this_arg_conv;
38628         this_arg_conv.inner = untag_ptr(this_arg);
38629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38631         this_arg_conv.is_owned = false;
38632         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
38633         int64_t ret_ref = 0;
38634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38636         return ret_ref;
38637 }
38638
38639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38640         LDKDirectedChannelTransactionParameters this_arg_conv;
38641         this_arg_conv.inner = untag_ptr(this_arg);
38642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38644         this_arg_conv.is_owned = false;
38645         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
38646         return ret_conv;
38647 }
38648
38649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38650         LDKHolderCommitmentTransaction this_obj_conv;
38651         this_obj_conv.inner = untag_ptr(this_obj);
38652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38654         HolderCommitmentTransaction_free(this_obj_conv);
38655 }
38656
38657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
38658         LDKHolderCommitmentTransaction this_ptr_conv;
38659         this_ptr_conv.inner = untag_ptr(this_ptr);
38660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38662         this_ptr_conv.is_owned = false;
38663         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38664         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
38665         return ret_arr;
38666 }
38667
38668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38669         LDKHolderCommitmentTransaction this_ptr_conv;
38670         this_ptr_conv.inner = untag_ptr(this_ptr);
38671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38673         this_ptr_conv.is_owned = false;
38674         LDKSignature val_ref;
38675         CHECK((*env)->GetArrayLength(env, val) == 64);
38676         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38677         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
38678 }
38679
38680 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
38681         LDKHolderCommitmentTransaction this_ptr_conv;
38682         this_ptr_conv.inner = untag_ptr(this_ptr);
38683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38685         this_ptr_conv.is_owned = false;
38686         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
38687         jobjectArray ret_arr = NULL;
38688         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
38689         ;
38690         for (size_t i = 0; i < ret_var.datalen; i++) {
38691                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
38692                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
38693                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38694         }
38695         
38696         FREE(ret_var.data);
38697         return ret_arr;
38698 }
38699
38700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
38701         LDKHolderCommitmentTransaction this_ptr_conv;
38702         this_ptr_conv.inner = untag_ptr(this_ptr);
38703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38705         this_ptr_conv.is_owned = false;
38706         LDKCVec_SignatureZ val_constr;
38707         val_constr.datalen = (*env)->GetArrayLength(env, val);
38708         if (val_constr.datalen > 0)
38709                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38710         else
38711                 val_constr.data = NULL;
38712         for (size_t i = 0; i < val_constr.datalen; i++) {
38713                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
38714                 LDKSignature val_conv_8_ref;
38715                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
38716                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
38717                 val_constr.data[i] = val_conv_8_ref;
38718         }
38719         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
38720 }
38721
38722 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
38723         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
38724         int64_t ret_ref = 0;
38725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38727         return ret_ref;
38728 }
38729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38730         LDKHolderCommitmentTransaction arg_conv;
38731         arg_conv.inner = untag_ptr(arg);
38732         arg_conv.is_owned = ptr_is_owned(arg);
38733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38734         arg_conv.is_owned = false;
38735         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
38736         return ret_conv;
38737 }
38738
38739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38740         LDKHolderCommitmentTransaction orig_conv;
38741         orig_conv.inner = untag_ptr(orig);
38742         orig_conv.is_owned = ptr_is_owned(orig);
38743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38744         orig_conv.is_owned = false;
38745         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
38746         int64_t ret_ref = 0;
38747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38749         return ret_ref;
38750 }
38751
38752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38753         LDKHolderCommitmentTransaction obj_conv;
38754         obj_conv.inner = untag_ptr(obj);
38755         obj_conv.is_owned = ptr_is_owned(obj);
38756         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38757         obj_conv.is_owned = false;
38758         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
38759         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38760         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38761         CVec_u8Z_free(ret_var);
38762         return ret_arr;
38763 }
38764
38765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38766         LDKu8slice ser_ref;
38767         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38768         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38769         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
38770         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
38771         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38772         return tag_ptr(ret_conv, true);
38773 }
38774
38775 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) {
38776         LDKCommitmentTransaction commitment_tx_conv;
38777         commitment_tx_conv.inner = untag_ptr(commitment_tx);
38778         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
38779         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
38780         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
38781         LDKSignature counterparty_sig_ref;
38782         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
38783         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
38784         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
38785         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
38786         if (counterparty_htlc_sigs_constr.datalen > 0)
38787                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38788         else
38789                 counterparty_htlc_sigs_constr.data = NULL;
38790         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
38791                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
38792                 LDKSignature counterparty_htlc_sigs_conv_8_ref;
38793                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
38794                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
38795                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
38796         }
38797         LDKPublicKey holder_funding_key_ref;
38798         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
38799         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
38800         LDKPublicKey counterparty_funding_key_ref;
38801         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
38802         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
38803         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
38804         int64_t ret_ref = 0;
38805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38807         return ret_ref;
38808 }
38809
38810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38811         LDKBuiltCommitmentTransaction this_obj_conv;
38812         this_obj_conv.inner = untag_ptr(this_obj);
38813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38815         BuiltCommitmentTransaction_free(this_obj_conv);
38816 }
38817
38818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
38819         LDKBuiltCommitmentTransaction this_ptr_conv;
38820         this_ptr_conv.inner = untag_ptr(this_ptr);
38821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38823         this_ptr_conv.is_owned = false;
38824         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
38825         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38826         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38827         Transaction_free(ret_var);
38828         return ret_arr;
38829 }
38830
38831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38832         LDKBuiltCommitmentTransaction this_ptr_conv;
38833         this_ptr_conv.inner = untag_ptr(this_ptr);
38834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38836         this_ptr_conv.is_owned = false;
38837         LDKTransaction val_ref;
38838         val_ref.datalen = (*env)->GetArrayLength(env, val);
38839         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
38840         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
38841         val_ref.data_is_owned = true;
38842         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
38843 }
38844
38845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38846         LDKBuiltCommitmentTransaction this_ptr_conv;
38847         this_ptr_conv.inner = untag_ptr(this_ptr);
38848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38850         this_ptr_conv.is_owned = false;
38851         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38852         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
38853         return ret_arr;
38854 }
38855
38856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38857         LDKBuiltCommitmentTransaction this_ptr_conv;
38858         this_ptr_conv.inner = untag_ptr(this_ptr);
38859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38861         this_ptr_conv.is_owned = false;
38862         LDKThirtyTwoBytes val_ref;
38863         CHECK((*env)->GetArrayLength(env, val) == 32);
38864         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38865         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
38866 }
38867
38868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
38869         LDKTransaction transaction_arg_ref;
38870         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
38871         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
38872         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
38873         transaction_arg_ref.data_is_owned = true;
38874         LDKThirtyTwoBytes txid_arg_ref;
38875         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38876         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38877         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
38878         int64_t ret_ref = 0;
38879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38881         return ret_ref;
38882 }
38883
38884 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
38885         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
38886         int64_t ret_ref = 0;
38887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38889         return ret_ref;
38890 }
38891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38892         LDKBuiltCommitmentTransaction arg_conv;
38893         arg_conv.inner = untag_ptr(arg);
38894         arg_conv.is_owned = ptr_is_owned(arg);
38895         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38896         arg_conv.is_owned = false;
38897         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
38898         return ret_conv;
38899 }
38900
38901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38902         LDKBuiltCommitmentTransaction orig_conv;
38903         orig_conv.inner = untag_ptr(orig);
38904         orig_conv.is_owned = ptr_is_owned(orig);
38905         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38906         orig_conv.is_owned = false;
38907         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
38908         int64_t ret_ref = 0;
38909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38911         return ret_ref;
38912 }
38913
38914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38915         LDKBuiltCommitmentTransaction obj_conv;
38916         obj_conv.inner = untag_ptr(obj);
38917         obj_conv.is_owned = ptr_is_owned(obj);
38918         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38919         obj_conv.is_owned = false;
38920         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
38921         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38922         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38923         CVec_u8Z_free(ret_var);
38924         return ret_arr;
38925 }
38926
38927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38928         LDKu8slice ser_ref;
38929         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38930         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38931         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
38932         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
38933         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38934         return tag_ptr(ret_conv, true);
38935 }
38936
38937 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) {
38938         LDKBuiltCommitmentTransaction this_arg_conv;
38939         this_arg_conv.inner = untag_ptr(this_arg);
38940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38942         this_arg_conv.is_owned = false;
38943         LDKu8slice funding_redeemscript_ref;
38944         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38945         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38946         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38947         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
38948         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38949         return ret_arr;
38950 }
38951
38952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
38953         LDKBuiltCommitmentTransaction this_arg_conv;
38954         this_arg_conv.inner = untag_ptr(this_arg);
38955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38957         this_arg_conv.is_owned = false;
38958         unsigned char funding_key_arr[32];
38959         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
38960         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
38961         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38962         LDKu8slice funding_redeemscript_ref;
38963         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38964         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38965         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38966         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38967         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38968         return ret_arr;
38969 }
38970
38971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38972         LDKClosingTransaction this_obj_conv;
38973         this_obj_conv.inner = untag_ptr(this_obj);
38974         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38976         ClosingTransaction_free(this_obj_conv);
38977 }
38978
38979 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
38980         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
38981         int64_t ret_ref = 0;
38982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38984         return ret_ref;
38985 }
38986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38987         LDKClosingTransaction arg_conv;
38988         arg_conv.inner = untag_ptr(arg);
38989         arg_conv.is_owned = ptr_is_owned(arg);
38990         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38991         arg_conv.is_owned = false;
38992         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
38993         return ret_conv;
38994 }
38995
38996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38997         LDKClosingTransaction orig_conv;
38998         orig_conv.inner = untag_ptr(orig);
38999         orig_conv.is_owned = ptr_is_owned(orig);
39000         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39001         orig_conv.is_owned = false;
39002         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
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
39009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
39010         LDKClosingTransaction o_conv;
39011         o_conv.inner = untag_ptr(o);
39012         o_conv.is_owned = ptr_is_owned(o);
39013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39014         o_conv.is_owned = false;
39015         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39016         return ret_conv;
39017 }
39018
39019 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) {
39020         LDKCVec_u8Z to_holder_script_ref;
39021         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
39022         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39023         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
39024         LDKCVec_u8Z to_counterparty_script_ref;
39025         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
39026         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39027         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
39028         LDKOutPoint funding_outpoint_conv;
39029         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39030         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39031         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39032         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39033         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39034         int64_t ret_ref = 0;
39035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39037         return ret_ref;
39038 }
39039
39040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39041         LDKClosingTransaction this_arg_conv;
39042         this_arg_conv.inner = untag_ptr(this_arg);
39043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39045         this_arg_conv.is_owned = false;
39046         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39047         int64_t ret_ref = 0;
39048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39050         return ret_ref;
39051 }
39052
39053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
39054         LDKClosingTransaction this_arg_conv;
39055         this_arg_conv.inner = untag_ptr(this_arg);
39056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39058         this_arg_conv.is_owned = false;
39059         LDKOutPoint funding_outpoint_conv;
39060         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39061         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39062         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39063         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39064         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39065         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39066         return tag_ptr(ret_conv, true);
39067 }
39068
39069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39070         LDKClosingTransaction this_arg_conv;
39071         this_arg_conv.inner = untag_ptr(this_arg);
39072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39074         this_arg_conv.is_owned = false;
39075         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39076         return ret_conv;
39077 }
39078
39079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39080         LDKClosingTransaction this_arg_conv;
39081         this_arg_conv.inner = untag_ptr(this_arg);
39082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39084         this_arg_conv.is_owned = false;
39085         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39086         return ret_conv;
39087 }
39088
39089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39090         LDKClosingTransaction this_arg_conv;
39091         this_arg_conv.inner = untag_ptr(this_arg);
39092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39094         this_arg_conv.is_owned = false;
39095         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39096         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39097         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39098         return ret_arr;
39099 }
39100
39101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39102         LDKClosingTransaction this_arg_conv;
39103         this_arg_conv.inner = untag_ptr(this_arg);
39104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39106         this_arg_conv.is_owned = false;
39107         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39108         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39109         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39110         return ret_arr;
39111 }
39112
39113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39114         LDKTrustedClosingTransaction this_obj_conv;
39115         this_obj_conv.inner = untag_ptr(this_obj);
39116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39118         TrustedClosingTransaction_free(this_obj_conv);
39119 }
39120
39121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39122         LDKTrustedClosingTransaction this_arg_conv;
39123         this_arg_conv.inner = untag_ptr(this_arg);
39124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39126         this_arg_conv.is_owned = false;
39127         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39128         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39129         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39130         Transaction_free(ret_var);
39131         return ret_arr;
39132 }
39133
39134 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) {
39135         LDKTrustedClosingTransaction this_arg_conv;
39136         this_arg_conv.inner = untag_ptr(this_arg);
39137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39139         this_arg_conv.is_owned = false;
39140         LDKu8slice funding_redeemscript_ref;
39141         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39142         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39143         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39144         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
39145         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39146         return ret_arr;
39147 }
39148
39149 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) {
39150         LDKTrustedClosingTransaction this_arg_conv;
39151         this_arg_conv.inner = untag_ptr(this_arg);
39152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39154         this_arg_conv.is_owned = false;
39155         unsigned char funding_key_arr[32];
39156         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
39157         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
39158         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
39159         LDKu8slice funding_redeemscript_ref;
39160         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39161         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39162         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
39163         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
39164         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39165         return ret_arr;
39166 }
39167
39168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39169         LDKCommitmentTransaction this_obj_conv;
39170         this_obj_conv.inner = untag_ptr(this_obj);
39171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39173         CommitmentTransaction_free(this_obj_conv);
39174 }
39175
39176 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39177         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39178         int64_t ret_ref = 0;
39179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39181         return ret_ref;
39182 }
39183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39184         LDKCommitmentTransaction arg_conv;
39185         arg_conv.inner = untag_ptr(arg);
39186         arg_conv.is_owned = ptr_is_owned(arg);
39187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39188         arg_conv.is_owned = false;
39189         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39190         return ret_conv;
39191 }
39192
39193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39194         LDKCommitmentTransaction orig_conv;
39195         orig_conv.inner = untag_ptr(orig);
39196         orig_conv.is_owned = ptr_is_owned(orig);
39197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39198         orig_conv.is_owned = false;
39199         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39200         int64_t ret_ref = 0;
39201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39203         return ret_ref;
39204 }
39205
39206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39207         LDKCommitmentTransaction obj_conv;
39208         obj_conv.inner = untag_ptr(obj);
39209         obj_conv.is_owned = ptr_is_owned(obj);
39210         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39211         obj_conv.is_owned = false;
39212         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39213         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39214         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39215         CVec_u8Z_free(ret_var);
39216         return ret_arr;
39217 }
39218
39219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39220         LDKu8slice ser_ref;
39221         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39222         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39223         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39224         *ret_conv = CommitmentTransaction_read(ser_ref);
39225         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39226         return tag_ptr(ret_conv, true);
39227 }
39228
39229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
39230         LDKCommitmentTransaction this_arg_conv;
39231         this_arg_conv.inner = untag_ptr(this_arg);
39232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39234         this_arg_conv.is_owned = false;
39235         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39236         return ret_conv;
39237 }
39238
39239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39240         LDKCommitmentTransaction this_arg_conv;
39241         this_arg_conv.inner = untag_ptr(this_arg);
39242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39244         this_arg_conv.is_owned = false;
39245         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39246         return ret_conv;
39247 }
39248
39249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39250         LDKCommitmentTransaction this_arg_conv;
39251         this_arg_conv.inner = untag_ptr(this_arg);
39252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39254         this_arg_conv.is_owned = false;
39255         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39256         return ret_conv;
39257 }
39258
39259 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
39260         LDKCommitmentTransaction this_arg_conv;
39261         this_arg_conv.inner = untag_ptr(this_arg);
39262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39264         this_arg_conv.is_owned = false;
39265         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39266         return ret_conv;
39267 }
39268
39269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39270         LDKCommitmentTransaction this_arg_conv;
39271         this_arg_conv.inner = untag_ptr(this_arg);
39272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39274         this_arg_conv.is_owned = false;
39275         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39276         int64_t ret_ref = 0;
39277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39279         return ret_ref;
39280 }
39281
39282 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) {
39283         LDKCommitmentTransaction this_arg_conv;
39284         this_arg_conv.inner = untag_ptr(this_arg);
39285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39287         this_arg_conv.is_owned = false;
39288         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39289         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39290         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39291         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39292         channel_parameters_conv.is_owned = false;
39293         LDKChannelPublicKeys broadcaster_keys_conv;
39294         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39295         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39296         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39297         broadcaster_keys_conv.is_owned = false;
39298         LDKChannelPublicKeys countersignatory_keys_conv;
39299         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39300         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39301         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39302         countersignatory_keys_conv.is_owned = false;
39303         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39304         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39305         return tag_ptr(ret_conv, true);
39306 }
39307
39308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39309         LDKTrustedCommitmentTransaction this_obj_conv;
39310         this_obj_conv.inner = untag_ptr(this_obj);
39311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39313         TrustedCommitmentTransaction_free(this_obj_conv);
39314 }
39315
39316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
39317         LDKTrustedCommitmentTransaction this_arg_conv;
39318         this_arg_conv.inner = untag_ptr(this_arg);
39319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39321         this_arg_conv.is_owned = false;
39322         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39323         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
39324         return ret_arr;
39325 }
39326
39327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39328         LDKTrustedCommitmentTransaction this_arg_conv;
39329         this_arg_conv.inner = untag_ptr(this_arg);
39330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39332         this_arg_conv.is_owned = false;
39333         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39334         int64_t ret_ref = 0;
39335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39337         return ret_ref;
39338 }
39339
39340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
39341         LDKTrustedCommitmentTransaction this_arg_conv;
39342         this_arg_conv.inner = untag_ptr(this_arg);
39343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39345         this_arg_conv.is_owned = false;
39346         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39347         int64_t ret_ref = 0;
39348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39350         return ret_ref;
39351 }
39352
39353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
39354         LDKTrustedCommitmentTransaction this_arg_conv;
39355         this_arg_conv.inner = untag_ptr(this_arg);
39356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39358         this_arg_conv.is_owned = false;
39359         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
39360         return ret_conv;
39361 }
39362
39363 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) {
39364         LDKTrustedCommitmentTransaction this_arg_conv;
39365         this_arg_conv.inner = untag_ptr(this_arg);
39366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39368         this_arg_conv.is_owned = false;
39369         unsigned char htlc_base_key_arr[32];
39370         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
39371         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
39372         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
39373         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39374         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39375         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39376         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39377         channel_parameters_conv.is_owned = false;
39378         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
39379         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
39380         return tag_ptr(ret_conv, true);
39381 }
39382
39383 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) {
39384         LDKPublicKey broadcaster_payment_basepoint_ref;
39385         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
39386         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
39387         LDKPublicKey countersignatory_payment_basepoint_ref;
39388         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
39389         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
39390         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
39391         return ret_conv;
39392 }
39393
39394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39395         LDKInitFeatures a_conv;
39396         a_conv.inner = untag_ptr(a);
39397         a_conv.is_owned = ptr_is_owned(a);
39398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39399         a_conv.is_owned = false;
39400         LDKInitFeatures b_conv;
39401         b_conv.inner = untag_ptr(b);
39402         b_conv.is_owned = ptr_is_owned(b);
39403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39404         b_conv.is_owned = false;
39405         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
39406         return ret_conv;
39407 }
39408
39409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39410         LDKNodeFeatures a_conv;
39411         a_conv.inner = untag_ptr(a);
39412         a_conv.is_owned = ptr_is_owned(a);
39413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39414         a_conv.is_owned = false;
39415         LDKNodeFeatures b_conv;
39416         b_conv.inner = untag_ptr(b);
39417         b_conv.is_owned = ptr_is_owned(b);
39418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39419         b_conv.is_owned = false;
39420         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
39421         return ret_conv;
39422 }
39423
39424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39425         LDKChannelFeatures a_conv;
39426         a_conv.inner = untag_ptr(a);
39427         a_conv.is_owned = ptr_is_owned(a);
39428         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39429         a_conv.is_owned = false;
39430         LDKChannelFeatures b_conv;
39431         b_conv.inner = untag_ptr(b);
39432         b_conv.is_owned = ptr_is_owned(b);
39433         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39434         b_conv.is_owned = false;
39435         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
39436         return ret_conv;
39437 }
39438
39439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39440         LDKInvoiceFeatures a_conv;
39441         a_conv.inner = untag_ptr(a);
39442         a_conv.is_owned = ptr_is_owned(a);
39443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39444         a_conv.is_owned = false;
39445         LDKInvoiceFeatures b_conv;
39446         b_conv.inner = untag_ptr(b);
39447         b_conv.is_owned = ptr_is_owned(b);
39448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39449         b_conv.is_owned = false;
39450         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
39451         return ret_conv;
39452 }
39453
39454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39455         LDKChannelTypeFeatures a_conv;
39456         a_conv.inner = untag_ptr(a);
39457         a_conv.is_owned = ptr_is_owned(a);
39458         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39459         a_conv.is_owned = false;
39460         LDKChannelTypeFeatures b_conv;
39461         b_conv.inner = untag_ptr(b);
39462         b_conv.is_owned = ptr_is_owned(b);
39463         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39464         b_conv.is_owned = false;
39465         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
39466         return ret_conv;
39467 }
39468
39469 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
39470         LDKInitFeatures ret_var = InitFeatures_clone(arg);
39471         int64_t ret_ref = 0;
39472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39474         return ret_ref;
39475 }
39476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39477         LDKInitFeatures arg_conv;
39478         arg_conv.inner = untag_ptr(arg);
39479         arg_conv.is_owned = ptr_is_owned(arg);
39480         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39481         arg_conv.is_owned = false;
39482         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
39483         return ret_conv;
39484 }
39485
39486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39487         LDKInitFeatures orig_conv;
39488         orig_conv.inner = untag_ptr(orig);
39489         orig_conv.is_owned = ptr_is_owned(orig);
39490         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39491         orig_conv.is_owned = false;
39492         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
39493         int64_t ret_ref = 0;
39494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39496         return ret_ref;
39497 }
39498
39499 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
39500         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
39501         int64_t ret_ref = 0;
39502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39504         return ret_ref;
39505 }
39506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39507         LDKNodeFeatures arg_conv;
39508         arg_conv.inner = untag_ptr(arg);
39509         arg_conv.is_owned = ptr_is_owned(arg);
39510         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39511         arg_conv.is_owned = false;
39512         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
39513         return ret_conv;
39514 }
39515
39516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39517         LDKNodeFeatures orig_conv;
39518         orig_conv.inner = untag_ptr(orig);
39519         orig_conv.is_owned = ptr_is_owned(orig);
39520         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39521         orig_conv.is_owned = false;
39522         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
39523         int64_t ret_ref = 0;
39524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39526         return ret_ref;
39527 }
39528
39529 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
39530         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
39531         int64_t ret_ref = 0;
39532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39534         return ret_ref;
39535 }
39536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39537         LDKChannelFeatures arg_conv;
39538         arg_conv.inner = untag_ptr(arg);
39539         arg_conv.is_owned = ptr_is_owned(arg);
39540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39541         arg_conv.is_owned = false;
39542         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
39543         return ret_conv;
39544 }
39545
39546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39547         LDKChannelFeatures orig_conv;
39548         orig_conv.inner = untag_ptr(orig);
39549         orig_conv.is_owned = ptr_is_owned(orig);
39550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39551         orig_conv.is_owned = false;
39552         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
39553         int64_t ret_ref = 0;
39554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39556         return ret_ref;
39557 }
39558
39559 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
39560         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
39561         int64_t ret_ref = 0;
39562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39564         return ret_ref;
39565 }
39566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39567         LDKInvoiceFeatures arg_conv;
39568         arg_conv.inner = untag_ptr(arg);
39569         arg_conv.is_owned = ptr_is_owned(arg);
39570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39571         arg_conv.is_owned = false;
39572         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
39573         return ret_conv;
39574 }
39575
39576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39577         LDKInvoiceFeatures orig_conv;
39578         orig_conv.inner = untag_ptr(orig);
39579         orig_conv.is_owned = ptr_is_owned(orig);
39580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39581         orig_conv.is_owned = false;
39582         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
39583         int64_t ret_ref = 0;
39584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39586         return ret_ref;
39587 }
39588
39589 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
39590         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
39591         int64_t ret_ref = 0;
39592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39594         return ret_ref;
39595 }
39596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39597         LDKChannelTypeFeatures arg_conv;
39598         arg_conv.inner = untag_ptr(arg);
39599         arg_conv.is_owned = ptr_is_owned(arg);
39600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39601         arg_conv.is_owned = false;
39602         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
39603         return ret_conv;
39604 }
39605
39606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39607         LDKChannelTypeFeatures orig_conv;
39608         orig_conv.inner = untag_ptr(orig);
39609         orig_conv.is_owned = ptr_is_owned(orig);
39610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39611         orig_conv.is_owned = false;
39612         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
39613         int64_t ret_ref = 0;
39614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39616         return ret_ref;
39617 }
39618
39619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39620         LDKInitFeatures this_obj_conv;
39621         this_obj_conv.inner = untag_ptr(this_obj);
39622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39624         InitFeatures_free(this_obj_conv);
39625 }
39626
39627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39628         LDKNodeFeatures this_obj_conv;
39629         this_obj_conv.inner = untag_ptr(this_obj);
39630         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39632         NodeFeatures_free(this_obj_conv);
39633 }
39634
39635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39636         LDKChannelFeatures this_obj_conv;
39637         this_obj_conv.inner = untag_ptr(this_obj);
39638         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39640         ChannelFeatures_free(this_obj_conv);
39641 }
39642
39643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39644         LDKInvoiceFeatures this_obj_conv;
39645         this_obj_conv.inner = untag_ptr(this_obj);
39646         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39648         InvoiceFeatures_free(this_obj_conv);
39649 }
39650
39651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39652         LDKChannelTypeFeatures this_obj_conv;
39653         this_obj_conv.inner = untag_ptr(this_obj);
39654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39656         ChannelTypeFeatures_free(this_obj_conv);
39657 }
39658
39659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
39660         LDKInitFeatures ret_var = InitFeatures_empty();
39661         int64_t ret_ref = 0;
39662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39664         return ret_ref;
39665 }
39666
39667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
39668         LDKInitFeatures ret_var = InitFeatures_known();
39669         int64_t ret_ref = 0;
39670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39672         return ret_ref;
39673 }
39674
39675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39676         LDKInitFeatures this_arg_conv;
39677         this_arg_conv.inner = untag_ptr(this_arg);
39678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39680         this_arg_conv.is_owned = false;
39681         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
39682         return ret_conv;
39683 }
39684
39685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
39686         LDKNodeFeatures ret_var = NodeFeatures_empty();
39687         int64_t ret_ref = 0;
39688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39690         return ret_ref;
39691 }
39692
39693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
39694         LDKNodeFeatures ret_var = NodeFeatures_known();
39695         int64_t ret_ref = 0;
39696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39698         return ret_ref;
39699 }
39700
39701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39702         LDKNodeFeatures this_arg_conv;
39703         this_arg_conv.inner = untag_ptr(this_arg);
39704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39706         this_arg_conv.is_owned = false;
39707         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
39708         return ret_conv;
39709 }
39710
39711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
39712         LDKChannelFeatures ret_var = ChannelFeatures_empty();
39713         int64_t ret_ref = 0;
39714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39716         return ret_ref;
39717 }
39718
39719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
39720         LDKChannelFeatures ret_var = ChannelFeatures_known();
39721         int64_t ret_ref = 0;
39722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39724         return ret_ref;
39725 }
39726
39727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39728         LDKChannelFeatures this_arg_conv;
39729         this_arg_conv.inner = untag_ptr(this_arg);
39730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39732         this_arg_conv.is_owned = false;
39733         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
39734         return ret_conv;
39735 }
39736
39737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
39738         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
39739         int64_t ret_ref = 0;
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39742         return ret_ref;
39743 }
39744
39745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
39746         LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
39747         int64_t ret_ref = 0;
39748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39750         return ret_ref;
39751 }
39752
39753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39754         LDKInvoiceFeatures this_arg_conv;
39755         this_arg_conv.inner = untag_ptr(this_arg);
39756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39758         this_arg_conv.is_owned = false;
39759         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
39760         return ret_conv;
39761 }
39762
39763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
39764         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
39765         int64_t ret_ref = 0;
39766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39768         return ret_ref;
39769 }
39770
39771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
39772         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
39773         int64_t ret_ref = 0;
39774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39776         return ret_ref;
39777 }
39778
39779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39780         LDKChannelTypeFeatures this_arg_conv;
39781         this_arg_conv.inner = untag_ptr(this_arg);
39782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39784         this_arg_conv.is_owned = false;
39785         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
39786         return ret_conv;
39787 }
39788
39789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39790         LDKInitFeatures obj_conv;
39791         obj_conv.inner = untag_ptr(obj);
39792         obj_conv.is_owned = ptr_is_owned(obj);
39793         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39794         obj_conv.is_owned = false;
39795         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
39796         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39797         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39798         CVec_u8Z_free(ret_var);
39799         return ret_arr;
39800 }
39801
39802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39803         LDKu8slice ser_ref;
39804         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39805         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39806         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
39807         *ret_conv = InitFeatures_read(ser_ref);
39808         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39809         return tag_ptr(ret_conv, true);
39810 }
39811
39812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39813         LDKChannelFeatures obj_conv;
39814         obj_conv.inner = untag_ptr(obj);
39815         obj_conv.is_owned = ptr_is_owned(obj);
39816         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39817         obj_conv.is_owned = false;
39818         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
39819         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39820         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39821         CVec_u8Z_free(ret_var);
39822         return ret_arr;
39823 }
39824
39825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39826         LDKu8slice ser_ref;
39827         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39828         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39829         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
39830         *ret_conv = ChannelFeatures_read(ser_ref);
39831         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39832         return tag_ptr(ret_conv, true);
39833 }
39834
39835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39836         LDKNodeFeatures obj_conv;
39837         obj_conv.inner = untag_ptr(obj);
39838         obj_conv.is_owned = ptr_is_owned(obj);
39839         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39840         obj_conv.is_owned = false;
39841         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
39842         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39843         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39844         CVec_u8Z_free(ret_var);
39845         return ret_arr;
39846 }
39847
39848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39849         LDKu8slice ser_ref;
39850         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39851         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39852         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
39853         *ret_conv = NodeFeatures_read(ser_ref);
39854         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39855         return tag_ptr(ret_conv, true);
39856 }
39857
39858 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39859         LDKInvoiceFeatures obj_conv;
39860         obj_conv.inner = untag_ptr(obj);
39861         obj_conv.is_owned = ptr_is_owned(obj);
39862         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39863         obj_conv.is_owned = false;
39864         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
39865         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39866         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39867         CVec_u8Z_free(ret_var);
39868         return ret_arr;
39869 }
39870
39871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39872         LDKu8slice ser_ref;
39873         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39874         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39875         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
39876         *ret_conv = InvoiceFeatures_read(ser_ref);
39877         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39878         return tag_ptr(ret_conv, true);
39879 }
39880
39881 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39882         LDKChannelTypeFeatures obj_conv;
39883         obj_conv.inner = untag_ptr(obj);
39884         obj_conv.is_owned = ptr_is_owned(obj);
39885         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39886         obj_conv.is_owned = false;
39887         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
39888         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39889         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39890         CVec_u8Z_free(ret_var);
39891         return ret_arr;
39892 }
39893
39894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39895         LDKu8slice ser_ref;
39896         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39897         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39898         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
39899         *ret_conv = ChannelTypeFeatures_read(ser_ref);
39900         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39901         return tag_ptr(ret_conv, true);
39902 }
39903
39904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39905         LDKInitFeatures this_arg_conv;
39906         this_arg_conv.inner = untag_ptr(this_arg);
39907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39909         this_arg_conv.is_owned = false;
39910         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
39911 }
39912
39913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39914         LDKInitFeatures this_arg_conv;
39915         this_arg_conv.inner = untag_ptr(this_arg);
39916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39918         this_arg_conv.is_owned = false;
39919         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
39920 }
39921
39922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39923         LDKInitFeatures this_arg_conv;
39924         this_arg_conv.inner = untag_ptr(this_arg);
39925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39927         this_arg_conv.is_owned = false;
39928         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
39929         return ret_conv;
39930 }
39931
39932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39933         LDKNodeFeatures this_arg_conv;
39934         this_arg_conv.inner = untag_ptr(this_arg);
39935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39937         this_arg_conv.is_owned = false;
39938         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
39939 }
39940
39941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39942         LDKNodeFeatures this_arg_conv;
39943         this_arg_conv.inner = untag_ptr(this_arg);
39944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39946         this_arg_conv.is_owned = false;
39947         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
39948 }
39949
39950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39951         LDKNodeFeatures this_arg_conv;
39952         this_arg_conv.inner = untag_ptr(this_arg);
39953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39955         this_arg_conv.is_owned = false;
39956         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
39957         return ret_conv;
39958 }
39959
39960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39961         LDKInitFeatures this_arg_conv;
39962         this_arg_conv.inner = untag_ptr(this_arg);
39963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39965         this_arg_conv.is_owned = false;
39966         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
39967         return ret_conv;
39968 }
39969
39970 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39971         LDKNodeFeatures this_arg_conv;
39972         this_arg_conv.inner = untag_ptr(this_arg);
39973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39975         this_arg_conv.is_owned = false;
39976         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
39977         return ret_conv;
39978 }
39979
39980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39981         LDKInitFeatures this_arg_conv;
39982         this_arg_conv.inner = untag_ptr(this_arg);
39983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39985         this_arg_conv.is_owned = false;
39986         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
39987 }
39988
39989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39990         LDKInitFeatures this_arg_conv;
39991         this_arg_conv.inner = untag_ptr(this_arg);
39992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39994         this_arg_conv.is_owned = false;
39995         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
39996 }
39997
39998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
39999         LDKInitFeatures this_arg_conv;
40000         this_arg_conv.inner = untag_ptr(this_arg);
40001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40003         this_arg_conv.is_owned = false;
40004         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40005         return ret_conv;
40006 }
40007
40008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40009         LDKInitFeatures this_arg_conv;
40010         this_arg_conv.inner = untag_ptr(this_arg);
40011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40013         this_arg_conv.is_owned = false;
40014         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40015 }
40016
40017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40018         LDKInitFeatures this_arg_conv;
40019         this_arg_conv.inner = untag_ptr(this_arg);
40020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40022         this_arg_conv.is_owned = false;
40023         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40024 }
40025
40026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40027         LDKInitFeatures this_arg_conv;
40028         this_arg_conv.inner = untag_ptr(this_arg);
40029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40031         this_arg_conv.is_owned = false;
40032         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40033         return ret_conv;
40034 }
40035
40036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40037         LDKNodeFeatures this_arg_conv;
40038         this_arg_conv.inner = untag_ptr(this_arg);
40039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40041         this_arg_conv.is_owned = false;
40042         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40043 }
40044
40045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40046         LDKNodeFeatures this_arg_conv;
40047         this_arg_conv.inner = untag_ptr(this_arg);
40048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40050         this_arg_conv.is_owned = false;
40051         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40052 }
40053
40054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40055         LDKNodeFeatures this_arg_conv;
40056         this_arg_conv.inner = untag_ptr(this_arg);
40057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40059         this_arg_conv.is_owned = false;
40060         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40061         return ret_conv;
40062 }
40063
40064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40065         LDKInitFeatures this_arg_conv;
40066         this_arg_conv.inner = untag_ptr(this_arg);
40067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40069         this_arg_conv.is_owned = false;
40070         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40071         return ret_conv;
40072 }
40073
40074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40075         LDKNodeFeatures this_arg_conv;
40076         this_arg_conv.inner = untag_ptr(this_arg);
40077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40079         this_arg_conv.is_owned = false;
40080         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40081         return ret_conv;
40082 }
40083
40084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40085         LDKInitFeatures this_arg_conv;
40086         this_arg_conv.inner = untag_ptr(this_arg);
40087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40089         this_arg_conv.is_owned = false;
40090         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
40091 }
40092
40093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40094         LDKInitFeatures this_arg_conv;
40095         this_arg_conv.inner = untag_ptr(this_arg);
40096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40098         this_arg_conv.is_owned = false;
40099         InitFeatures_set_gossip_queries_required(&this_arg_conv);
40100 }
40101
40102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40103         LDKInitFeatures this_arg_conv;
40104         this_arg_conv.inner = untag_ptr(this_arg);
40105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40107         this_arg_conv.is_owned = false;
40108         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
40109         return ret_conv;
40110 }
40111
40112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40113         LDKNodeFeatures this_arg_conv;
40114         this_arg_conv.inner = untag_ptr(this_arg);
40115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40117         this_arg_conv.is_owned = false;
40118         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
40119 }
40120
40121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40122         LDKNodeFeatures this_arg_conv;
40123         this_arg_conv.inner = untag_ptr(this_arg);
40124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40126         this_arg_conv.is_owned = false;
40127         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
40128 }
40129
40130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40131         LDKNodeFeatures this_arg_conv;
40132         this_arg_conv.inner = untag_ptr(this_arg);
40133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40135         this_arg_conv.is_owned = false;
40136         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
40137         return ret_conv;
40138 }
40139
40140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40141         LDKInitFeatures this_arg_conv;
40142         this_arg_conv.inner = untag_ptr(this_arg);
40143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40145         this_arg_conv.is_owned = false;
40146         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
40147         return ret_conv;
40148 }
40149
40150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40151         LDKNodeFeatures this_arg_conv;
40152         this_arg_conv.inner = untag_ptr(this_arg);
40153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40155         this_arg_conv.is_owned = false;
40156         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
40157         return ret_conv;
40158 }
40159
40160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40161         LDKInitFeatures this_arg_conv;
40162         this_arg_conv.inner = untag_ptr(this_arg);
40163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40165         this_arg_conv.is_owned = false;
40166         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
40167 }
40168
40169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40170         LDKInitFeatures this_arg_conv;
40171         this_arg_conv.inner = untag_ptr(this_arg);
40172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40174         this_arg_conv.is_owned = false;
40175         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
40176 }
40177
40178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40179         LDKInitFeatures this_arg_conv;
40180         this_arg_conv.inner = untag_ptr(this_arg);
40181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40183         this_arg_conv.is_owned = false;
40184         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
40185         return ret_conv;
40186 }
40187
40188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40189         LDKNodeFeatures this_arg_conv;
40190         this_arg_conv.inner = untag_ptr(this_arg);
40191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40193         this_arg_conv.is_owned = false;
40194         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
40195 }
40196
40197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40198         LDKNodeFeatures this_arg_conv;
40199         this_arg_conv.inner = untag_ptr(this_arg);
40200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40202         this_arg_conv.is_owned = false;
40203         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
40204 }
40205
40206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40207         LDKNodeFeatures this_arg_conv;
40208         this_arg_conv.inner = untag_ptr(this_arg);
40209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40211         this_arg_conv.is_owned = false;
40212         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
40213         return ret_conv;
40214 }
40215
40216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40217         LDKInvoiceFeatures this_arg_conv;
40218         this_arg_conv.inner = untag_ptr(this_arg);
40219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40221         this_arg_conv.is_owned = false;
40222         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
40223 }
40224
40225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40226         LDKInvoiceFeatures this_arg_conv;
40227         this_arg_conv.inner = untag_ptr(this_arg);
40228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40230         this_arg_conv.is_owned = false;
40231         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
40232 }
40233
40234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40235         LDKInvoiceFeatures this_arg_conv;
40236         this_arg_conv.inner = untag_ptr(this_arg);
40237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40239         this_arg_conv.is_owned = false;
40240         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
40241         return ret_conv;
40242 }
40243
40244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40245         LDKInitFeatures this_arg_conv;
40246         this_arg_conv.inner = untag_ptr(this_arg);
40247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40249         this_arg_conv.is_owned = false;
40250         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
40251         return ret_conv;
40252 }
40253
40254 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40255         LDKNodeFeatures this_arg_conv;
40256         this_arg_conv.inner = untag_ptr(this_arg);
40257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40259         this_arg_conv.is_owned = false;
40260         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
40261         return ret_conv;
40262 }
40263
40264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40265         LDKInvoiceFeatures this_arg_conv;
40266         this_arg_conv.inner = untag_ptr(this_arg);
40267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40269         this_arg_conv.is_owned = false;
40270         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
40271         return ret_conv;
40272 }
40273
40274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40275         LDKInitFeatures this_arg_conv;
40276         this_arg_conv.inner = untag_ptr(this_arg);
40277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40279         this_arg_conv.is_owned = false;
40280         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
40281 }
40282
40283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40284         LDKInitFeatures this_arg_conv;
40285         this_arg_conv.inner = untag_ptr(this_arg);
40286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40288         this_arg_conv.is_owned = false;
40289         InitFeatures_set_static_remote_key_required(&this_arg_conv);
40290 }
40291
40292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40293         LDKInitFeatures this_arg_conv;
40294         this_arg_conv.inner = untag_ptr(this_arg);
40295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40297         this_arg_conv.is_owned = false;
40298         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
40299         return ret_conv;
40300 }
40301
40302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40303         LDKNodeFeatures this_arg_conv;
40304         this_arg_conv.inner = untag_ptr(this_arg);
40305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40307         this_arg_conv.is_owned = false;
40308         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
40309 }
40310
40311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40312         LDKNodeFeatures this_arg_conv;
40313         this_arg_conv.inner = untag_ptr(this_arg);
40314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40316         this_arg_conv.is_owned = false;
40317         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
40318 }
40319
40320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40321         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
40327         return ret_conv;
40328 }
40329
40330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40331         LDKChannelTypeFeatures this_arg_conv;
40332         this_arg_conv.inner = untag_ptr(this_arg);
40333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40335         this_arg_conv.is_owned = false;
40336         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
40337 }
40338
40339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40340         LDKChannelTypeFeatures this_arg_conv;
40341         this_arg_conv.inner = untag_ptr(this_arg);
40342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40344         this_arg_conv.is_owned = false;
40345         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
40346 }
40347
40348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40349         LDKChannelTypeFeatures this_arg_conv;
40350         this_arg_conv.inner = untag_ptr(this_arg);
40351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40353         this_arg_conv.is_owned = false;
40354         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
40355         return ret_conv;
40356 }
40357
40358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40359         LDKInitFeatures this_arg_conv;
40360         this_arg_conv.inner = untag_ptr(this_arg);
40361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40363         this_arg_conv.is_owned = false;
40364         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
40365         return ret_conv;
40366 }
40367
40368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40369         LDKNodeFeatures this_arg_conv;
40370         this_arg_conv.inner = untag_ptr(this_arg);
40371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40373         this_arg_conv.is_owned = false;
40374         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
40375         return ret_conv;
40376 }
40377
40378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40379         LDKChannelTypeFeatures this_arg_conv;
40380         this_arg_conv.inner = untag_ptr(this_arg);
40381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40383         this_arg_conv.is_owned = false;
40384         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
40385         return ret_conv;
40386 }
40387
40388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40389         LDKInitFeatures this_arg_conv;
40390         this_arg_conv.inner = untag_ptr(this_arg);
40391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40393         this_arg_conv.is_owned = false;
40394         InitFeatures_set_payment_secret_optional(&this_arg_conv);
40395 }
40396
40397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40398         LDKInitFeatures this_arg_conv;
40399         this_arg_conv.inner = untag_ptr(this_arg);
40400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40402         this_arg_conv.is_owned = false;
40403         InitFeatures_set_payment_secret_required(&this_arg_conv);
40404 }
40405
40406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40407         LDKInitFeatures this_arg_conv;
40408         this_arg_conv.inner = untag_ptr(this_arg);
40409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40411         this_arg_conv.is_owned = false;
40412         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
40413         return ret_conv;
40414 }
40415
40416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40417         LDKNodeFeatures this_arg_conv;
40418         this_arg_conv.inner = untag_ptr(this_arg);
40419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40421         this_arg_conv.is_owned = false;
40422         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
40423 }
40424
40425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40426         LDKNodeFeatures this_arg_conv;
40427         this_arg_conv.inner = untag_ptr(this_arg);
40428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40430         this_arg_conv.is_owned = false;
40431         NodeFeatures_set_payment_secret_required(&this_arg_conv);
40432 }
40433
40434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40435         LDKNodeFeatures this_arg_conv;
40436         this_arg_conv.inner = untag_ptr(this_arg);
40437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40439         this_arg_conv.is_owned = false;
40440         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
40441         return ret_conv;
40442 }
40443
40444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40445         LDKInvoiceFeatures this_arg_conv;
40446         this_arg_conv.inner = untag_ptr(this_arg);
40447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40449         this_arg_conv.is_owned = false;
40450         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
40451 }
40452
40453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40454         LDKInvoiceFeatures this_arg_conv;
40455         this_arg_conv.inner = untag_ptr(this_arg);
40456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40458         this_arg_conv.is_owned = false;
40459         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
40460 }
40461
40462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40463         LDKInvoiceFeatures this_arg_conv;
40464         this_arg_conv.inner = untag_ptr(this_arg);
40465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40467         this_arg_conv.is_owned = false;
40468         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
40469         return ret_conv;
40470 }
40471
40472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40473         LDKInitFeatures this_arg_conv;
40474         this_arg_conv.inner = untag_ptr(this_arg);
40475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40477         this_arg_conv.is_owned = false;
40478         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
40479         return ret_conv;
40480 }
40481
40482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40483         LDKNodeFeatures this_arg_conv;
40484         this_arg_conv.inner = untag_ptr(this_arg);
40485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40487         this_arg_conv.is_owned = false;
40488         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
40489         return ret_conv;
40490 }
40491
40492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40493         LDKInvoiceFeatures this_arg_conv;
40494         this_arg_conv.inner = untag_ptr(this_arg);
40495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40497         this_arg_conv.is_owned = false;
40498         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
40499         return ret_conv;
40500 }
40501
40502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40503         LDKInitFeatures this_arg_conv;
40504         this_arg_conv.inner = untag_ptr(this_arg);
40505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40507         this_arg_conv.is_owned = false;
40508         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
40509 }
40510
40511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40512         LDKInitFeatures this_arg_conv;
40513         this_arg_conv.inner = untag_ptr(this_arg);
40514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40516         this_arg_conv.is_owned = false;
40517         InitFeatures_set_basic_mpp_required(&this_arg_conv);
40518 }
40519
40520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40521         LDKInitFeatures this_arg_conv;
40522         this_arg_conv.inner = untag_ptr(this_arg);
40523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40525         this_arg_conv.is_owned = false;
40526         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
40527         return ret_conv;
40528 }
40529
40530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40531         LDKNodeFeatures this_arg_conv;
40532         this_arg_conv.inner = untag_ptr(this_arg);
40533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40535         this_arg_conv.is_owned = false;
40536         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
40537 }
40538
40539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40540         LDKNodeFeatures this_arg_conv;
40541         this_arg_conv.inner = untag_ptr(this_arg);
40542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40544         this_arg_conv.is_owned = false;
40545         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
40546 }
40547
40548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40549         LDKNodeFeatures this_arg_conv;
40550         this_arg_conv.inner = untag_ptr(this_arg);
40551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40553         this_arg_conv.is_owned = false;
40554         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
40555         return ret_conv;
40556 }
40557
40558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40559         LDKInvoiceFeatures this_arg_conv;
40560         this_arg_conv.inner = untag_ptr(this_arg);
40561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40563         this_arg_conv.is_owned = false;
40564         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
40565 }
40566
40567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40568         LDKInvoiceFeatures this_arg_conv;
40569         this_arg_conv.inner = untag_ptr(this_arg);
40570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40572         this_arg_conv.is_owned = false;
40573         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
40574 }
40575
40576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40577         LDKInvoiceFeatures this_arg_conv;
40578         this_arg_conv.inner = untag_ptr(this_arg);
40579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40581         this_arg_conv.is_owned = false;
40582         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
40583         return ret_conv;
40584 }
40585
40586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40587         LDKInitFeatures this_arg_conv;
40588         this_arg_conv.inner = untag_ptr(this_arg);
40589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40591         this_arg_conv.is_owned = false;
40592         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
40593         return ret_conv;
40594 }
40595
40596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40597         LDKNodeFeatures this_arg_conv;
40598         this_arg_conv.inner = untag_ptr(this_arg);
40599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40601         this_arg_conv.is_owned = false;
40602         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
40603         return ret_conv;
40604 }
40605
40606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40607         LDKInvoiceFeatures this_arg_conv;
40608         this_arg_conv.inner = untag_ptr(this_arg);
40609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40611         this_arg_conv.is_owned = false;
40612         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
40613         return ret_conv;
40614 }
40615
40616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40617         LDKInitFeatures this_arg_conv;
40618         this_arg_conv.inner = untag_ptr(this_arg);
40619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40621         this_arg_conv.is_owned = false;
40622         InitFeatures_set_wumbo_optional(&this_arg_conv);
40623 }
40624
40625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40626         LDKInitFeatures this_arg_conv;
40627         this_arg_conv.inner = untag_ptr(this_arg);
40628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40630         this_arg_conv.is_owned = false;
40631         InitFeatures_set_wumbo_required(&this_arg_conv);
40632 }
40633
40634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40635         LDKInitFeatures this_arg_conv;
40636         this_arg_conv.inner = untag_ptr(this_arg);
40637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40639         this_arg_conv.is_owned = false;
40640         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
40641         return ret_conv;
40642 }
40643
40644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40645         LDKNodeFeatures this_arg_conv;
40646         this_arg_conv.inner = untag_ptr(this_arg);
40647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40649         this_arg_conv.is_owned = false;
40650         NodeFeatures_set_wumbo_optional(&this_arg_conv);
40651 }
40652
40653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40654         LDKNodeFeatures this_arg_conv;
40655         this_arg_conv.inner = untag_ptr(this_arg);
40656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40658         this_arg_conv.is_owned = false;
40659         NodeFeatures_set_wumbo_required(&this_arg_conv);
40660 }
40661
40662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40663         LDKNodeFeatures this_arg_conv;
40664         this_arg_conv.inner = untag_ptr(this_arg);
40665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40667         this_arg_conv.is_owned = false;
40668         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
40669         return ret_conv;
40670 }
40671
40672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40673         LDKInitFeatures this_arg_conv;
40674         this_arg_conv.inner = untag_ptr(this_arg);
40675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40677         this_arg_conv.is_owned = false;
40678         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
40679         return ret_conv;
40680 }
40681
40682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40683         LDKNodeFeatures this_arg_conv;
40684         this_arg_conv.inner = untag_ptr(this_arg);
40685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40687         this_arg_conv.is_owned = false;
40688         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
40689         return ret_conv;
40690 }
40691
40692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40693         LDKInitFeatures 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         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40699 }
40700
40701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40702         LDKInitFeatures this_arg_conv;
40703         this_arg_conv.inner = untag_ptr(this_arg);
40704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40706         this_arg_conv.is_owned = false;
40707         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40708 }
40709
40710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40711         LDKInitFeatures this_arg_conv;
40712         this_arg_conv.inner = untag_ptr(this_arg);
40713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40715         this_arg_conv.is_owned = false;
40716         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40717         return ret_conv;
40718 }
40719
40720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40721         LDKNodeFeatures this_arg_conv;
40722         this_arg_conv.inner = untag_ptr(this_arg);
40723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40725         this_arg_conv.is_owned = false;
40726         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40727 }
40728
40729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40730         LDKNodeFeatures this_arg_conv;
40731         this_arg_conv.inner = untag_ptr(this_arg);
40732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40734         this_arg_conv.is_owned = false;
40735         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40736 }
40737
40738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40739         LDKNodeFeatures this_arg_conv;
40740         this_arg_conv.inner = untag_ptr(this_arg);
40741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40743         this_arg_conv.is_owned = false;
40744         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40745         return ret_conv;
40746 }
40747
40748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40749         LDKInitFeatures this_arg_conv;
40750         this_arg_conv.inner = untag_ptr(this_arg);
40751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40753         this_arg_conv.is_owned = false;
40754         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40755         return ret_conv;
40756 }
40757
40758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40759         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40765         return ret_conv;
40766 }
40767
40768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40769         LDKInitFeatures this_arg_conv;
40770         this_arg_conv.inner = untag_ptr(this_arg);
40771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40773         this_arg_conv.is_owned = false;
40774         InitFeatures_set_channel_type_optional(&this_arg_conv);
40775 }
40776
40777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40778         LDKInitFeatures this_arg_conv;
40779         this_arg_conv.inner = untag_ptr(this_arg);
40780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40782         this_arg_conv.is_owned = false;
40783         InitFeatures_set_channel_type_required(&this_arg_conv);
40784 }
40785
40786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40787         LDKInitFeatures this_arg_conv;
40788         this_arg_conv.inner = untag_ptr(this_arg);
40789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40791         this_arg_conv.is_owned = false;
40792         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
40793         return ret_conv;
40794 }
40795
40796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40797         LDKNodeFeatures this_arg_conv;
40798         this_arg_conv.inner = untag_ptr(this_arg);
40799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40801         this_arg_conv.is_owned = false;
40802         NodeFeatures_set_channel_type_optional(&this_arg_conv);
40803 }
40804
40805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40806         LDKNodeFeatures this_arg_conv;
40807         this_arg_conv.inner = untag_ptr(this_arg);
40808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40810         this_arg_conv.is_owned = false;
40811         NodeFeatures_set_channel_type_required(&this_arg_conv);
40812 }
40813
40814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40815         LDKNodeFeatures this_arg_conv;
40816         this_arg_conv.inner = untag_ptr(this_arg);
40817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40819         this_arg_conv.is_owned = false;
40820         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
40821         return ret_conv;
40822 }
40823
40824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40825         LDKInitFeatures this_arg_conv;
40826         this_arg_conv.inner = untag_ptr(this_arg);
40827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40829         this_arg_conv.is_owned = false;
40830         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
40831         return ret_conv;
40832 }
40833
40834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40835         LDKNodeFeatures this_arg_conv;
40836         this_arg_conv.inner = untag_ptr(this_arg);
40837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40839         this_arg_conv.is_owned = false;
40840         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
40841         return ret_conv;
40842 }
40843
40844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40845         LDKInitFeatures this_arg_conv;
40846         this_arg_conv.inner = untag_ptr(this_arg);
40847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40849         this_arg_conv.is_owned = false;
40850         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
40851 }
40852
40853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40854         LDKInitFeatures this_arg_conv;
40855         this_arg_conv.inner = untag_ptr(this_arg);
40856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40858         this_arg_conv.is_owned = false;
40859         InitFeatures_set_scid_privacy_required(&this_arg_conv);
40860 }
40861
40862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40863         LDKInitFeatures this_arg_conv;
40864         this_arg_conv.inner = untag_ptr(this_arg);
40865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40867         this_arg_conv.is_owned = false;
40868         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
40869         return ret_conv;
40870 }
40871
40872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40873         LDKNodeFeatures this_arg_conv;
40874         this_arg_conv.inner = untag_ptr(this_arg);
40875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40877         this_arg_conv.is_owned = false;
40878         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
40879 }
40880
40881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40882         LDKNodeFeatures this_arg_conv;
40883         this_arg_conv.inner = untag_ptr(this_arg);
40884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40886         this_arg_conv.is_owned = false;
40887         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
40888 }
40889
40890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40891         LDKNodeFeatures this_arg_conv;
40892         this_arg_conv.inner = untag_ptr(this_arg);
40893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40895         this_arg_conv.is_owned = false;
40896         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
40897         return ret_conv;
40898 }
40899
40900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40901         LDKChannelTypeFeatures this_arg_conv;
40902         this_arg_conv.inner = untag_ptr(this_arg);
40903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40905         this_arg_conv.is_owned = false;
40906         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
40907 }
40908
40909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40910         LDKChannelTypeFeatures this_arg_conv;
40911         this_arg_conv.inner = untag_ptr(this_arg);
40912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40914         this_arg_conv.is_owned = false;
40915         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
40916 }
40917
40918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40919         LDKChannelTypeFeatures this_arg_conv;
40920         this_arg_conv.inner = untag_ptr(this_arg);
40921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40923         this_arg_conv.is_owned = false;
40924         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
40925         return ret_conv;
40926 }
40927
40928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40929         LDKInitFeatures this_arg_conv;
40930         this_arg_conv.inner = untag_ptr(this_arg);
40931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40933         this_arg_conv.is_owned = false;
40934         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
40935         return ret_conv;
40936 }
40937
40938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40939         LDKNodeFeatures this_arg_conv;
40940         this_arg_conv.inner = untag_ptr(this_arg);
40941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40943         this_arg_conv.is_owned = false;
40944         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
40945         return ret_conv;
40946 }
40947
40948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40949         LDKChannelTypeFeatures this_arg_conv;
40950         this_arg_conv.inner = untag_ptr(this_arg);
40951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40953         this_arg_conv.is_owned = false;
40954         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
40955         return ret_conv;
40956 }
40957
40958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40959         LDKInitFeatures this_arg_conv;
40960         this_arg_conv.inner = untag_ptr(this_arg);
40961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40963         this_arg_conv.is_owned = false;
40964         InitFeatures_set_zero_conf_optional(&this_arg_conv);
40965 }
40966
40967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40968         LDKInitFeatures this_arg_conv;
40969         this_arg_conv.inner = untag_ptr(this_arg);
40970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40972         this_arg_conv.is_owned = false;
40973         InitFeatures_set_zero_conf_required(&this_arg_conv);
40974 }
40975
40976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
40977         LDKInitFeatures this_arg_conv;
40978         this_arg_conv.inner = untag_ptr(this_arg);
40979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40981         this_arg_conv.is_owned = false;
40982         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
40983         return ret_conv;
40984 }
40985
40986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40987         LDKNodeFeatures this_arg_conv;
40988         this_arg_conv.inner = untag_ptr(this_arg);
40989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40991         this_arg_conv.is_owned = false;
40992         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
40993 }
40994
40995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40996         LDKNodeFeatures this_arg_conv;
40997         this_arg_conv.inner = untag_ptr(this_arg);
40998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41000         this_arg_conv.is_owned = false;
41001         NodeFeatures_set_zero_conf_required(&this_arg_conv);
41002 }
41003
41004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41005         LDKNodeFeatures this_arg_conv;
41006         this_arg_conv.inner = untag_ptr(this_arg);
41007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41009         this_arg_conv.is_owned = false;
41010         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
41011         return ret_conv;
41012 }
41013
41014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41015         LDKChannelTypeFeatures this_arg_conv;
41016         this_arg_conv.inner = untag_ptr(this_arg);
41017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41019         this_arg_conv.is_owned = false;
41020         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
41021 }
41022
41023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41024         LDKChannelTypeFeatures this_arg_conv;
41025         this_arg_conv.inner = untag_ptr(this_arg);
41026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41028         this_arg_conv.is_owned = false;
41029         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
41030 }
41031
41032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41033         LDKChannelTypeFeatures this_arg_conv;
41034         this_arg_conv.inner = untag_ptr(this_arg);
41035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41037         this_arg_conv.is_owned = false;
41038         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
41039         return ret_conv;
41040 }
41041
41042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41043         LDKInitFeatures this_arg_conv;
41044         this_arg_conv.inner = untag_ptr(this_arg);
41045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41047         this_arg_conv.is_owned = false;
41048         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
41049         return ret_conv;
41050 }
41051
41052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41053         LDKNodeFeatures this_arg_conv;
41054         this_arg_conv.inner = untag_ptr(this_arg);
41055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41057         this_arg_conv.is_owned = false;
41058         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
41059         return ret_conv;
41060 }
41061
41062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41063         LDKChannelTypeFeatures this_arg_conv;
41064         this_arg_conv.inner = untag_ptr(this_arg);
41065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41067         this_arg_conv.is_owned = false;
41068         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
41069         return ret_conv;
41070 }
41071
41072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41073         LDKNodeFeatures this_arg_conv;
41074         this_arg_conv.inner = untag_ptr(this_arg);
41075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41077         this_arg_conv.is_owned = false;
41078         NodeFeatures_set_keysend_optional(&this_arg_conv);
41079 }
41080
41081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41082         LDKNodeFeatures this_arg_conv;
41083         this_arg_conv.inner = untag_ptr(this_arg);
41084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41086         this_arg_conv.is_owned = false;
41087         NodeFeatures_set_keysend_required(&this_arg_conv);
41088 }
41089
41090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
41091         LDKNodeFeatures this_arg_conv;
41092         this_arg_conv.inner = untag_ptr(this_arg);
41093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41095         this_arg_conv.is_owned = false;
41096         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
41097         return ret_conv;
41098 }
41099
41100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
41101         LDKNodeFeatures this_arg_conv;
41102         this_arg_conv.inner = untag_ptr(this_arg);
41103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41105         this_arg_conv.is_owned = false;
41106         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
41107         return ret_conv;
41108 }
41109
41110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41111         LDKShutdownScript this_obj_conv;
41112         this_obj_conv.inner = untag_ptr(this_obj);
41113         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41115         ShutdownScript_free(this_obj_conv);
41116 }
41117
41118 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
41119         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
41120         int64_t ret_ref = 0;
41121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41123         return ret_ref;
41124 }
41125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41126         LDKShutdownScript arg_conv;
41127         arg_conv.inner = untag_ptr(arg);
41128         arg_conv.is_owned = ptr_is_owned(arg);
41129         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41130         arg_conv.is_owned = false;
41131         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
41132         return ret_conv;
41133 }
41134
41135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41136         LDKShutdownScript orig_conv;
41137         orig_conv.inner = untag_ptr(orig);
41138         orig_conv.is_owned = ptr_is_owned(orig);
41139         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41140         orig_conv.is_owned = false;
41141         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
41142         int64_t ret_ref = 0;
41143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41145         return ret_ref;
41146 }
41147
41148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41149         LDKInvalidShutdownScript this_obj_conv;
41150         this_obj_conv.inner = untag_ptr(this_obj);
41151         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41153         InvalidShutdownScript_free(this_obj_conv);
41154 }
41155
41156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
41157         LDKInvalidShutdownScript this_ptr_conv;
41158         this_ptr_conv.inner = untag_ptr(this_ptr);
41159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41161         this_ptr_conv.is_owned = false;
41162         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
41163         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41164         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41165         return ret_arr;
41166 }
41167
41168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41169         LDKInvalidShutdownScript this_ptr_conv;
41170         this_ptr_conv.inner = untag_ptr(this_ptr);
41171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41173         this_ptr_conv.is_owned = false;
41174         LDKCVec_u8Z val_ref;
41175         val_ref.datalen = (*env)->GetArrayLength(env, val);
41176         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41177         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
41178         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
41179 }
41180
41181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
41182         LDKCVec_u8Z script_arg_ref;
41183         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
41184         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41185         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
41186         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
41187         int64_t ret_ref = 0;
41188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41190         return ret_ref;
41191 }
41192
41193 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
41194         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
41195         int64_t ret_ref = 0;
41196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41198         return ret_ref;
41199 }
41200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41201         LDKInvalidShutdownScript arg_conv;
41202         arg_conv.inner = untag_ptr(arg);
41203         arg_conv.is_owned = ptr_is_owned(arg);
41204         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41205         arg_conv.is_owned = false;
41206         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
41207         return ret_conv;
41208 }
41209
41210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41211         LDKInvalidShutdownScript orig_conv;
41212         orig_conv.inner = untag_ptr(orig);
41213         orig_conv.is_owned = ptr_is_owned(orig);
41214         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41215         orig_conv.is_owned = false;
41216         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
41217         int64_t ret_ref = 0;
41218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41220         return ret_ref;
41221 }
41222
41223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
41224         LDKShutdownScript obj_conv;
41225         obj_conv.inner = untag_ptr(obj);
41226         obj_conv.is_owned = ptr_is_owned(obj);
41227         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41228         obj_conv.is_owned = false;
41229         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
41230         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41231         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41232         CVec_u8Z_free(ret_var);
41233         return ret_arr;
41234 }
41235
41236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41237         LDKu8slice ser_ref;
41238         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41239         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41240         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
41241         *ret_conv = ShutdownScript_read(ser_ref);
41242         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41243         return tag_ptr(ret_conv, true);
41244 }
41245
41246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
41247         unsigned char pubkey_hash_arr[20];
41248         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
41249         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
41250         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
41251         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
41252         int64_t ret_ref = 0;
41253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41255         return ret_ref;
41256 }
41257
41258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
41259         unsigned char script_hash_arr[32];
41260         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
41261         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
41262         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
41263         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
41264         int64_t ret_ref = 0;
41265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41267         return ret_ref;
41268 }
41269
41270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
41271         
41272         LDKu8slice program_ref;
41273         program_ref.datalen = (*env)->GetArrayLength(env, program);
41274         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
41275         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
41276         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
41277         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
41278         return tag_ptr(ret_conv, true);
41279 }
41280
41281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
41282         LDKShutdownScript this_arg_conv;
41283         this_arg_conv.inner = untag_ptr(this_arg);
41284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41286         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
41287         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
41288         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41289         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41290         CVec_u8Z_free(ret_var);
41291         return ret_arr;
41292 }
41293
41294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
41295         LDKShutdownScript this_arg_conv;
41296         this_arg_conv.inner = untag_ptr(this_arg);
41297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41299         this_arg_conv.is_owned = false;
41300         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41301         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
41302         return ret_arr;
41303 }
41304
41305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
41306         LDKShutdownScript this_arg_conv;
41307         this_arg_conv.inner = untag_ptr(this_arg);
41308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41310         this_arg_conv.is_owned = false;
41311         LDKInitFeatures features_conv;
41312         features_conv.inner = untag_ptr(features);
41313         features_conv.is_owned = ptr_is_owned(features);
41314         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41315         features_conv.is_owned = false;
41316         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
41317         return ret_conv;
41318 }
41319
41320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41321         if (!ptr_is_owned(this_ptr)) return;
41322         void* this_ptr_ptr = untag_ptr(this_ptr);
41323         CHECK_ACCESS(this_ptr_ptr);
41324         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
41325         FREE(untag_ptr(this_ptr));
41326         CustomMessageReader_free(this_ptr_conv);
41327 }
41328
41329 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
41330         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41331         *ret_ret = Type_clone(arg);
41332         return tag_ptr(ret_ret, true);
41333 }
41334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41335         void* arg_ptr = untag_ptr(arg);
41336         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
41337         LDKType* arg_conv = (LDKType*)arg_ptr;
41338         int64_t ret_conv = Type_clone_ptr(arg_conv);
41339         return ret_conv;
41340 }
41341
41342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41343         void* orig_ptr = untag_ptr(orig);
41344         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
41345         LDKType* orig_conv = (LDKType*)orig_ptr;
41346         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41347         *ret_ret = Type_clone(orig_conv);
41348         return tag_ptr(ret_ret, true);
41349 }
41350
41351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41352         if (!ptr_is_owned(this_ptr)) return;
41353         void* this_ptr_ptr = untag_ptr(this_ptr);
41354         CHECK_ACCESS(this_ptr_ptr);
41355         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
41356         FREE(untag_ptr(this_ptr));
41357         Type_free(this_ptr_conv);
41358 }
41359
41360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41361         LDKNodeId this_obj_conv;
41362         this_obj_conv.inner = untag_ptr(this_obj);
41363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41365         NodeId_free(this_obj_conv);
41366 }
41367
41368 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
41369         LDKNodeId ret_var = NodeId_clone(arg);
41370         int64_t ret_ref = 0;
41371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41373         return ret_ref;
41374 }
41375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41376         LDKNodeId arg_conv;
41377         arg_conv.inner = untag_ptr(arg);
41378         arg_conv.is_owned = ptr_is_owned(arg);
41379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41380         arg_conv.is_owned = false;
41381         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
41382         return ret_conv;
41383 }
41384
41385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41386         LDKNodeId orig_conv;
41387         orig_conv.inner = untag_ptr(orig);
41388         orig_conv.is_owned = ptr_is_owned(orig);
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41390         orig_conv.is_owned = false;
41391         LDKNodeId ret_var = NodeId_clone(&orig_conv);
41392         int64_t ret_ref = 0;
41393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41395         return ret_ref;
41396 }
41397
41398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
41399         LDKPublicKey pubkey_ref;
41400         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
41401         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
41402         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
41403         int64_t ret_ref = 0;
41404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41406         return ret_ref;
41407 }
41408
41409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
41410         LDKNodeId this_arg_conv;
41411         this_arg_conv.inner = untag_ptr(this_arg);
41412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41414         this_arg_conv.is_owned = false;
41415         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
41416         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41417         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41418         return ret_arr;
41419 }
41420
41421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
41422         LDKNodeId o_conv;
41423         o_conv.inner = untag_ptr(o);
41424         o_conv.is_owned = ptr_is_owned(o);
41425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41426         o_conv.is_owned = false;
41427         int64_t ret_conv = NodeId_hash(&o_conv);
41428         return ret_conv;
41429 }
41430
41431 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
41432         LDKNodeId obj_conv;
41433         obj_conv.inner = untag_ptr(obj);
41434         obj_conv.is_owned = ptr_is_owned(obj);
41435         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41436         obj_conv.is_owned = false;
41437         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
41438         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41439         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41440         CVec_u8Z_free(ret_var);
41441         return ret_arr;
41442 }
41443
41444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41445         LDKu8slice ser_ref;
41446         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41447         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41448         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
41449         *ret_conv = NodeId_read(ser_ref);
41450         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41451         return tag_ptr(ret_conv, true);
41452 }
41453
41454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41455         LDKNetworkGraph this_obj_conv;
41456         this_obj_conv.inner = untag_ptr(this_obj);
41457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41459         NetworkGraph_free(this_obj_conv);
41460 }
41461
41462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41463         LDKReadOnlyNetworkGraph this_obj_conv;
41464         this_obj_conv.inner = untag_ptr(this_obj);
41465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41467         ReadOnlyNetworkGraph_free(this_obj_conv);
41468 }
41469
41470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41471         if (!ptr_is_owned(this_ptr)) return;
41472         void* this_ptr_ptr = untag_ptr(this_ptr);
41473         CHECK_ACCESS(this_ptr_ptr);
41474         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
41475         FREE(untag_ptr(this_ptr));
41476         NetworkUpdate_free(this_ptr_conv);
41477 }
41478
41479 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
41480         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41481         *ret_copy = NetworkUpdate_clone(arg);
41482         int64_t ret_ref = tag_ptr(ret_copy, true);
41483         return ret_ref;
41484 }
41485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41486         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
41487         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
41488         return ret_conv;
41489 }
41490
41491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41492         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
41493         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41494         *ret_copy = NetworkUpdate_clone(orig_conv);
41495         int64_t ret_ref = tag_ptr(ret_copy, true);
41496         return ret_ref;
41497 }
41498
41499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
41500         LDKChannelUpdate msg_conv;
41501         msg_conv.inner = untag_ptr(msg);
41502         msg_conv.is_owned = ptr_is_owned(msg);
41503         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41504         msg_conv = ChannelUpdate_clone(&msg_conv);
41505         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41506         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
41507         int64_t ret_ref = tag_ptr(ret_copy, true);
41508         return ret_ref;
41509 }
41510
41511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
41512         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41513         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
41514         int64_t ret_ref = tag_ptr(ret_copy, true);
41515         return ret_ref;
41516 }
41517
41518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
41519         LDKPublicKey node_id_ref;
41520         CHECK((*env)->GetArrayLength(env, node_id) == 33);
41521         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
41522         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41523         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
41524         int64_t ret_ref = tag_ptr(ret_copy, true);
41525         return ret_ref;
41526 }
41527
41528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
41529         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
41530         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
41531         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41532         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41533         CVec_u8Z_free(ret_var);
41534         return ret_arr;
41535 }
41536
41537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41538         LDKu8slice ser_ref;
41539         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41540         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41541         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
41542         *ret_conv = NetworkUpdate_read(ser_ref);
41543         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41544         return tag_ptr(ret_conv, true);
41545 }
41546
41547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41548         LDKP2PGossipSync this_obj_conv;
41549         this_obj_conv.inner = untag_ptr(this_obj);
41550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41552         P2PGossipSync_free(this_obj_conv);
41553 }
41554
41555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) {
41556         LDKNetworkGraph network_graph_conv;
41557         network_graph_conv.inner = untag_ptr(network_graph);
41558         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41559         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41560         network_graph_conv.is_owned = false;
41561         void* chain_access_ptr = untag_ptr(chain_access);
41562         CHECK_ACCESS(chain_access_ptr);
41563         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41564         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41565         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41566                 // Manually implement clone for Java trait instances
41567                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41568                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41569                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41570                 }
41571         }
41572         void* logger_ptr = untag_ptr(logger);
41573         CHECK_ACCESS(logger_ptr);
41574         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41575         if (logger_conv.free == LDKLogger_JCalls_free) {
41576                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41577                 LDKLogger_JCalls_cloned(&logger_conv);
41578         }
41579         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
41580         int64_t ret_ref = 0;
41581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41583         return ret_ref;
41584 }
41585
41586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
41587         LDKP2PGossipSync this_arg_conv;
41588         this_arg_conv.inner = untag_ptr(this_arg);
41589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41591         this_arg_conv.is_owned = false;
41592         void* chain_access_ptr = untag_ptr(chain_access);
41593         CHECK_ACCESS(chain_access_ptr);
41594         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41595         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41596         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41597                 // Manually implement clone for Java trait instances
41598                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41599                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41600                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41601                 }
41602         }
41603         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
41604 }
41605
41606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41607         LDKNetworkGraph this_arg_conv;
41608         this_arg_conv.inner = untag_ptr(this_arg);
41609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41611         this_arg_conv.is_owned = false;
41612         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
41613         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
41614         return tag_ptr(ret_ret, true);
41615 }
41616
41617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41618         LDKP2PGossipSync this_arg_conv;
41619         this_arg_conv.inner = untag_ptr(this_arg);
41620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41622         this_arg_conv.is_owned = false;
41623         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
41624         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
41625         return tag_ptr(ret_ret, true);
41626 }
41627
41628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41629         LDKP2PGossipSync this_arg_conv;
41630         this_arg_conv.inner = untag_ptr(this_arg);
41631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41633         this_arg_conv.is_owned = false;
41634         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41635         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
41636         return tag_ptr(ret_ret, true);
41637 }
41638
41639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41640         LDKChannelUpdateInfo this_obj_conv;
41641         this_obj_conv.inner = untag_ptr(this_obj);
41642         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41644         ChannelUpdateInfo_free(this_obj_conv);
41645 }
41646
41647 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
41648         LDKChannelUpdateInfo this_ptr_conv;
41649         this_ptr_conv.inner = untag_ptr(this_ptr);
41650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41652         this_ptr_conv.is_owned = false;
41653         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
41654         return ret_conv;
41655 }
41656
41657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41658         LDKChannelUpdateInfo this_ptr_conv;
41659         this_ptr_conv.inner = untag_ptr(this_ptr);
41660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41662         this_ptr_conv.is_owned = false;
41663         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
41664 }
41665
41666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
41667         LDKChannelUpdateInfo this_ptr_conv;
41668         this_ptr_conv.inner = untag_ptr(this_ptr);
41669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41671         this_ptr_conv.is_owned = false;
41672         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
41673         return ret_conv;
41674 }
41675
41676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
41677         LDKChannelUpdateInfo this_ptr_conv;
41678         this_ptr_conv.inner = untag_ptr(this_ptr);
41679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41681         this_ptr_conv.is_owned = false;
41682         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
41683 }
41684
41685 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41686         LDKChannelUpdateInfo this_ptr_conv;
41687         this_ptr_conv.inner = untag_ptr(this_ptr);
41688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41690         this_ptr_conv.is_owned = false;
41691         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
41692         return ret_conv;
41693 }
41694
41695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41696         LDKChannelUpdateInfo this_ptr_conv;
41697         this_ptr_conv.inner = untag_ptr(this_ptr);
41698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41700         this_ptr_conv.is_owned = false;
41701         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
41702 }
41703
41704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41705         LDKChannelUpdateInfo this_ptr_conv;
41706         this_ptr_conv.inner = untag_ptr(this_ptr);
41707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41709         this_ptr_conv.is_owned = false;
41710         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
41711         return ret_conv;
41712 }
41713
41714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41715         LDKChannelUpdateInfo this_ptr_conv;
41716         this_ptr_conv.inner = untag_ptr(this_ptr);
41717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41719         this_ptr_conv.is_owned = false;
41720         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
41721 }
41722
41723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41724         LDKChannelUpdateInfo this_ptr_conv;
41725         this_ptr_conv.inner = untag_ptr(this_ptr);
41726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41728         this_ptr_conv.is_owned = false;
41729         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
41730         return ret_conv;
41731 }
41732
41733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41734         LDKChannelUpdateInfo this_ptr_conv;
41735         this_ptr_conv.inner = untag_ptr(this_ptr);
41736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41738         this_ptr_conv.is_owned = false;
41739         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
41740 }
41741
41742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
41743         LDKChannelUpdateInfo this_ptr_conv;
41744         this_ptr_conv.inner = untag_ptr(this_ptr);
41745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41747         this_ptr_conv.is_owned = false;
41748         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
41749         int64_t ret_ref = 0;
41750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41752         return ret_ref;
41753 }
41754
41755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41756         LDKChannelUpdateInfo this_ptr_conv;
41757         this_ptr_conv.inner = untag_ptr(this_ptr);
41758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41760         this_ptr_conv.is_owned = false;
41761         LDKRoutingFees val_conv;
41762         val_conv.inner = untag_ptr(val);
41763         val_conv.is_owned = ptr_is_owned(val);
41764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41765         val_conv = RoutingFees_clone(&val_conv);
41766         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
41767 }
41768
41769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
41770         LDKChannelUpdateInfo this_ptr_conv;
41771         this_ptr_conv.inner = untag_ptr(this_ptr);
41772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41774         this_ptr_conv.is_owned = false;
41775         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
41776         int64_t ret_ref = 0;
41777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41779         return ret_ref;
41780 }
41781
41782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41783         LDKChannelUpdateInfo this_ptr_conv;
41784         this_ptr_conv.inner = untag_ptr(this_ptr);
41785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41787         this_ptr_conv.is_owned = false;
41788         LDKChannelUpdate val_conv;
41789         val_conv.inner = untag_ptr(val);
41790         val_conv.is_owned = ptr_is_owned(val);
41791         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41792         val_conv = ChannelUpdate_clone(&val_conv);
41793         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
41794 }
41795
41796 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) {
41797         LDKRoutingFees fees_arg_conv;
41798         fees_arg_conv.inner = untag_ptr(fees_arg);
41799         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
41800         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
41801         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
41802         LDKChannelUpdate last_update_message_arg_conv;
41803         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
41804         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
41805         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
41806         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
41807         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);
41808         int64_t ret_ref = 0;
41809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41811         return ret_ref;
41812 }
41813
41814 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
41815         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
41816         int64_t ret_ref = 0;
41817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41819         return ret_ref;
41820 }
41821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41822         LDKChannelUpdateInfo arg_conv;
41823         arg_conv.inner = untag_ptr(arg);
41824         arg_conv.is_owned = ptr_is_owned(arg);
41825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41826         arg_conv.is_owned = false;
41827         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
41828         return ret_conv;
41829 }
41830
41831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41832         LDKChannelUpdateInfo orig_conv;
41833         orig_conv.inner = untag_ptr(orig);
41834         orig_conv.is_owned = ptr_is_owned(orig);
41835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41836         orig_conv.is_owned = false;
41837         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
41838         int64_t ret_ref = 0;
41839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41841         return ret_ref;
41842 }
41843
41844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41845         LDKChannelUpdateInfo obj_conv;
41846         obj_conv.inner = untag_ptr(obj);
41847         obj_conv.is_owned = ptr_is_owned(obj);
41848         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41849         obj_conv.is_owned = false;
41850         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
41851         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41852         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41853         CVec_u8Z_free(ret_var);
41854         return ret_arr;
41855 }
41856
41857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41858         LDKu8slice ser_ref;
41859         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41860         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41861         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
41862         *ret_conv = ChannelUpdateInfo_read(ser_ref);
41863         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41864         return tag_ptr(ret_conv, true);
41865 }
41866
41867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41868         LDKChannelInfo this_obj_conv;
41869         this_obj_conv.inner = untag_ptr(this_obj);
41870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41872         ChannelInfo_free(this_obj_conv);
41873 }
41874
41875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41876         LDKChannelInfo this_ptr_conv;
41877         this_ptr_conv.inner = untag_ptr(this_ptr);
41878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41880         this_ptr_conv.is_owned = false;
41881         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
41882         int64_t ret_ref = 0;
41883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41885         return ret_ref;
41886 }
41887
41888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41889         LDKChannelInfo this_ptr_conv;
41890         this_ptr_conv.inner = untag_ptr(this_ptr);
41891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41893         this_ptr_conv.is_owned = false;
41894         LDKChannelFeatures val_conv;
41895         val_conv.inner = untag_ptr(val);
41896         val_conv.is_owned = ptr_is_owned(val);
41897         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41898         val_conv = ChannelFeatures_clone(&val_conv);
41899         ChannelInfo_set_features(&this_ptr_conv, val_conv);
41900 }
41901
41902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
41903         LDKChannelInfo this_ptr_conv;
41904         this_ptr_conv.inner = untag_ptr(this_ptr);
41905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41907         this_ptr_conv.is_owned = false;
41908         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
41909         int64_t ret_ref = 0;
41910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41912         return ret_ref;
41913 }
41914
41915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41916         LDKChannelInfo this_ptr_conv;
41917         this_ptr_conv.inner = untag_ptr(this_ptr);
41918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41920         this_ptr_conv.is_owned = false;
41921         LDKNodeId val_conv;
41922         val_conv.inner = untag_ptr(val);
41923         val_conv.is_owned = ptr_is_owned(val);
41924         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41925         val_conv = NodeId_clone(&val_conv);
41926         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
41927 }
41928
41929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
41930         LDKChannelInfo this_ptr_conv;
41931         this_ptr_conv.inner = untag_ptr(this_ptr);
41932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41934         this_ptr_conv.is_owned = false;
41935         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
41936         int64_t ret_ref = 0;
41937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41939         return ret_ref;
41940 }
41941
41942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41943         LDKChannelInfo this_ptr_conv;
41944         this_ptr_conv.inner = untag_ptr(this_ptr);
41945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41947         this_ptr_conv.is_owned = false;
41948         LDKChannelUpdateInfo val_conv;
41949         val_conv.inner = untag_ptr(val);
41950         val_conv.is_owned = ptr_is_owned(val);
41951         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41952         val_conv = ChannelUpdateInfo_clone(&val_conv);
41953         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
41954 }
41955
41956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
41957         LDKChannelInfo this_ptr_conv;
41958         this_ptr_conv.inner = untag_ptr(this_ptr);
41959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41961         this_ptr_conv.is_owned = false;
41962         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
41963         int64_t ret_ref = 0;
41964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41966         return ret_ref;
41967 }
41968
41969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41970         LDKChannelInfo this_ptr_conv;
41971         this_ptr_conv.inner = untag_ptr(this_ptr);
41972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41974         this_ptr_conv.is_owned = false;
41975         LDKNodeId val_conv;
41976         val_conv.inner = untag_ptr(val);
41977         val_conv.is_owned = ptr_is_owned(val);
41978         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41979         val_conv = NodeId_clone(&val_conv);
41980         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
41981 }
41982
41983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
41984         LDKChannelInfo this_ptr_conv;
41985         this_ptr_conv.inner = untag_ptr(this_ptr);
41986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41988         this_ptr_conv.is_owned = false;
41989         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
41990         int64_t ret_ref = 0;
41991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41993         return ret_ref;
41994 }
41995
41996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41997         LDKChannelInfo this_ptr_conv;
41998         this_ptr_conv.inner = untag_ptr(this_ptr);
41999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42001         this_ptr_conv.is_owned = false;
42002         LDKChannelUpdateInfo val_conv;
42003         val_conv.inner = untag_ptr(val);
42004         val_conv.is_owned = ptr_is_owned(val);
42005         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42006         val_conv = ChannelUpdateInfo_clone(&val_conv);
42007         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
42008 }
42009
42010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
42011         LDKChannelInfo this_ptr_conv;
42012         this_ptr_conv.inner = untag_ptr(this_ptr);
42013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42015         this_ptr_conv.is_owned = false;
42016         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42017         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
42018         int64_t ret_ref = tag_ptr(ret_copy, true);
42019         return ret_ref;
42020 }
42021
42022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42023         LDKChannelInfo this_ptr_conv;
42024         this_ptr_conv.inner = untag_ptr(this_ptr);
42025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42027         this_ptr_conv.is_owned = false;
42028         void* val_ptr = untag_ptr(val);
42029         CHECK_ACCESS(val_ptr);
42030         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42031         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42032         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
42033 }
42034
42035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42036         LDKChannelInfo this_ptr_conv;
42037         this_ptr_conv.inner = untag_ptr(this_ptr);
42038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42040         this_ptr_conv.is_owned = false;
42041         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
42042         int64_t ret_ref = 0;
42043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42045         return ret_ref;
42046 }
42047
42048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42049         LDKChannelInfo this_ptr_conv;
42050         this_ptr_conv.inner = untag_ptr(this_ptr);
42051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42053         this_ptr_conv.is_owned = false;
42054         LDKChannelAnnouncement val_conv;
42055         val_conv.inner = untag_ptr(val);
42056         val_conv.is_owned = ptr_is_owned(val);
42057         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42058         val_conv = ChannelAnnouncement_clone(&val_conv);
42059         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
42060 }
42061
42062 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
42063         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
42064         int64_t ret_ref = 0;
42065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42067         return ret_ref;
42068 }
42069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42070         LDKChannelInfo arg_conv;
42071         arg_conv.inner = untag_ptr(arg);
42072         arg_conv.is_owned = ptr_is_owned(arg);
42073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42074         arg_conv.is_owned = false;
42075         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
42076         return ret_conv;
42077 }
42078
42079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42080         LDKChannelInfo orig_conv;
42081         orig_conv.inner = untag_ptr(orig);
42082         orig_conv.is_owned = ptr_is_owned(orig);
42083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42084         orig_conv.is_owned = false;
42085         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
42086         int64_t ret_ref = 0;
42087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42089         return ret_ref;
42090 }
42091
42092 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) {
42093         LDKChannelInfo this_arg_conv;
42094         this_arg_conv.inner = untag_ptr(this_arg);
42095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42097         this_arg_conv.is_owned = false;
42098         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
42099         int64_t ret_ref = 0;
42100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42102         return ret_ref;
42103 }
42104
42105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42106         LDKChannelInfo obj_conv;
42107         obj_conv.inner = untag_ptr(obj);
42108         obj_conv.is_owned = ptr_is_owned(obj);
42109         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42110         obj_conv.is_owned = false;
42111         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
42112         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42113         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42114         CVec_u8Z_free(ret_var);
42115         return ret_arr;
42116 }
42117
42118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42119         LDKu8slice ser_ref;
42120         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42121         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42122         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
42123         *ret_conv = ChannelInfo_read(ser_ref);
42124         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42125         return tag_ptr(ret_conv, true);
42126 }
42127
42128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42129         LDKDirectedChannelInfo this_obj_conv;
42130         this_obj_conv.inner = untag_ptr(this_obj);
42131         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42133         DirectedChannelInfo_free(this_obj_conv);
42134 }
42135
42136 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
42137         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
42138         int64_t ret_ref = 0;
42139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42141         return ret_ref;
42142 }
42143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42144         LDKDirectedChannelInfo arg_conv;
42145         arg_conv.inner = untag_ptr(arg);
42146         arg_conv.is_owned = ptr_is_owned(arg);
42147         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42148         arg_conv.is_owned = false;
42149         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
42150         return ret_conv;
42151 }
42152
42153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42154         LDKDirectedChannelInfo orig_conv;
42155         orig_conv.inner = untag_ptr(orig);
42156         orig_conv.is_owned = ptr_is_owned(orig);
42157         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42158         orig_conv.is_owned = false;
42159         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
42160         int64_t ret_ref = 0;
42161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42163         return ret_ref;
42164 }
42165
42166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
42167         LDKDirectedChannelInfo this_arg_conv;
42168         this_arg_conv.inner = untag_ptr(this_arg);
42169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42171         this_arg_conv.is_owned = false;
42172         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
42173         int64_t ret_ref = 0;
42174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42176         return ret_ref;
42177 }
42178
42179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
42180         LDKDirectedChannelInfo this_arg_conv;
42181         this_arg_conv.inner = untag_ptr(this_arg);
42182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42184         this_arg_conv.is_owned = false;
42185         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
42186         int64_t ret_ref = 0;
42187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42189         return ret_ref;
42190 }
42191
42192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42193         LDKDirectedChannelInfo this_arg_conv;
42194         this_arg_conv.inner = untag_ptr(this_arg);
42195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42197         this_arg_conv.is_owned = false;
42198         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
42199         return ret_conv;
42200 }
42201
42202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
42203         LDKDirectedChannelInfo this_arg_conv;
42204         this_arg_conv.inner = untag_ptr(this_arg);
42205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42207         this_arg_conv.is_owned = false;
42208         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42209         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
42210         int64_t ret_ref = tag_ptr(ret_copy, true);
42211         return ret_ref;
42212 }
42213
42214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42215         if (!ptr_is_owned(this_ptr)) return;
42216         void* this_ptr_ptr = untag_ptr(this_ptr);
42217         CHECK_ACCESS(this_ptr_ptr);
42218         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
42219         FREE(untag_ptr(this_ptr));
42220         EffectiveCapacity_free(this_ptr_conv);
42221 }
42222
42223 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
42224         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42225         *ret_copy = EffectiveCapacity_clone(arg);
42226         int64_t ret_ref = tag_ptr(ret_copy, true);
42227         return ret_ref;
42228 }
42229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42230         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
42231         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
42232         return ret_conv;
42233 }
42234
42235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42236         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
42237         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42238         *ret_copy = EffectiveCapacity_clone(orig_conv);
42239         int64_t ret_ref = tag_ptr(ret_copy, true);
42240         return ret_ref;
42241 }
42242
42243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
42244         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42245         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
42246         int64_t ret_ref = tag_ptr(ret_copy, true);
42247         return ret_ref;
42248 }
42249
42250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
42251         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42252         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
42253         int64_t ret_ref = tag_ptr(ret_copy, true);
42254         return ret_ref;
42255 }
42256
42257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
42258         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
42259         CHECK_ACCESS(htlc_maximum_msat_ptr);
42260         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
42261         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
42262         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42263         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
42264         int64_t ret_ref = tag_ptr(ret_copy, true);
42265         return ret_ref;
42266 }
42267
42268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
42269         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42270         *ret_copy = EffectiveCapacity_infinite();
42271         int64_t ret_ref = tag_ptr(ret_copy, true);
42272         return ret_ref;
42273 }
42274
42275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
42276         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42277         *ret_copy = EffectiveCapacity_unknown();
42278         int64_t ret_ref = tag_ptr(ret_copy, true);
42279         return ret_ref;
42280 }
42281
42282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42283         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
42284         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
42285         return ret_conv;
42286 }
42287
42288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42289         LDKRoutingFees this_obj_conv;
42290         this_obj_conv.inner = untag_ptr(this_obj);
42291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42293         RoutingFees_free(this_obj_conv);
42294 }
42295
42296 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42297         LDKRoutingFees this_ptr_conv;
42298         this_ptr_conv.inner = untag_ptr(this_ptr);
42299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42301         this_ptr_conv.is_owned = false;
42302         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
42303         return ret_conv;
42304 }
42305
42306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42307         LDKRoutingFees this_ptr_conv;
42308         this_ptr_conv.inner = untag_ptr(this_ptr);
42309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42311         this_ptr_conv.is_owned = false;
42312         RoutingFees_set_base_msat(&this_ptr_conv, val);
42313 }
42314
42315 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
42316         LDKRoutingFees this_ptr_conv;
42317         this_ptr_conv.inner = untag_ptr(this_ptr);
42318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42320         this_ptr_conv.is_owned = false;
42321         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
42322         return ret_conv;
42323 }
42324
42325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42326         LDKRoutingFees this_ptr_conv;
42327         this_ptr_conv.inner = untag_ptr(this_ptr);
42328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42330         this_ptr_conv.is_owned = false;
42331         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
42332 }
42333
42334 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) {
42335         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
42336         int64_t ret_ref = 0;
42337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42339         return ret_ref;
42340 }
42341
42342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42343         LDKRoutingFees a_conv;
42344         a_conv.inner = untag_ptr(a);
42345         a_conv.is_owned = ptr_is_owned(a);
42346         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42347         a_conv.is_owned = false;
42348         LDKRoutingFees b_conv;
42349         b_conv.inner = untag_ptr(b);
42350         b_conv.is_owned = ptr_is_owned(b);
42351         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42352         b_conv.is_owned = false;
42353         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
42354         return ret_conv;
42355 }
42356
42357 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
42358         LDKRoutingFees ret_var = RoutingFees_clone(arg);
42359         int64_t ret_ref = 0;
42360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42362         return ret_ref;
42363 }
42364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42365         LDKRoutingFees arg_conv;
42366         arg_conv.inner = untag_ptr(arg);
42367         arg_conv.is_owned = ptr_is_owned(arg);
42368         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42369         arg_conv.is_owned = false;
42370         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
42371         return ret_conv;
42372 }
42373
42374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42375         LDKRoutingFees orig_conv;
42376         orig_conv.inner = untag_ptr(orig);
42377         orig_conv.is_owned = ptr_is_owned(orig);
42378         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42379         orig_conv.is_owned = false;
42380         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
42381         int64_t ret_ref = 0;
42382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42384         return ret_ref;
42385 }
42386
42387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
42388         LDKRoutingFees o_conv;
42389         o_conv.inner = untag_ptr(o);
42390         o_conv.is_owned = ptr_is_owned(o);
42391         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42392         o_conv.is_owned = false;
42393         int64_t ret_conv = RoutingFees_hash(&o_conv);
42394         return ret_conv;
42395 }
42396
42397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
42398         LDKRoutingFees obj_conv;
42399         obj_conv.inner = untag_ptr(obj);
42400         obj_conv.is_owned = ptr_is_owned(obj);
42401         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42402         obj_conv.is_owned = false;
42403         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
42404         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42405         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42406         CVec_u8Z_free(ret_var);
42407         return ret_arr;
42408 }
42409
42410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42411         LDKu8slice ser_ref;
42412         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42413         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42414         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
42415         *ret_conv = RoutingFees_read(ser_ref);
42416         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42417         return tag_ptr(ret_conv, true);
42418 }
42419
42420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42421         LDKNodeAnnouncementInfo this_obj_conv;
42422         this_obj_conv.inner = untag_ptr(this_obj);
42423         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42425         NodeAnnouncementInfo_free(this_obj_conv);
42426 }
42427
42428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42429         LDKNodeAnnouncementInfo this_ptr_conv;
42430         this_ptr_conv.inner = untag_ptr(this_ptr);
42431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42433         this_ptr_conv.is_owned = false;
42434         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
42435         int64_t ret_ref = 0;
42436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42438         return ret_ref;
42439 }
42440
42441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42442         LDKNodeAnnouncementInfo this_ptr_conv;
42443         this_ptr_conv.inner = untag_ptr(this_ptr);
42444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42446         this_ptr_conv.is_owned = false;
42447         LDKNodeFeatures val_conv;
42448         val_conv.inner = untag_ptr(val);
42449         val_conv.is_owned = ptr_is_owned(val);
42450         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42451         val_conv = NodeFeatures_clone(&val_conv);
42452         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
42453 }
42454
42455 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
42456         LDKNodeAnnouncementInfo this_ptr_conv;
42457         this_ptr_conv.inner = untag_ptr(this_ptr);
42458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42460         this_ptr_conv.is_owned = false;
42461         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
42462         return ret_conv;
42463 }
42464
42465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42466         LDKNodeAnnouncementInfo this_ptr_conv;
42467         this_ptr_conv.inner = untag_ptr(this_ptr);
42468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42470         this_ptr_conv.is_owned = false;
42471         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
42472 }
42473
42474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
42475         LDKNodeAnnouncementInfo this_ptr_conv;
42476         this_ptr_conv.inner = untag_ptr(this_ptr);
42477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42479         this_ptr_conv.is_owned = false;
42480         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
42481         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
42482         return ret_arr;
42483 }
42484
42485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42486         LDKNodeAnnouncementInfo this_ptr_conv;
42487         this_ptr_conv.inner = untag_ptr(this_ptr);
42488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42490         this_ptr_conv.is_owned = false;
42491         LDKThreeBytes val_ref;
42492         CHECK((*env)->GetArrayLength(env, val) == 3);
42493         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
42494         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
42495 }
42496
42497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42498         LDKNodeAnnouncementInfo this_ptr_conv;
42499         this_ptr_conv.inner = untag_ptr(this_ptr);
42500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42502         this_ptr_conv.is_owned = false;
42503         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
42504         int64_t ret_ref = 0;
42505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42507         return ret_ref;
42508 }
42509
42510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42511         LDKNodeAnnouncementInfo this_ptr_conv;
42512         this_ptr_conv.inner = untag_ptr(this_ptr);
42513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42515         this_ptr_conv.is_owned = false;
42516         LDKNodeAlias val_conv;
42517         val_conv.inner = untag_ptr(val);
42518         val_conv.is_owned = ptr_is_owned(val);
42519         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42520         val_conv = NodeAlias_clone(&val_conv);
42521         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
42522 }
42523
42524 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
42525         LDKNodeAnnouncementInfo this_ptr_conv;
42526         this_ptr_conv.inner = untag_ptr(this_ptr);
42527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42529         this_ptr_conv.is_owned = false;
42530         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
42531         int64_tArray ret_arr = NULL;
42532         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42533         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42534         for (size_t m = 0; m < ret_var.datalen; m++) {
42535                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
42536                 *ret_conv_12_copy = ret_var.data[m];
42537                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
42538                 ret_arr_ptr[m] = ret_conv_12_ref;
42539         }
42540         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42541         FREE(ret_var.data);
42542         return ret_arr;
42543 }
42544
42545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42546         LDKNodeAnnouncementInfo this_ptr_conv;
42547         this_ptr_conv.inner = untag_ptr(this_ptr);
42548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42550         this_ptr_conv.is_owned = false;
42551         LDKCVec_NetAddressZ val_constr;
42552         val_constr.datalen = (*env)->GetArrayLength(env, val);
42553         if (val_constr.datalen > 0)
42554                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42555         else
42556                 val_constr.data = NULL;
42557         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42558         for (size_t m = 0; m < val_constr.datalen; m++) {
42559                 int64_t val_conv_12 = val_vals[m];
42560                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
42561                 CHECK_ACCESS(val_conv_12_ptr);
42562                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
42563                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
42564                 val_constr.data[m] = val_conv_12_conv;
42565         }
42566         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42567         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
42568 }
42569
42570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42571         LDKNodeAnnouncementInfo this_ptr_conv;
42572         this_ptr_conv.inner = untag_ptr(this_ptr);
42573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42575         this_ptr_conv.is_owned = false;
42576         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
42577         int64_t ret_ref = 0;
42578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42580         return ret_ref;
42581 }
42582
42583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42584         LDKNodeAnnouncementInfo this_ptr_conv;
42585         this_ptr_conv.inner = untag_ptr(this_ptr);
42586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42588         this_ptr_conv.is_owned = false;
42589         LDKNodeAnnouncement val_conv;
42590         val_conv.inner = untag_ptr(val);
42591         val_conv.is_owned = ptr_is_owned(val);
42592         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42593         val_conv = NodeAnnouncement_clone(&val_conv);
42594         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
42595 }
42596
42597 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_tArray addresses_arg, int64_t announcement_message_arg) {
42598         LDKNodeFeatures features_arg_conv;
42599         features_arg_conv.inner = untag_ptr(features_arg);
42600         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42601         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42602         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
42603         LDKThreeBytes rgb_arg_ref;
42604         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
42605         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
42606         LDKNodeAlias alias_arg_conv;
42607         alias_arg_conv.inner = untag_ptr(alias_arg);
42608         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
42609         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
42610         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
42611         LDKCVec_NetAddressZ addresses_arg_constr;
42612         addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
42613         if (addresses_arg_constr.datalen > 0)
42614                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42615         else
42616                 addresses_arg_constr.data = NULL;
42617         int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
42618         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
42619                 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
42620                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
42621                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
42622                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
42623                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
42624         }
42625         (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
42626         LDKNodeAnnouncement announcement_message_arg_conv;
42627         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
42628         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
42629         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
42630         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
42631         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
42632         int64_t ret_ref = 0;
42633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42635         return ret_ref;
42636 }
42637
42638 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
42639         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
42640         int64_t ret_ref = 0;
42641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42643         return ret_ref;
42644 }
42645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42646         LDKNodeAnnouncementInfo arg_conv;
42647         arg_conv.inner = untag_ptr(arg);
42648         arg_conv.is_owned = ptr_is_owned(arg);
42649         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42650         arg_conv.is_owned = false;
42651         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
42652         return ret_conv;
42653 }
42654
42655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42656         LDKNodeAnnouncementInfo orig_conv;
42657         orig_conv.inner = untag_ptr(orig);
42658         orig_conv.is_owned = ptr_is_owned(orig);
42659         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42660         orig_conv.is_owned = false;
42661         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
42662         int64_t ret_ref = 0;
42663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42665         return ret_ref;
42666 }
42667
42668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42669         LDKNodeAnnouncementInfo obj_conv;
42670         obj_conv.inner = untag_ptr(obj);
42671         obj_conv.is_owned = ptr_is_owned(obj);
42672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42673         obj_conv.is_owned = false;
42674         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
42675         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42676         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42677         CVec_u8Z_free(ret_var);
42678         return ret_arr;
42679 }
42680
42681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42682         LDKu8slice ser_ref;
42683         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42684         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42685         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
42686         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
42687         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42688         return tag_ptr(ret_conv, true);
42689 }
42690
42691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42692         LDKNodeAlias this_obj_conv;
42693         this_obj_conv.inner = untag_ptr(this_obj);
42694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42696         NodeAlias_free(this_obj_conv);
42697 }
42698
42699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
42700         LDKNodeAlias this_ptr_conv;
42701         this_ptr_conv.inner = untag_ptr(this_ptr);
42702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42704         this_ptr_conv.is_owned = false;
42705         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42706         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
42707         return ret_arr;
42708 }
42709
42710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42711         LDKNodeAlias this_ptr_conv;
42712         this_ptr_conv.inner = untag_ptr(this_ptr);
42713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42715         this_ptr_conv.is_owned = false;
42716         LDKThirtyTwoBytes val_ref;
42717         CHECK((*env)->GetArrayLength(env, val) == 32);
42718         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42719         NodeAlias_set_a(&this_ptr_conv, val_ref);
42720 }
42721
42722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
42723         LDKThirtyTwoBytes a_arg_ref;
42724         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
42725         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
42726         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
42727         int64_t ret_ref = 0;
42728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42730         return ret_ref;
42731 }
42732
42733 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
42734         LDKNodeAlias ret_var = NodeAlias_clone(arg);
42735         int64_t ret_ref = 0;
42736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42738         return ret_ref;
42739 }
42740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42741         LDKNodeAlias arg_conv;
42742         arg_conv.inner = untag_ptr(arg);
42743         arg_conv.is_owned = ptr_is_owned(arg);
42744         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42745         arg_conv.is_owned = false;
42746         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
42747         return ret_conv;
42748 }
42749
42750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42751         LDKNodeAlias orig_conv;
42752         orig_conv.inner = untag_ptr(orig);
42753         orig_conv.is_owned = ptr_is_owned(orig);
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42755         orig_conv.is_owned = false;
42756         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
42757         int64_t ret_ref = 0;
42758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42760         return ret_ref;
42761 }
42762
42763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
42764         LDKNodeAlias obj_conv;
42765         obj_conv.inner = untag_ptr(obj);
42766         obj_conv.is_owned = ptr_is_owned(obj);
42767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42768         obj_conv.is_owned = false;
42769         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
42770         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42771         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42772         CVec_u8Z_free(ret_var);
42773         return ret_arr;
42774 }
42775
42776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42777         LDKu8slice ser_ref;
42778         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42779         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42780         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
42781         *ret_conv = NodeAlias_read(ser_ref);
42782         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42783         return tag_ptr(ret_conv, true);
42784 }
42785
42786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42787         LDKNodeInfo this_obj_conv;
42788         this_obj_conv.inner = untag_ptr(this_obj);
42789         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42791         NodeInfo_free(this_obj_conv);
42792 }
42793
42794 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
42795         LDKNodeInfo this_ptr_conv;
42796         this_ptr_conv.inner = untag_ptr(this_ptr);
42797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42799         this_ptr_conv.is_owned = false;
42800         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
42801         int64_tArray ret_arr = NULL;
42802         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42803         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42804         for (size_t g = 0; g < ret_var.datalen; g++) {
42805                 int64_t ret_conv_6_conv = ret_var.data[g];
42806                 ret_arr_ptr[g] = ret_conv_6_conv;
42807         }
42808         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42809         FREE(ret_var.data);
42810         return ret_arr;
42811 }
42812
42813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42814         LDKNodeInfo this_ptr_conv;
42815         this_ptr_conv.inner = untag_ptr(this_ptr);
42816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42818         this_ptr_conv.is_owned = false;
42819         LDKCVec_u64Z val_constr;
42820         val_constr.datalen = (*env)->GetArrayLength(env, val);
42821         if (val_constr.datalen > 0)
42822                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42823         else
42824                 val_constr.data = NULL;
42825         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42826         for (size_t g = 0; g < val_constr.datalen; g++) {
42827                 int64_t val_conv_6 = val_vals[g];
42828                 val_constr.data[g] = val_conv_6;
42829         }
42830         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42831         NodeInfo_set_channels(&this_ptr_conv, val_constr);
42832 }
42833
42834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
42835         LDKNodeInfo this_ptr_conv;
42836         this_ptr_conv.inner = untag_ptr(this_ptr);
42837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42839         this_ptr_conv.is_owned = false;
42840         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
42841         int64_t ret_ref = 0;
42842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42844         return ret_ref;
42845 }
42846
42847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42848         LDKNodeInfo this_ptr_conv;
42849         this_ptr_conv.inner = untag_ptr(this_ptr);
42850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42852         this_ptr_conv.is_owned = false;
42853         LDKRoutingFees val_conv;
42854         val_conv.inner = untag_ptr(val);
42855         val_conv.is_owned = ptr_is_owned(val);
42856         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42857         val_conv = RoutingFees_clone(&val_conv);
42858         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
42859 }
42860
42861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
42862         LDKNodeInfo this_ptr_conv;
42863         this_ptr_conv.inner = untag_ptr(this_ptr);
42864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42866         this_ptr_conv.is_owned = false;
42867         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
42868         int64_t ret_ref = 0;
42869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42871         return ret_ref;
42872 }
42873
42874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42875         LDKNodeInfo this_ptr_conv;
42876         this_ptr_conv.inner = untag_ptr(this_ptr);
42877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42879         this_ptr_conv.is_owned = false;
42880         LDKNodeAnnouncementInfo val_conv;
42881         val_conv.inner = untag_ptr(val);
42882         val_conv.is_owned = ptr_is_owned(val);
42883         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42884         val_conv = NodeAnnouncementInfo_clone(&val_conv);
42885         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
42886 }
42887
42888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t lowest_inbound_channel_fees_arg, int64_t announcement_info_arg) {
42889         LDKCVec_u64Z channels_arg_constr;
42890         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
42891         if (channels_arg_constr.datalen > 0)
42892                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42893         else
42894                 channels_arg_constr.data = NULL;
42895         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
42896         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
42897                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
42898                 channels_arg_constr.data[g] = channels_arg_conv_6;
42899         }
42900         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
42901         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
42902         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
42903         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
42904         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
42905         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
42906         LDKNodeAnnouncementInfo announcement_info_arg_conv;
42907         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
42908         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
42909         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
42910         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
42911         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
42912         int64_t ret_ref = 0;
42913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42915         return ret_ref;
42916 }
42917
42918 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
42919         LDKNodeInfo ret_var = NodeInfo_clone(arg);
42920         int64_t ret_ref = 0;
42921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42923         return ret_ref;
42924 }
42925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42926         LDKNodeInfo arg_conv;
42927         arg_conv.inner = untag_ptr(arg);
42928         arg_conv.is_owned = ptr_is_owned(arg);
42929         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42930         arg_conv.is_owned = false;
42931         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
42932         return ret_conv;
42933 }
42934
42935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42936         LDKNodeInfo orig_conv;
42937         orig_conv.inner = untag_ptr(orig);
42938         orig_conv.is_owned = ptr_is_owned(orig);
42939         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42940         orig_conv.is_owned = false;
42941         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
42942         int64_t ret_ref = 0;
42943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42945         return ret_ref;
42946 }
42947
42948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42949         LDKNodeInfo obj_conv;
42950         obj_conv.inner = untag_ptr(obj);
42951         obj_conv.is_owned = ptr_is_owned(obj);
42952         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42953         obj_conv.is_owned = false;
42954         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
42955         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42956         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42957         CVec_u8Z_free(ret_var);
42958         return ret_arr;
42959 }
42960
42961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42962         LDKu8slice ser_ref;
42963         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42964         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42965         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
42966         *ret_conv = NodeInfo_read(ser_ref);
42967         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42968         return tag_ptr(ret_conv, true);
42969 }
42970
42971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
42972         LDKNetworkGraph obj_conv;
42973         obj_conv.inner = untag_ptr(obj);
42974         obj_conv.is_owned = ptr_is_owned(obj);
42975         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42976         obj_conv.is_owned = false;
42977         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
42978         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42979         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42980         CVec_u8Z_free(ret_var);
42981         return ret_arr;
42982 }
42983
42984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
42985         LDKu8slice ser_ref;
42986         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42987         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42988         void* arg_ptr = untag_ptr(arg);
42989         CHECK_ACCESS(arg_ptr);
42990         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
42991         if (arg_conv.free == LDKLogger_JCalls_free) {
42992                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42993                 LDKLogger_JCalls_cloned(&arg_conv);
42994         }
42995         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
42996         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
42997         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42998         return tag_ptr(ret_conv, true);
42999 }
43000
43001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) {
43002         LDKThirtyTwoBytes genesis_hash_ref;
43003         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
43004         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
43005         void* logger_ptr = untag_ptr(logger);
43006         CHECK_ACCESS(logger_ptr);
43007         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43008         if (logger_conv.free == LDKLogger_JCalls_free) {
43009                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43010                 LDKLogger_JCalls_cloned(&logger_conv);
43011         }
43012         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
43013         int64_t ret_ref = 0;
43014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43016         return ret_ref;
43017 }
43018
43019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
43020         LDKNetworkGraph this_arg_conv;
43021         this_arg_conv.inner = untag_ptr(this_arg);
43022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43024         this_arg_conv.is_owned = false;
43025         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
43026         int64_t ret_ref = 0;
43027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43029         return ret_ref;
43030 }
43031
43032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
43033         LDKNetworkGraph this_arg_conv;
43034         this_arg_conv.inner = untag_ptr(this_arg);
43035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43037         this_arg_conv.is_owned = false;
43038         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43039         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
43040         int64_t ret_ref = tag_ptr(ret_copy, true);
43041         return ret_ref;
43042 }
43043
43044 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) {
43045         LDKNetworkGraph this_arg_conv;
43046         this_arg_conv.inner = untag_ptr(this_arg);
43047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43049         this_arg_conv.is_owned = false;
43050         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
43051 }
43052
43053 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) {
43054         LDKNetworkGraph this_arg_conv;
43055         this_arg_conv.inner = untag_ptr(this_arg);
43056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43058         this_arg_conv.is_owned = false;
43059         LDKNodeAnnouncement msg_conv;
43060         msg_conv.inner = untag_ptr(msg);
43061         msg_conv.is_owned = ptr_is_owned(msg);
43062         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43063         msg_conv.is_owned = false;
43064         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43065         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
43066         return tag_ptr(ret_conv, true);
43067 }
43068
43069 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) {
43070         LDKNetworkGraph this_arg_conv;
43071         this_arg_conv.inner = untag_ptr(this_arg);
43072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43074         this_arg_conv.is_owned = false;
43075         LDKUnsignedNodeAnnouncement msg_conv;
43076         msg_conv.inner = untag_ptr(msg);
43077         msg_conv.is_owned = ptr_is_owned(msg);
43078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43079         msg_conv.is_owned = false;
43080         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43081         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
43082         return tag_ptr(ret_conv, true);
43083 }
43084
43085 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 chain_access) {
43086         LDKNetworkGraph this_arg_conv;
43087         this_arg_conv.inner = untag_ptr(this_arg);
43088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43090         this_arg_conv.is_owned = false;
43091         LDKChannelAnnouncement msg_conv;
43092         msg_conv.inner = untag_ptr(msg);
43093         msg_conv.is_owned = ptr_is_owned(msg);
43094         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43095         msg_conv.is_owned = false;
43096         void* chain_access_ptr = untag_ptr(chain_access);
43097         CHECK_ACCESS(chain_access_ptr);
43098         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43099         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43100         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43101                 // Manually implement clone for Java trait instances
43102                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43103                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43104                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43105                 }
43106         }
43107         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43108         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43109         return tag_ptr(ret_conv, true);
43110 }
43111
43112 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 chain_access) {
43113         LDKNetworkGraph this_arg_conv;
43114         this_arg_conv.inner = untag_ptr(this_arg);
43115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43117         this_arg_conv.is_owned = false;
43118         LDKUnsignedChannelAnnouncement msg_conv;
43119         msg_conv.inner = untag_ptr(msg);
43120         msg_conv.is_owned = ptr_is_owned(msg);
43121         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43122         msg_conv.is_owned = false;
43123         void* chain_access_ptr = untag_ptr(chain_access);
43124         CHECK_ACCESS(chain_access_ptr);
43125         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43126         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43127         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43128                 // Manually implement clone for Java trait instances
43129                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43130                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43131                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43132                 }
43133         }
43134         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43135         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43136         return tag_ptr(ret_conv, true);
43137 }
43138
43139 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) {
43140         LDKNetworkGraph this_arg_conv;
43141         this_arg_conv.inner = untag_ptr(this_arg);
43142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43144         this_arg_conv.is_owned = false;
43145         LDKChannelFeatures features_conv;
43146         features_conv.inner = untag_ptr(features);
43147         features_conv.is_owned = ptr_is_owned(features);
43148         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
43149         features_conv = ChannelFeatures_clone(&features_conv);
43150         LDKPublicKey node_id_1_ref;
43151         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
43152         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
43153         LDKPublicKey node_id_2_ref;
43154         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
43155         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
43156         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43157         *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);
43158         return tag_ptr(ret_conv, true);
43159 }
43160
43161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1channel_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
43162         LDKNetworkGraph this_arg_conv;
43163         this_arg_conv.inner = untag_ptr(this_arg);
43164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43166         this_arg_conv.is_owned = false;
43167         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
43168 }
43169
43170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
43171         LDKNetworkGraph this_arg_conv;
43172         this_arg_conv.inner = untag_ptr(this_arg);
43173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43175         this_arg_conv.is_owned = false;
43176         LDKPublicKey _node_id_ref;
43177         CHECK((*env)->GetArrayLength(env, _node_id) == 33);
43178         (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
43179         NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
43180 }
43181
43182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43183         LDKNetworkGraph this_arg_conv;
43184         this_arg_conv.inner = untag_ptr(this_arg);
43185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43187         this_arg_conv.is_owned = false;
43188         NetworkGraph_remove_stale_channels(&this_arg_conv);
43189 }
43190
43191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) {
43192         LDKNetworkGraph this_arg_conv;
43193         this_arg_conv.inner = untag_ptr(this_arg);
43194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43196         this_arg_conv.is_owned = false;
43197         NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
43198 }
43199
43200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43201         LDKNetworkGraph this_arg_conv;
43202         this_arg_conv.inner = untag_ptr(this_arg);
43203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43205         this_arg_conv.is_owned = false;
43206         LDKChannelUpdate msg_conv;
43207         msg_conv.inner = untag_ptr(msg);
43208         msg_conv.is_owned = ptr_is_owned(msg);
43209         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43210         msg_conv.is_owned = false;
43211         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43212         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
43213         return tag_ptr(ret_conv, true);
43214 }
43215
43216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43217         LDKNetworkGraph this_arg_conv;
43218         this_arg_conv.inner = untag_ptr(this_arg);
43219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43221         this_arg_conv.is_owned = false;
43222         LDKUnsignedChannelUpdate msg_conv;
43223         msg_conv.inner = untag_ptr(msg);
43224         msg_conv.is_owned = ptr_is_owned(msg);
43225         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43226         msg_conv.is_owned = false;
43227         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43228         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
43229         return tag_ptr(ret_conv, true);
43230 }
43231
43232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
43233         LDKReadOnlyNetworkGraph this_arg_conv;
43234         this_arg_conv.inner = untag_ptr(this_arg);
43235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43237         this_arg_conv.is_owned = false;
43238         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
43239         int64_t ret_ref = 0;
43240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43242         return ret_ref;
43243 }
43244
43245 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43246         LDKReadOnlyNetworkGraph this_arg_conv;
43247         this_arg_conv.inner = untag_ptr(this_arg);
43248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43250         this_arg_conv.is_owned = false;
43251         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
43252         int64_tArray ret_arr = NULL;
43253         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43254         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43255         for (size_t g = 0; g < ret_var.datalen; g++) {
43256                 int64_t ret_conv_6_conv = ret_var.data[g];
43257                 ret_arr_ptr[g] = ret_conv_6_conv;
43258         }
43259         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43260         FREE(ret_var.data);
43261         return ret_arr;
43262 }
43263
43264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
43265         LDKReadOnlyNetworkGraph this_arg_conv;
43266         this_arg_conv.inner = untag_ptr(this_arg);
43267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43269         this_arg_conv.is_owned = false;
43270         LDKNodeId node_id_conv;
43271         node_id_conv.inner = untag_ptr(node_id);
43272         node_id_conv.is_owned = ptr_is_owned(node_id);
43273         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43274         node_id_conv.is_owned = false;
43275         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
43276         int64_t ret_ref = 0;
43277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43279         return ret_ref;
43280 }
43281
43282 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
43283         LDKReadOnlyNetworkGraph this_arg_conv;
43284         this_arg_conv.inner = untag_ptr(this_arg);
43285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43287         this_arg_conv.is_owned = false;
43288         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
43289         int64_tArray ret_arr = NULL;
43290         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43291         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43292         for (size_t i = 0; i < ret_var.datalen; i++) {
43293                 LDKNodeId ret_conv_8_var = ret_var.data[i];
43294                 int64_t ret_conv_8_ref = 0;
43295                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
43296                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
43297                 ret_arr_ptr[i] = ret_conv_8_ref;
43298         }
43299         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43300         FREE(ret_var.data);
43301         return ret_arr;
43302 }
43303
43304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
43305         LDKReadOnlyNetworkGraph this_arg_conv;
43306         this_arg_conv.inner = untag_ptr(this_arg);
43307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43309         this_arg_conv.is_owned = false;
43310         LDKPublicKey pubkey_ref;
43311         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
43312         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
43313         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
43314         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
43315         int64_t ret_ref = tag_ptr(ret_copy, true);
43316         return ret_ref;
43317 }
43318
43319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43320         LDKRouteHop this_obj_conv;
43321         this_obj_conv.inner = untag_ptr(this_obj);
43322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43324         RouteHop_free(this_obj_conv);
43325 }
43326
43327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43328         LDKRouteHop this_ptr_conv;
43329         this_ptr_conv.inner = untag_ptr(this_ptr);
43330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43332         this_ptr_conv.is_owned = false;
43333         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43334         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
43335         return ret_arr;
43336 }
43337
43338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43339         LDKRouteHop this_ptr_conv;
43340         this_ptr_conv.inner = untag_ptr(this_ptr);
43341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43343         this_ptr_conv.is_owned = false;
43344         LDKPublicKey val_ref;
43345         CHECK((*env)->GetArrayLength(env, val) == 33);
43346         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43347         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
43348 }
43349
43350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43351         LDKRouteHop this_ptr_conv;
43352         this_ptr_conv.inner = untag_ptr(this_ptr);
43353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43355         this_ptr_conv.is_owned = false;
43356         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
43357         int64_t ret_ref = 0;
43358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43360         return ret_ref;
43361 }
43362
43363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43364         LDKRouteHop this_ptr_conv;
43365         this_ptr_conv.inner = untag_ptr(this_ptr);
43366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43368         this_ptr_conv.is_owned = false;
43369         LDKNodeFeatures val_conv;
43370         val_conv.inner = untag_ptr(val);
43371         val_conv.is_owned = ptr_is_owned(val);
43372         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43373         val_conv = NodeFeatures_clone(&val_conv);
43374         RouteHop_set_node_features(&this_ptr_conv, val_conv);
43375 }
43376
43377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43378         LDKRouteHop this_ptr_conv;
43379         this_ptr_conv.inner = untag_ptr(this_ptr);
43380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43382         this_ptr_conv.is_owned = false;
43383         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
43384         return ret_conv;
43385 }
43386
43387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43388         LDKRouteHop this_ptr_conv;
43389         this_ptr_conv.inner = untag_ptr(this_ptr);
43390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43392         this_ptr_conv.is_owned = false;
43393         RouteHop_set_short_channel_id(&this_ptr_conv, val);
43394 }
43395
43396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43397         LDKRouteHop 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         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
43403         int64_t ret_ref = 0;
43404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43406         return ret_ref;
43407 }
43408
43409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43410         LDKRouteHop this_ptr_conv;
43411         this_ptr_conv.inner = untag_ptr(this_ptr);
43412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43414         this_ptr_conv.is_owned = false;
43415         LDKChannelFeatures val_conv;
43416         val_conv.inner = untag_ptr(val);
43417         val_conv.is_owned = ptr_is_owned(val);
43418         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43419         val_conv = ChannelFeatures_clone(&val_conv);
43420         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
43421 }
43422
43423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43424         LDKRouteHop this_ptr_conv;
43425         this_ptr_conv.inner = untag_ptr(this_ptr);
43426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43428         this_ptr_conv.is_owned = false;
43429         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
43430         return ret_conv;
43431 }
43432
43433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43434         LDKRouteHop this_ptr_conv;
43435         this_ptr_conv.inner = untag_ptr(this_ptr);
43436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43438         this_ptr_conv.is_owned = false;
43439         RouteHop_set_fee_msat(&this_ptr_conv, val);
43440 }
43441
43442 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43443         LDKRouteHop 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 = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
43449         return ret_conv;
43450 }
43451
43452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43453         LDKRouteHop 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         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
43459 }
43460
43461 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) {
43462         LDKPublicKey pubkey_arg_ref;
43463         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
43464         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
43465         LDKNodeFeatures node_features_arg_conv;
43466         node_features_arg_conv.inner = untag_ptr(node_features_arg);
43467         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
43468         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
43469         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
43470         LDKChannelFeatures channel_features_arg_conv;
43471         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
43472         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
43473         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
43474         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
43475         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);
43476         int64_t ret_ref = 0;
43477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43479         return ret_ref;
43480 }
43481
43482 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
43483         LDKRouteHop ret_var = RouteHop_clone(arg);
43484         int64_t ret_ref = 0;
43485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43487         return ret_ref;
43488 }
43489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43490         LDKRouteHop arg_conv;
43491         arg_conv.inner = untag_ptr(arg);
43492         arg_conv.is_owned = ptr_is_owned(arg);
43493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43494         arg_conv.is_owned = false;
43495         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
43496         return ret_conv;
43497 }
43498
43499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43500         LDKRouteHop orig_conv;
43501         orig_conv.inner = untag_ptr(orig);
43502         orig_conv.is_owned = ptr_is_owned(orig);
43503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43504         orig_conv.is_owned = false;
43505         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
43506         int64_t ret_ref = 0;
43507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43509         return ret_ref;
43510 }
43511
43512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
43513         LDKRouteHop o_conv;
43514         o_conv.inner = untag_ptr(o);
43515         o_conv.is_owned = ptr_is_owned(o);
43516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43517         o_conv.is_owned = false;
43518         int64_t ret_conv = RouteHop_hash(&o_conv);
43519         return ret_conv;
43520 }
43521
43522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43523         LDKRouteHop a_conv;
43524         a_conv.inner = untag_ptr(a);
43525         a_conv.is_owned = ptr_is_owned(a);
43526         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43527         a_conv.is_owned = false;
43528         LDKRouteHop b_conv;
43529         b_conv.inner = untag_ptr(b);
43530         b_conv.is_owned = ptr_is_owned(b);
43531         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43532         b_conv.is_owned = false;
43533         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
43534         return ret_conv;
43535 }
43536
43537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
43538         LDKRouteHop obj_conv;
43539         obj_conv.inner = untag_ptr(obj);
43540         obj_conv.is_owned = ptr_is_owned(obj);
43541         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43542         obj_conv.is_owned = false;
43543         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
43544         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43545         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43546         CVec_u8Z_free(ret_var);
43547         return ret_arr;
43548 }
43549
43550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43551         LDKu8slice ser_ref;
43552         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43553         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43554         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
43555         *ret_conv = RouteHop_read(ser_ref);
43556         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43557         return tag_ptr(ret_conv, true);
43558 }
43559
43560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43561         LDKRoute this_obj_conv;
43562         this_obj_conv.inner = untag_ptr(this_obj);
43563         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43565         Route_free(this_obj_conv);
43566 }
43567
43568 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43569         LDKRoute this_ptr_conv;
43570         this_ptr_conv.inner = untag_ptr(this_ptr);
43571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43573         this_ptr_conv.is_owned = false;
43574         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
43575         jobjectArray ret_arr = NULL;
43576         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
43577         ;
43578         for (size_t m = 0; m < ret_var.datalen; m++) {
43579                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
43580                 int64_tArray ret_conv_12_arr = NULL;
43581                 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
43582                 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
43583                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
43584                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
43585                         int64_t ret_conv_12_conv_10_ref = 0;
43586                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
43587                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
43588                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
43589                 }
43590                 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
43591                 FREE(ret_conv_12_var.data);
43592                 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
43593         }
43594         
43595         FREE(ret_var.data);
43596         return ret_arr;
43597 }
43598
43599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
43600         LDKRoute this_ptr_conv;
43601         this_ptr_conv.inner = untag_ptr(this_ptr);
43602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43604         this_ptr_conv.is_owned = false;
43605         LDKCVec_CVec_RouteHopZZ val_constr;
43606         val_constr.datalen = (*env)->GetArrayLength(env, val);
43607         if (val_constr.datalen > 0)
43608                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43609         else
43610                 val_constr.data = NULL;
43611         for (size_t m = 0; m < val_constr.datalen; m++) {
43612                 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
43613                 LDKCVec_RouteHopZ val_conv_12_constr;
43614                 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
43615                 if (val_conv_12_constr.datalen > 0)
43616                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43617                 else
43618                         val_conv_12_constr.data = NULL;
43619                 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
43620                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
43621                         int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
43622                         LDKRouteHop val_conv_12_conv_10_conv;
43623                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
43624                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
43625                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
43626                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
43627                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
43628                 }
43629                 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
43630                 val_constr.data[m] = val_conv_12_constr;
43631         }
43632         Route_set_paths(&this_ptr_conv, val_constr);
43633 }
43634
43635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
43636         LDKRoute this_ptr_conv;
43637         this_ptr_conv.inner = untag_ptr(this_ptr);
43638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43640         this_ptr_conv.is_owned = false;
43641         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
43642         int64_t ret_ref = 0;
43643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43645         return ret_ref;
43646 }
43647
43648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43649         LDKRoute this_ptr_conv;
43650         this_ptr_conv.inner = untag_ptr(this_ptr);
43651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43653         this_ptr_conv.is_owned = false;
43654         LDKPaymentParameters val_conv;
43655         val_conv.inner = untag_ptr(val);
43656         val_conv.is_owned = ptr_is_owned(val);
43657         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43658         val_conv = PaymentParameters_clone(&val_conv);
43659         Route_set_payment_params(&this_ptr_conv, val_conv);
43660 }
43661
43662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
43663         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
43664         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
43665         if (paths_arg_constr.datalen > 0)
43666                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43667         else
43668                 paths_arg_constr.data = NULL;
43669         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
43670                 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
43671                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
43672                 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
43673                 if (paths_arg_conv_12_constr.datalen > 0)
43674                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43675                 else
43676                         paths_arg_conv_12_constr.data = NULL;
43677                 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
43678                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
43679                         int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
43680                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
43681                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
43682                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
43683                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
43684                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
43685                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
43686                 }
43687                 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
43688                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
43689         }
43690         LDKPaymentParameters payment_params_arg_conv;
43691         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
43692         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
43693         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
43694         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
43695         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
43696         int64_t ret_ref = 0;
43697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43699         return ret_ref;
43700 }
43701
43702 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
43703         LDKRoute ret_var = Route_clone(arg);
43704         int64_t ret_ref = 0;
43705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43707         return ret_ref;
43708 }
43709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43710         LDKRoute arg_conv;
43711         arg_conv.inner = untag_ptr(arg);
43712         arg_conv.is_owned = ptr_is_owned(arg);
43713         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43714         arg_conv.is_owned = false;
43715         int64_t ret_conv = Route_clone_ptr(&arg_conv);
43716         return ret_conv;
43717 }
43718
43719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43720         LDKRoute orig_conv;
43721         orig_conv.inner = untag_ptr(orig);
43722         orig_conv.is_owned = ptr_is_owned(orig);
43723         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43724         orig_conv.is_owned = false;
43725         LDKRoute ret_var = Route_clone(&orig_conv);
43726         int64_t ret_ref = 0;
43727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43729         return ret_ref;
43730 }
43731
43732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
43733         LDKRoute o_conv;
43734         o_conv.inner = untag_ptr(o);
43735         o_conv.is_owned = ptr_is_owned(o);
43736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43737         o_conv.is_owned = false;
43738         int64_t ret_conv = Route_hash(&o_conv);
43739         return ret_conv;
43740 }
43741
43742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43743         LDKRoute a_conv;
43744         a_conv.inner = untag_ptr(a);
43745         a_conv.is_owned = ptr_is_owned(a);
43746         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43747         a_conv.is_owned = false;
43748         LDKRoute b_conv;
43749         b_conv.inner = untag_ptr(b);
43750         b_conv.is_owned = ptr_is_owned(b);
43751         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43752         b_conv.is_owned = false;
43753         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
43754         return ret_conv;
43755 }
43756
43757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
43758         LDKRoute this_arg_conv;
43759         this_arg_conv.inner = untag_ptr(this_arg);
43760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43762         this_arg_conv.is_owned = false;
43763         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
43764         return ret_conv;
43765 }
43766
43767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
43768         LDKRoute this_arg_conv;
43769         this_arg_conv.inner = untag_ptr(this_arg);
43770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43772         this_arg_conv.is_owned = false;
43773         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
43774         return ret_conv;
43775 }
43776
43777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
43778         LDKRoute obj_conv;
43779         obj_conv.inner = untag_ptr(obj);
43780         obj_conv.is_owned = ptr_is_owned(obj);
43781         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43782         obj_conv.is_owned = false;
43783         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
43784         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43785         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43786         CVec_u8Z_free(ret_var);
43787         return ret_arr;
43788 }
43789
43790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43791         LDKu8slice ser_ref;
43792         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43793         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43794         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
43795         *ret_conv = Route_read(ser_ref);
43796         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43797         return tag_ptr(ret_conv, true);
43798 }
43799
43800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43801         LDKRouteParameters this_obj_conv;
43802         this_obj_conv.inner = untag_ptr(this_obj);
43803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43805         RouteParameters_free(this_obj_conv);
43806 }
43807
43808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
43809         LDKRouteParameters this_ptr_conv;
43810         this_ptr_conv.inner = untag_ptr(this_ptr);
43811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43813         this_ptr_conv.is_owned = false;
43814         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
43815         int64_t ret_ref = 0;
43816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43818         return ret_ref;
43819 }
43820
43821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43822         LDKRouteParameters this_ptr_conv;
43823         this_ptr_conv.inner = untag_ptr(this_ptr);
43824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43826         this_ptr_conv.is_owned = false;
43827         LDKPaymentParameters val_conv;
43828         val_conv.inner = untag_ptr(val);
43829         val_conv.is_owned = ptr_is_owned(val);
43830         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43831         val_conv = PaymentParameters_clone(&val_conv);
43832         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
43833 }
43834
43835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43836         LDKRouteParameters this_ptr_conv;
43837         this_ptr_conv.inner = untag_ptr(this_ptr);
43838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43840         this_ptr_conv.is_owned = false;
43841         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
43842         return ret_conv;
43843 }
43844
43845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43846         LDKRouteParameters 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         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
43852 }
43853
43854 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43855         LDKRouteParameters this_ptr_conv;
43856         this_ptr_conv.inner = untag_ptr(this_ptr);
43857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43859         this_ptr_conv.is_owned = false;
43860         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
43861         return ret_conv;
43862 }
43863
43864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43865         LDKRouteParameters this_ptr_conv;
43866         this_ptr_conv.inner = untag_ptr(this_ptr);
43867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43869         this_ptr_conv.is_owned = false;
43870         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
43871 }
43872
43873 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, int32_t final_cltv_expiry_delta_arg) {
43874         LDKPaymentParameters payment_params_arg_conv;
43875         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
43876         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
43877         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
43878         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
43879         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
43880         int64_t ret_ref = 0;
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43883         return ret_ref;
43884 }
43885
43886 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
43887         LDKRouteParameters ret_var = RouteParameters_clone(arg);
43888         int64_t ret_ref = 0;
43889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43891         return ret_ref;
43892 }
43893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43894         LDKRouteParameters arg_conv;
43895         arg_conv.inner = untag_ptr(arg);
43896         arg_conv.is_owned = ptr_is_owned(arg);
43897         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43898         arg_conv.is_owned = false;
43899         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
43900         return ret_conv;
43901 }
43902
43903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43904         LDKRouteParameters orig_conv;
43905         orig_conv.inner = untag_ptr(orig);
43906         orig_conv.is_owned = ptr_is_owned(orig);
43907         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43908         orig_conv.is_owned = false;
43909         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
43910         int64_t ret_ref = 0;
43911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43913         return ret_ref;
43914 }
43915
43916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
43917         LDKRouteParameters obj_conv;
43918         obj_conv.inner = untag_ptr(obj);
43919         obj_conv.is_owned = ptr_is_owned(obj);
43920         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43921         obj_conv.is_owned = false;
43922         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
43923         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43924         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43925         CVec_u8Z_free(ret_var);
43926         return ret_arr;
43927 }
43928
43929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43930         LDKu8slice ser_ref;
43931         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43932         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43933         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
43934         *ret_conv = RouteParameters_read(ser_ref);
43935         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43936         return tag_ptr(ret_conv, true);
43937 }
43938
43939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43940         LDKPaymentParameters this_obj_conv;
43941         this_obj_conv.inner = untag_ptr(this_obj);
43942         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43944         PaymentParameters_free(this_obj_conv);
43945 }
43946
43947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43948         LDKPaymentParameters this_ptr_conv;
43949         this_ptr_conv.inner = untag_ptr(this_ptr);
43950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43952         this_ptr_conv.is_owned = false;
43953         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43954         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
43955         return ret_arr;
43956 }
43957
43958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43959         LDKPaymentParameters this_ptr_conv;
43960         this_ptr_conv.inner = untag_ptr(this_ptr);
43961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43963         this_ptr_conv.is_owned = false;
43964         LDKPublicKey val_ref;
43965         CHECK((*env)->GetArrayLength(env, val) == 33);
43966         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43967         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
43968 }
43969
43970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43971         LDKPaymentParameters this_ptr_conv;
43972         this_ptr_conv.inner = untag_ptr(this_ptr);
43973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43975         this_ptr_conv.is_owned = false;
43976         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
43977         int64_t ret_ref = 0;
43978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43980         return ret_ref;
43981 }
43982
43983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43984         LDKPaymentParameters this_ptr_conv;
43985         this_ptr_conv.inner = untag_ptr(this_ptr);
43986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43988         this_ptr_conv.is_owned = false;
43989         LDKInvoiceFeatures val_conv;
43990         val_conv.inner = untag_ptr(val);
43991         val_conv.is_owned = ptr_is_owned(val);
43992         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43993         val_conv = InvoiceFeatures_clone(&val_conv);
43994         PaymentParameters_set_features(&this_ptr_conv, val_conv);
43995 }
43996
43997 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
43998         LDKPaymentParameters this_ptr_conv;
43999         this_ptr_conv.inner = untag_ptr(this_ptr);
44000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44002         this_ptr_conv.is_owned = false;
44003         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
44004         int64_tArray ret_arr = NULL;
44005         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44006         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44007         for (size_t l = 0; l < ret_var.datalen; l++) {
44008                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44009                 int64_t ret_conv_11_ref = 0;
44010                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44011                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
44012                 ret_arr_ptr[l] = ret_conv_11_ref;
44013         }
44014         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44015         FREE(ret_var.data);
44016         return ret_arr;
44017 }
44018
44019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44020         LDKPaymentParameters this_ptr_conv;
44021         this_ptr_conv.inner = untag_ptr(this_ptr);
44022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44024         this_ptr_conv.is_owned = false;
44025         LDKCVec_RouteHintZ val_constr;
44026         val_constr.datalen = (*env)->GetArrayLength(env, val);
44027         if (val_constr.datalen > 0)
44028                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44029         else
44030                 val_constr.data = NULL;
44031         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44032         for (size_t l = 0; l < val_constr.datalen; l++) {
44033                 int64_t val_conv_11 = val_vals[l];
44034                 LDKRouteHint val_conv_11_conv;
44035                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
44036                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
44037                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
44038                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
44039                 val_constr.data[l] = val_conv_11_conv;
44040         }
44041         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44042         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
44043 }
44044
44045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
44046         LDKPaymentParameters this_ptr_conv;
44047         this_ptr_conv.inner = untag_ptr(this_ptr);
44048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44050         this_ptr_conv.is_owned = false;
44051         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44052         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
44053         int64_t ret_ref = tag_ptr(ret_copy, true);
44054         return ret_ref;
44055 }
44056
44057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44058         LDKPaymentParameters this_ptr_conv;
44059         this_ptr_conv.inner = untag_ptr(this_ptr);
44060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44062         this_ptr_conv.is_owned = false;
44063         void* val_ptr = untag_ptr(val);
44064         CHECK_ACCESS(val_ptr);
44065         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44066         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44067         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
44068 }
44069
44070 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44071         LDKPaymentParameters this_ptr_conv;
44072         this_ptr_conv.inner = untag_ptr(this_ptr);
44073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44075         this_ptr_conv.is_owned = false;
44076         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
44077         return ret_conv;
44078 }
44079
44080 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) {
44081         LDKPaymentParameters this_ptr_conv;
44082         this_ptr_conv.inner = untag_ptr(this_ptr);
44083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44085         this_ptr_conv.is_owned = false;
44086         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
44087 }
44088
44089 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
44090         LDKPaymentParameters this_ptr_conv;
44091         this_ptr_conv.inner = untag_ptr(this_ptr);
44092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44094         this_ptr_conv.is_owned = false;
44095         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
44096         return ret_conv;
44097 }
44098
44099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
44100         LDKPaymentParameters this_ptr_conv;
44101         this_ptr_conv.inner = untag_ptr(this_ptr);
44102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44104         this_ptr_conv.is_owned = false;
44105         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
44106 }
44107
44108 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) {
44109         LDKPaymentParameters this_ptr_conv;
44110         this_ptr_conv.inner = untag_ptr(this_ptr);
44111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44113         this_ptr_conv.is_owned = false;
44114         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
44115         return ret_conv;
44116 }
44117
44118 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) {
44119         LDKPaymentParameters this_ptr_conv;
44120         this_ptr_conv.inner = untag_ptr(this_ptr);
44121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44123         this_ptr_conv.is_owned = false;
44124         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
44125 }
44126
44127 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
44128         LDKPaymentParameters this_ptr_conv;
44129         this_ptr_conv.inner = untag_ptr(this_ptr);
44130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44132         this_ptr_conv.is_owned = false;
44133         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
44134         int64_tArray ret_arr = NULL;
44135         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44136         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44137         for (size_t g = 0; g < ret_var.datalen; g++) {
44138                 int64_t ret_conv_6_conv = ret_var.data[g];
44139                 ret_arr_ptr[g] = ret_conv_6_conv;
44140         }
44141         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44142         FREE(ret_var.data);
44143         return ret_arr;
44144 }
44145
44146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44147         LDKPaymentParameters this_ptr_conv;
44148         this_ptr_conv.inner = untag_ptr(this_ptr);
44149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44151         this_ptr_conv.is_owned = false;
44152         LDKCVec_u64Z val_constr;
44153         val_constr.datalen = (*env)->GetArrayLength(env, val);
44154         if (val_constr.datalen > 0)
44155                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44156         else
44157                 val_constr.data = NULL;
44158         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44159         for (size_t g = 0; g < val_constr.datalen; g++) {
44160                 int64_t val_conv_6 = val_vals[g];
44161                 val_constr.data[g] = val_conv_6;
44162         }
44163         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44164         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
44165 }
44166
44167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_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) {
44168         LDKPublicKey payee_pubkey_arg_ref;
44169         CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
44170         (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
44171         LDKInvoiceFeatures features_arg_conv;
44172         features_arg_conv.inner = untag_ptr(features_arg);
44173         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44174         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44175         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
44176         LDKCVec_RouteHintZ route_hints_arg_constr;
44177         route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
44178         if (route_hints_arg_constr.datalen > 0)
44179                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44180         else
44181                 route_hints_arg_constr.data = NULL;
44182         int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
44183         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
44184                 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
44185                 LDKRouteHint route_hints_arg_conv_11_conv;
44186                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
44187                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
44188                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
44189                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
44190                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
44191         }
44192         (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
44193         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
44194         CHECK_ACCESS(expiry_time_arg_ptr);
44195         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
44196         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
44197         LDKCVec_u64Z previously_failed_channels_arg_constr;
44198         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
44199         if (previously_failed_channels_arg_constr.datalen > 0)
44200                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44201         else
44202                 previously_failed_channels_arg_constr.data = NULL;
44203         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
44204         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
44205                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
44206                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
44207         }
44208         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
44209         LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, 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);
44210         int64_t ret_ref = 0;
44211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44213         return ret_ref;
44214 }
44215
44216 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
44217         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
44218         int64_t ret_ref = 0;
44219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44221         return ret_ref;
44222 }
44223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44224         LDKPaymentParameters arg_conv;
44225         arg_conv.inner = untag_ptr(arg);
44226         arg_conv.is_owned = ptr_is_owned(arg);
44227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44228         arg_conv.is_owned = false;
44229         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
44230         return ret_conv;
44231 }
44232
44233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44234         LDKPaymentParameters orig_conv;
44235         orig_conv.inner = untag_ptr(orig);
44236         orig_conv.is_owned = ptr_is_owned(orig);
44237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44238         orig_conv.is_owned = false;
44239         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
44240         int64_t ret_ref = 0;
44241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44243         return ret_ref;
44244 }
44245
44246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
44247         LDKPaymentParameters o_conv;
44248         o_conv.inner = untag_ptr(o);
44249         o_conv.is_owned = ptr_is_owned(o);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44251         o_conv.is_owned = false;
44252         int64_t ret_conv = PaymentParameters_hash(&o_conv);
44253         return ret_conv;
44254 }
44255
44256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44257         LDKPaymentParameters a_conv;
44258         a_conv.inner = untag_ptr(a);
44259         a_conv.is_owned = ptr_is_owned(a);
44260         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44261         a_conv.is_owned = false;
44262         LDKPaymentParameters b_conv;
44263         b_conv.inner = untag_ptr(b);
44264         b_conv.is_owned = ptr_is_owned(b);
44265         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44266         b_conv.is_owned = false;
44267         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
44268         return ret_conv;
44269 }
44270
44271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
44272         LDKPaymentParameters obj_conv;
44273         obj_conv.inner = untag_ptr(obj);
44274         obj_conv.is_owned = ptr_is_owned(obj);
44275         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44276         obj_conv.is_owned = false;
44277         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
44278         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44279         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44280         CVec_u8Z_free(ret_var);
44281         return ret_arr;
44282 }
44283
44284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44285         LDKu8slice ser_ref;
44286         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44287         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44288         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
44289         *ret_conv = PaymentParameters_read(ser_ref);
44290         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44291         return tag_ptr(ret_conv, true);
44292 }
44293
44294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44295         LDKPublicKey payee_pubkey_ref;
44296         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44297         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44298         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
44299         int64_t ret_ref = 0;
44300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44302         return ret_ref;
44303 }
44304
44305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44306         LDKPublicKey payee_pubkey_ref;
44307         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44308         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44309         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
44310         int64_t ret_ref = 0;
44311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44313         return ret_ref;
44314 }
44315
44316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44317         LDKRouteHint this_obj_conv;
44318         this_obj_conv.inner = untag_ptr(this_obj);
44319         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44321         RouteHint_free(this_obj_conv);
44322 }
44323
44324 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44325         LDKRouteHint this_ptr_conv;
44326         this_ptr_conv.inner = untag_ptr(this_ptr);
44327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44329         this_ptr_conv.is_owned = false;
44330         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
44331         int64_tArray ret_arr = NULL;
44332         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44333         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44334         for (size_t o = 0; o < ret_var.datalen; o++) {
44335                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
44336                 int64_t ret_conv_14_ref = 0;
44337                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44338                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
44339                 ret_arr_ptr[o] = ret_conv_14_ref;
44340         }
44341         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44342         FREE(ret_var.data);
44343         return ret_arr;
44344 }
44345
44346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44347         LDKRouteHint this_ptr_conv;
44348         this_ptr_conv.inner = untag_ptr(this_ptr);
44349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44351         this_ptr_conv.is_owned = false;
44352         LDKCVec_RouteHintHopZ val_constr;
44353         val_constr.datalen = (*env)->GetArrayLength(env, val);
44354         if (val_constr.datalen > 0)
44355                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44356         else
44357                 val_constr.data = NULL;
44358         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44359         for (size_t o = 0; o < val_constr.datalen; o++) {
44360                 int64_t val_conv_14 = val_vals[o];
44361                 LDKRouteHintHop val_conv_14_conv;
44362                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
44363                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
44364                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
44365                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
44366                 val_constr.data[o] = val_conv_14_conv;
44367         }
44368         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44369         RouteHint_set_a(&this_ptr_conv, val_constr);
44370 }
44371
44372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
44373         LDKCVec_RouteHintHopZ a_arg_constr;
44374         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
44375         if (a_arg_constr.datalen > 0)
44376                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44377         else
44378                 a_arg_constr.data = NULL;
44379         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
44380         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
44381                 int64_t a_arg_conv_14 = a_arg_vals[o];
44382                 LDKRouteHintHop a_arg_conv_14_conv;
44383                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
44384                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
44385                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
44386                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
44387                 a_arg_constr.data[o] = a_arg_conv_14_conv;
44388         }
44389         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
44390         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
44391         int64_t ret_ref = 0;
44392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44394         return ret_ref;
44395 }
44396
44397 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
44398         LDKRouteHint ret_var = RouteHint_clone(arg);
44399         int64_t ret_ref = 0;
44400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44402         return ret_ref;
44403 }
44404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44405         LDKRouteHint arg_conv;
44406         arg_conv.inner = untag_ptr(arg);
44407         arg_conv.is_owned = ptr_is_owned(arg);
44408         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44409         arg_conv.is_owned = false;
44410         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
44411         return ret_conv;
44412 }
44413
44414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44415         LDKRouteHint orig_conv;
44416         orig_conv.inner = untag_ptr(orig);
44417         orig_conv.is_owned = ptr_is_owned(orig);
44418         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44419         orig_conv.is_owned = false;
44420         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
44421         int64_t ret_ref = 0;
44422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44424         return ret_ref;
44425 }
44426
44427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
44428         LDKRouteHint o_conv;
44429         o_conv.inner = untag_ptr(o);
44430         o_conv.is_owned = ptr_is_owned(o);
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44432         o_conv.is_owned = false;
44433         int64_t ret_conv = RouteHint_hash(&o_conv);
44434         return ret_conv;
44435 }
44436
44437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44438         LDKRouteHint a_conv;
44439         a_conv.inner = untag_ptr(a);
44440         a_conv.is_owned = ptr_is_owned(a);
44441         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44442         a_conv.is_owned = false;
44443         LDKRouteHint b_conv;
44444         b_conv.inner = untag_ptr(b);
44445         b_conv.is_owned = ptr_is_owned(b);
44446         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44447         b_conv.is_owned = false;
44448         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
44449         return ret_conv;
44450 }
44451
44452 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
44453         LDKRouteHint obj_conv;
44454         obj_conv.inner = untag_ptr(obj);
44455         obj_conv.is_owned = ptr_is_owned(obj);
44456         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44457         obj_conv.is_owned = false;
44458         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
44459         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44460         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44461         CVec_u8Z_free(ret_var);
44462         return ret_arr;
44463 }
44464
44465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44466         LDKu8slice ser_ref;
44467         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44468         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44469         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
44470         *ret_conv = RouteHint_read(ser_ref);
44471         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44472         return tag_ptr(ret_conv, true);
44473 }
44474
44475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44476         LDKRouteHintHop this_obj_conv;
44477         this_obj_conv.inner = untag_ptr(this_obj);
44478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44480         RouteHintHop_free(this_obj_conv);
44481 }
44482
44483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44484         LDKRouteHintHop this_ptr_conv;
44485         this_ptr_conv.inner = untag_ptr(this_ptr);
44486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44488         this_ptr_conv.is_owned = false;
44489         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44490         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
44491         return ret_arr;
44492 }
44493
44494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44495         LDKRouteHintHop this_ptr_conv;
44496         this_ptr_conv.inner = untag_ptr(this_ptr);
44497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44499         this_ptr_conv.is_owned = false;
44500         LDKPublicKey val_ref;
44501         CHECK((*env)->GetArrayLength(env, val) == 33);
44502         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44503         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
44504 }
44505
44506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44507         LDKRouteHintHop this_ptr_conv;
44508         this_ptr_conv.inner = untag_ptr(this_ptr);
44509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44511         this_ptr_conv.is_owned = false;
44512         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
44513         return ret_conv;
44514 }
44515
44516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44517         LDKRouteHintHop this_ptr_conv;
44518         this_ptr_conv.inner = untag_ptr(this_ptr);
44519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44521         this_ptr_conv.is_owned = false;
44522         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
44523 }
44524
44525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
44526         LDKRouteHintHop this_ptr_conv;
44527         this_ptr_conv.inner = untag_ptr(this_ptr);
44528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44530         this_ptr_conv.is_owned = false;
44531         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
44532         int64_t ret_ref = 0;
44533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44535         return ret_ref;
44536 }
44537
44538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44539         LDKRouteHintHop this_ptr_conv;
44540         this_ptr_conv.inner = untag_ptr(this_ptr);
44541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44543         this_ptr_conv.is_owned = false;
44544         LDKRoutingFees val_conv;
44545         val_conv.inner = untag_ptr(val);
44546         val_conv.is_owned = ptr_is_owned(val);
44547         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44548         val_conv = RoutingFees_clone(&val_conv);
44549         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
44550 }
44551
44552 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44553         LDKRouteHintHop this_ptr_conv;
44554         this_ptr_conv.inner = untag_ptr(this_ptr);
44555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44557         this_ptr_conv.is_owned = false;
44558         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
44559         return ret_conv;
44560 }
44561
44562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44563         LDKRouteHintHop this_ptr_conv;
44564         this_ptr_conv.inner = untag_ptr(this_ptr);
44565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44567         this_ptr_conv.is_owned = false;
44568         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
44569 }
44570
44571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44572         LDKRouteHintHop this_ptr_conv;
44573         this_ptr_conv.inner = untag_ptr(this_ptr);
44574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44576         this_ptr_conv.is_owned = false;
44577         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44578         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
44579         int64_t ret_ref = tag_ptr(ret_copy, true);
44580         return ret_ref;
44581 }
44582
44583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44584         LDKRouteHintHop this_ptr_conv;
44585         this_ptr_conv.inner = untag_ptr(this_ptr);
44586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44588         this_ptr_conv.is_owned = false;
44589         void* val_ptr = untag_ptr(val);
44590         CHECK_ACCESS(val_ptr);
44591         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44592         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44593         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
44594 }
44595
44596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44597         LDKRouteHintHop this_ptr_conv;
44598         this_ptr_conv.inner = untag_ptr(this_ptr);
44599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44601         this_ptr_conv.is_owned = false;
44602         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44603         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
44604         int64_t ret_ref = tag_ptr(ret_copy, true);
44605         return ret_ref;
44606 }
44607
44608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44609         LDKRouteHintHop this_ptr_conv;
44610         this_ptr_conv.inner = untag_ptr(this_ptr);
44611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44613         this_ptr_conv.is_owned = false;
44614         void* val_ptr = untag_ptr(val);
44615         CHECK_ACCESS(val_ptr);
44616         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44617         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44618         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
44619 }
44620
44621 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) {
44622         LDKPublicKey src_node_id_arg_ref;
44623         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
44624         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
44625         LDKRoutingFees fees_arg_conv;
44626         fees_arg_conv.inner = untag_ptr(fees_arg);
44627         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
44628         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
44629         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
44630         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
44631         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
44632         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
44633         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
44634         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
44635         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
44636         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
44637         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
44638         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);
44639         int64_t ret_ref = 0;
44640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44642         return ret_ref;
44643 }
44644
44645 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
44646         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
44647         int64_t ret_ref = 0;
44648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44650         return ret_ref;
44651 }
44652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44653         LDKRouteHintHop arg_conv;
44654         arg_conv.inner = untag_ptr(arg);
44655         arg_conv.is_owned = ptr_is_owned(arg);
44656         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44657         arg_conv.is_owned = false;
44658         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
44659         return ret_conv;
44660 }
44661
44662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44663         LDKRouteHintHop orig_conv;
44664         orig_conv.inner = untag_ptr(orig);
44665         orig_conv.is_owned = ptr_is_owned(orig);
44666         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44667         orig_conv.is_owned = false;
44668         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
44669         int64_t ret_ref = 0;
44670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44672         return ret_ref;
44673 }
44674
44675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
44676         LDKRouteHintHop o_conv;
44677         o_conv.inner = untag_ptr(o);
44678         o_conv.is_owned = ptr_is_owned(o);
44679         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44680         o_conv.is_owned = false;
44681         int64_t ret_conv = RouteHintHop_hash(&o_conv);
44682         return ret_conv;
44683 }
44684
44685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44686         LDKRouteHintHop a_conv;
44687         a_conv.inner = untag_ptr(a);
44688         a_conv.is_owned = ptr_is_owned(a);
44689         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44690         a_conv.is_owned = false;
44691         LDKRouteHintHop b_conv;
44692         b_conv.inner = untag_ptr(b);
44693         b_conv.is_owned = ptr_is_owned(b);
44694         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44695         b_conv.is_owned = false;
44696         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
44697         return ret_conv;
44698 }
44699
44700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
44701         LDKRouteHintHop obj_conv;
44702         obj_conv.inner = untag_ptr(obj);
44703         obj_conv.is_owned = ptr_is_owned(obj);
44704         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44705         obj_conv.is_owned = false;
44706         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
44707         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44708         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44709         CVec_u8Z_free(ret_var);
44710         return ret_arr;
44711 }
44712
44713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44714         LDKu8slice ser_ref;
44715         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44716         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44717         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
44718         *ret_conv = RouteHintHop_read(ser_ref);
44719         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44720         return tag_ptr(ret_conv, true);
44721 }
44722
44723 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, int8_tArray random_seed_bytes) {
44724         LDKPublicKey our_node_pubkey_ref;
44725         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
44726         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
44727         LDKRouteParameters route_params_conv;
44728         route_params_conv.inner = untag_ptr(route_params);
44729         route_params_conv.is_owned = ptr_is_owned(route_params);
44730         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44731         route_params_conv.is_owned = false;
44732         LDKNetworkGraph network_graph_conv;
44733         network_graph_conv.inner = untag_ptr(network_graph);
44734         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44735         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44736         network_graph_conv.is_owned = false;
44737         LDKCVec_ChannelDetailsZ first_hops_constr;
44738         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
44739         if (first_hops != NULL) {
44740                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
44741                 if (first_hops_constr.datalen > 0)
44742                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
44743                 else
44744                         first_hops_constr.data = NULL;
44745                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
44746                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
44747                         int64_t first_hops_conv_16 = first_hops_vals[q];
44748                         LDKChannelDetails first_hops_conv_16_conv;
44749                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
44750                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
44751                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
44752                         first_hops_conv_16_conv.is_owned = false;
44753                         first_hops_constr.data[q] = first_hops_conv_16_conv;
44754                 }
44755                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
44756                 first_hops_ptr = &first_hops_constr;
44757         }
44758         void* logger_ptr = untag_ptr(logger);
44759         CHECK_ACCESS(logger_ptr);
44760         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44761         if (logger_conv.free == LDKLogger_JCalls_free) {
44762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44763                 LDKLogger_JCalls_cloned(&logger_conv);
44764         }
44765         void* scorer_ptr = untag_ptr(scorer);
44766         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
44767         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
44768         unsigned char random_seed_bytes_arr[32];
44769         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
44770         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
44771         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
44772         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
44773         *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref);
44774         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
44775         return tag_ptr(ret_conv, true);
44776 }
44777
44778 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) {
44779         LDKPublicKey our_node_pubkey_ref;
44780         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
44781         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
44782         LDKCVec_PublicKeyZ hops_constr;
44783         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
44784         if (hops_constr.datalen > 0)
44785                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
44786         else
44787                 hops_constr.data = NULL;
44788         for (size_t i = 0; i < hops_constr.datalen; i++) {
44789                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
44790                 LDKPublicKey hops_conv_8_ref;
44791                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
44792                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
44793                 hops_constr.data[i] = hops_conv_8_ref;
44794         }
44795         LDKRouteParameters route_params_conv;
44796         route_params_conv.inner = untag_ptr(route_params);
44797         route_params_conv.is_owned = ptr_is_owned(route_params);
44798         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44799         route_params_conv.is_owned = false;
44800         LDKNetworkGraph network_graph_conv;
44801         network_graph_conv.inner = untag_ptr(network_graph);
44802         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44803         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44804         network_graph_conv.is_owned = false;
44805         void* logger_ptr = untag_ptr(logger);
44806         CHECK_ACCESS(logger_ptr);
44807         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44808         if (logger_conv.free == LDKLogger_JCalls_free) {
44809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44810                 LDKLogger_JCalls_cloned(&logger_conv);
44811         }
44812         unsigned char random_seed_bytes_arr[32];
44813         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
44814         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
44815         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
44816         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
44817         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
44818         return tag_ptr(ret_conv, true);
44819 }
44820
44821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44822         if (!ptr_is_owned(this_ptr)) return;
44823         void* this_ptr_ptr = untag_ptr(this_ptr);
44824         CHECK_ACCESS(this_ptr_ptr);
44825         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
44826         FREE(untag_ptr(this_ptr));
44827         Score_free(this_ptr_conv);
44828 }
44829
44830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44831         if (!ptr_is_owned(this_ptr)) return;
44832         void* this_ptr_ptr = untag_ptr(this_ptr);
44833         CHECK_ACCESS(this_ptr_ptr);
44834         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
44835         FREE(untag_ptr(this_ptr));
44836         LockableScore_free(this_ptr_conv);
44837 }
44838
44839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44840         LDKMultiThreadedLockableScore this_obj_conv;
44841         this_obj_conv.inner = untag_ptr(this_obj);
44842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44844         MultiThreadedLockableScore_free(this_obj_conv);
44845 }
44846
44847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
44848         LDKMultiThreadedLockableScore obj_conv;
44849         obj_conv.inner = untag_ptr(obj);
44850         obj_conv.is_owned = ptr_is_owned(obj);
44851         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44852         obj_conv.is_owned = false;
44853         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
44854         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44855         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44856         CVec_u8Z_free(ret_var);
44857         return ret_arr;
44858 }
44859
44860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
44861         void* score_ptr = untag_ptr(score);
44862         CHECK_ACCESS(score_ptr);
44863         LDKScore score_conv = *(LDKScore*)(score_ptr);
44864         if (score_conv.free == LDKScore_JCalls_free) {
44865                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44866                 LDKScore_JCalls_cloned(&score_conv);
44867         }
44868         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
44869         int64_t ret_ref = 0;
44870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44872         return ret_ref;
44873 }
44874
44875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44876         LDKChannelUsage this_obj_conv;
44877         this_obj_conv.inner = untag_ptr(this_obj);
44878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44880         ChannelUsage_free(this_obj_conv);
44881 }
44882
44883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44884         LDKChannelUsage this_ptr_conv;
44885         this_ptr_conv.inner = untag_ptr(this_ptr);
44886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44888         this_ptr_conv.is_owned = false;
44889         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
44890         return ret_conv;
44891 }
44892
44893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44894         LDKChannelUsage this_ptr_conv;
44895         this_ptr_conv.inner = untag_ptr(this_ptr);
44896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44898         this_ptr_conv.is_owned = false;
44899         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
44900 }
44901
44902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44903         LDKChannelUsage this_ptr_conv;
44904         this_ptr_conv.inner = untag_ptr(this_ptr);
44905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44907         this_ptr_conv.is_owned = false;
44908         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
44909         return ret_conv;
44910 }
44911
44912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44913         LDKChannelUsage this_ptr_conv;
44914         this_ptr_conv.inner = untag_ptr(this_ptr);
44915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44917         this_ptr_conv.is_owned = false;
44918         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
44919 }
44920
44921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
44922         LDKChannelUsage this_ptr_conv;
44923         this_ptr_conv.inner = untag_ptr(this_ptr);
44924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44926         this_ptr_conv.is_owned = false;
44927         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44928         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
44929         int64_t ret_ref = tag_ptr(ret_copy, true);
44930         return ret_ref;
44931 }
44932
44933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44934         LDKChannelUsage this_ptr_conv;
44935         this_ptr_conv.inner = untag_ptr(this_ptr);
44936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44938         this_ptr_conv.is_owned = false;
44939         void* val_ptr = untag_ptr(val);
44940         CHECK_ACCESS(val_ptr);
44941         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
44942         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
44943         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
44944 }
44945
44946 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) {
44947         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
44948         CHECK_ACCESS(effective_capacity_arg_ptr);
44949         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
44950         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
44951         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
44952         int64_t ret_ref = 0;
44953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44955         return ret_ref;
44956 }
44957
44958 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
44959         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
44960         int64_t ret_ref = 0;
44961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44963         return ret_ref;
44964 }
44965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44966         LDKChannelUsage arg_conv;
44967         arg_conv.inner = untag_ptr(arg);
44968         arg_conv.is_owned = ptr_is_owned(arg);
44969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44970         arg_conv.is_owned = false;
44971         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
44972         return ret_conv;
44973 }
44974
44975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44976         LDKChannelUsage orig_conv;
44977         orig_conv.inner = untag_ptr(orig);
44978         orig_conv.is_owned = ptr_is_owned(orig);
44979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44980         orig_conv.is_owned = false;
44981         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
44982         int64_t ret_ref = 0;
44983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44985         return ret_ref;
44986 }
44987
44988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44989         LDKFixedPenaltyScorer this_obj_conv;
44990         this_obj_conv.inner = untag_ptr(this_obj);
44991         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44993         FixedPenaltyScorer_free(this_obj_conv);
44994 }
44995
44996 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
44997         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
44998         int64_t ret_ref = 0;
44999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45001         return ret_ref;
45002 }
45003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45004         LDKFixedPenaltyScorer arg_conv;
45005         arg_conv.inner = untag_ptr(arg);
45006         arg_conv.is_owned = ptr_is_owned(arg);
45007         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45008         arg_conv.is_owned = false;
45009         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
45010         return ret_conv;
45011 }
45012
45013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45014         LDKFixedPenaltyScorer orig_conv;
45015         orig_conv.inner = untag_ptr(orig);
45016         orig_conv.is_owned = ptr_is_owned(orig);
45017         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45018         orig_conv.is_owned = false;
45019         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
45020         int64_t ret_ref = 0;
45021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45023         return ret_ref;
45024 }
45025
45026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
45027         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
45028         int64_t ret_ref = 0;
45029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45031         return ret_ref;
45032 }
45033
45034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45035         LDKFixedPenaltyScorer this_arg_conv;
45036         this_arg_conv.inner = untag_ptr(this_arg);
45037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45039         this_arg_conv.is_owned = false;
45040         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45041         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
45042         return tag_ptr(ret_ret, true);
45043 }
45044
45045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45046         LDKFixedPenaltyScorer obj_conv;
45047         obj_conv.inner = untag_ptr(obj);
45048         obj_conv.is_owned = ptr_is_owned(obj);
45049         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45050         obj_conv.is_owned = false;
45051         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
45052         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45053         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45054         CVec_u8Z_free(ret_var);
45055         return ret_arr;
45056 }
45057
45058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
45059         LDKu8slice ser_ref;
45060         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45061         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45062         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
45063         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
45064         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45065         return tag_ptr(ret_conv, true);
45066 }
45067
45068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45069         LDKProbabilisticScorer this_obj_conv;
45070         this_obj_conv.inner = untag_ptr(this_obj);
45071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45073         ProbabilisticScorer_free(this_obj_conv);
45074 }
45075
45076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45077         LDKProbabilisticScoringParameters this_obj_conv;
45078         this_obj_conv.inner = untag_ptr(this_obj);
45079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45081         ProbabilisticScoringParameters_free(this_obj_conv);
45082 }
45083
45084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45085         LDKProbabilisticScoringParameters this_ptr_conv;
45086         this_ptr_conv.inner = untag_ptr(this_ptr);
45087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45089         this_ptr_conv.is_owned = false;
45090         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
45091         return ret_conv;
45092 }
45093
45094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45095         LDKProbabilisticScoringParameters this_ptr_conv;
45096         this_ptr_conv.inner = untag_ptr(this_ptr);
45097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45099         this_ptr_conv.is_owned = false;
45100         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
45101 }
45102
45103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45104         LDKProbabilisticScoringParameters this_ptr_conv;
45105         this_ptr_conv.inner = untag_ptr(this_ptr);
45106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45108         this_ptr_conv.is_owned = false;
45109         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
45110         return ret_conv;
45111 }
45112
45113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45114         LDKProbabilisticScoringParameters this_ptr_conv;
45115         this_ptr_conv.inner = untag_ptr(this_ptr);
45116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45118         this_ptr_conv.is_owned = false;
45119         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45120 }
45121
45122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45123         LDKProbabilisticScoringParameters this_ptr_conv;
45124         this_ptr_conv.inner = untag_ptr(this_ptr);
45125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45127         this_ptr_conv.is_owned = false;
45128         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
45129         return ret_conv;
45130 }
45131
45132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45133         LDKProbabilisticScoringParameters this_ptr_conv;
45134         this_ptr_conv.inner = untag_ptr(this_ptr);
45135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45137         this_ptr_conv.is_owned = false;
45138         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
45139 }
45140
45141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
45142         LDKProbabilisticScoringParameters this_ptr_conv;
45143         this_ptr_conv.inner = untag_ptr(this_ptr);
45144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45146         this_ptr_conv.is_owned = false;
45147         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
45148         return ret_conv;
45149 }
45150
45151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45152         LDKProbabilisticScoringParameters this_ptr_conv;
45153         this_ptr_conv.inner = untag_ptr(this_ptr);
45154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45156         this_ptr_conv.is_owned = false;
45157         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
45158 }
45159
45160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45161         LDKProbabilisticScoringParameters this_ptr_conv;
45162         this_ptr_conv.inner = untag_ptr(this_ptr);
45163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45165         this_ptr_conv.is_owned = false;
45166         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
45167         return ret_conv;
45168 }
45169
45170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45171         LDKProbabilisticScoringParameters this_ptr_conv;
45172         this_ptr_conv.inner = untag_ptr(this_ptr);
45173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45175         this_ptr_conv.is_owned = false;
45176         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45177 }
45178
45179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45180         LDKProbabilisticScoringParameters this_ptr_conv;
45181         this_ptr_conv.inner = untag_ptr(this_ptr);
45182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45184         this_ptr_conv.is_owned = false;
45185         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
45186         return ret_conv;
45187 }
45188
45189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45190         LDKProbabilisticScoringParameters 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         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
45196 }
45197
45198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45199         LDKProbabilisticScoringParameters this_ptr_conv;
45200         this_ptr_conv.inner = untag_ptr(this_ptr);
45201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45203         this_ptr_conv.is_owned = false;
45204         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
45205         return ret_conv;
45206 }
45207
45208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45209         LDKProbabilisticScoringParameters this_ptr_conv;
45210         this_ptr_conv.inner = untag_ptr(this_ptr);
45211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45213         this_ptr_conv.is_owned = false;
45214         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
45215 }
45216
45217 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
45218         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
45219         int64_t ret_ref = 0;
45220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45222         return ret_ref;
45223 }
45224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45225         LDKProbabilisticScoringParameters arg_conv;
45226         arg_conv.inner = untag_ptr(arg);
45227         arg_conv.is_owned = ptr_is_owned(arg);
45228         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45229         arg_conv.is_owned = false;
45230         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
45231         return ret_conv;
45232 }
45233
45234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45235         LDKProbabilisticScoringParameters orig_conv;
45236         orig_conv.inner = untag_ptr(orig);
45237         orig_conv.is_owned = ptr_is_owned(orig);
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45239         orig_conv.is_owned = false;
45240         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
45241         int64_t ret_ref = 0;
45242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45244         return ret_ref;
45245 }
45246
45247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph, int64_t logger) {
45248         LDKProbabilisticScoringParameters params_conv;
45249         params_conv.inner = untag_ptr(params);
45250         params_conv.is_owned = ptr_is_owned(params);
45251         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
45252         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
45253         LDKNetworkGraph network_graph_conv;
45254         network_graph_conv.inner = untag_ptr(network_graph);
45255         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45256         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45257         network_graph_conv.is_owned = false;
45258         void* logger_ptr = untag_ptr(logger);
45259         CHECK_ACCESS(logger_ptr);
45260         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45261         if (logger_conv.free == LDKLogger_JCalls_free) {
45262                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45263                 LDKLogger_JCalls_cloned(&logger_conv);
45264         }
45265         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
45266         int64_t ret_ref = 0;
45267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45269         return ret_ref;
45270 }
45271
45272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
45273         LDKProbabilisticScorer this_arg_conv;
45274         this_arg_conv.inner = untag_ptr(this_arg);
45275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45277         this_arg_conv.is_owned = false;
45278         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
45279 }
45280
45281 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) {
45282         LDKProbabilisticScorer this_arg_conv;
45283         this_arg_conv.inner = untag_ptr(this_arg);
45284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45286         this_arg_conv.is_owned = false;
45287         LDKNodeId target_conv;
45288         target_conv.inner = untag_ptr(target);
45289         target_conv.is_owned = ptr_is_owned(target);
45290         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
45291         target_conv.is_owned = false;
45292         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
45293         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
45294         int64_t ret_ref = tag_ptr(ret_copy, true);
45295         return ret_ref;
45296 }
45297
45298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45299         LDKProbabilisticScorer this_arg_conv;
45300         this_arg_conv.inner = untag_ptr(this_arg);
45301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45303         this_arg_conv.is_owned = false;
45304         LDKNodeId node_id_conv;
45305         node_id_conv.inner = untag_ptr(node_id);
45306         node_id_conv.is_owned = ptr_is_owned(node_id);
45307         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45308         node_id_conv.is_owned = false;
45309         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
45310 }
45311
45312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45313         LDKProbabilisticScorer this_arg_conv;
45314         this_arg_conv.inner = untag_ptr(this_arg);
45315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45317         this_arg_conv.is_owned = false;
45318         LDKNodeId node_id_conv;
45319         node_id_conv.inner = untag_ptr(node_id);
45320         node_id_conv.is_owned = ptr_is_owned(node_id);
45321         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45322         node_id_conv.is_owned = false;
45323         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
45324 }
45325
45326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) {
45327         LDKProbabilisticScorer this_arg_conv;
45328         this_arg_conv.inner = untag_ptr(this_arg);
45329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45331         this_arg_conv.is_owned = false;
45332         LDKNodeId node_id_conv;
45333         node_id_conv.inner = untag_ptr(node_id);
45334         node_id_conv.is_owned = ptr_is_owned(node_id);
45335         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45336         node_id_conv.is_owned = false;
45337         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
45338 }
45339
45340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45341         LDKProbabilisticScorer this_arg_conv;
45342         this_arg_conv.inner = untag_ptr(this_arg);
45343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45345         this_arg_conv.is_owned = false;
45346         LDKNodeId node_id_conv;
45347         node_id_conv.inner = untag_ptr(node_id);
45348         node_id_conv.is_owned = ptr_is_owned(node_id);
45349         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45350         node_id_conv.is_owned = false;
45351         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
45352 }
45353
45354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
45355         LDKProbabilisticScorer this_arg_conv;
45356         this_arg_conv.inner = untag_ptr(this_arg);
45357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45359         this_arg_conv.is_owned = false;
45360         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
45361 }
45362
45363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) {
45364         LDKProbabilisticScoringParameters this_arg_conv;
45365         this_arg_conv.inner = untag_ptr(this_arg);
45366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45368         this_arg_conv.is_owned = false;
45369         LDKCVec_NodeIdZ node_ids_constr;
45370         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
45371         if (node_ids_constr.datalen > 0)
45372                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
45373         else
45374                 node_ids_constr.data = NULL;
45375         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
45376         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
45377                 int64_t node_ids_conv_8 = node_ids_vals[i];
45378                 LDKNodeId node_ids_conv_8_conv;
45379                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
45380                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
45381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
45382                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
45383                 node_ids_constr.data[i] = node_ids_conv_8_conv;
45384         }
45385         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
45386         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
45387 }
45388
45389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
45390         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
45391         int64_t ret_ref = 0;
45392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45394         return ret_ref;
45395 }
45396
45397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45398         LDKProbabilisticScorer this_arg_conv;
45399         this_arg_conv.inner = untag_ptr(this_arg);
45400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45402         this_arg_conv.is_owned = false;
45403         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45404         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
45405         return tag_ptr(ret_ret, true);
45406 }
45407
45408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45409         LDKProbabilisticScorer obj_conv;
45410         obj_conv.inner = untag_ptr(obj);
45411         obj_conv.is_owned = ptr_is_owned(obj);
45412         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45413         obj_conv.is_owned = false;
45414         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
45415         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45416         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45417         CVec_u8Z_free(ret_var);
45418         return ret_arr;
45419 }
45420
45421 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) {
45422         LDKu8slice ser_ref;
45423         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45424         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45425         LDKProbabilisticScoringParameters arg_a_conv;
45426         arg_a_conv.inner = untag_ptr(arg_a);
45427         arg_a_conv.is_owned = ptr_is_owned(arg_a);
45428         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
45429         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
45430         LDKNetworkGraph arg_b_conv;
45431         arg_b_conv.inner = untag_ptr(arg_b);
45432         arg_b_conv.is_owned = ptr_is_owned(arg_b);
45433         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
45434         arg_b_conv.is_owned = false;
45435         void* arg_c_ptr = untag_ptr(arg_c);
45436         CHECK_ACCESS(arg_c_ptr);
45437         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
45438         if (arg_c_conv.free == LDKLogger_JCalls_free) {
45439                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45440                 LDKLogger_JCalls_cloned(&arg_c_conv);
45441         }
45442         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
45443         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
45444         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45445         return tag_ptr(ret_conv, true);
45446 }
45447
45448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45449         LDKFilesystemPersister this_obj_conv;
45450         this_obj_conv.inner = untag_ptr(this_obj);
45451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45453         FilesystemPersister_free(this_obj_conv);
45454 }
45455
45456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
45457         LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
45458         LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
45459         int64_t ret_ref = 0;
45460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45462         return ret_ref;
45463 }
45464
45465 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
45466         LDKFilesystemPersister this_arg_conv;
45467         this_arg_conv.inner = untag_ptr(this_arg);
45468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45470         this_arg_conv.is_owned = false;
45471         LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
45472         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45473         Str_free(ret_str);
45474         return ret_conv;
45475 }
45476
45477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
45478         LDKFilesystemPersister this_arg_conv;
45479         this_arg_conv.inner = untag_ptr(this_arg);
45480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45482         this_arg_conv.is_owned = false;
45483         void* keys_manager_ptr = untag_ptr(keys_manager);
45484         CHECK_ACCESS(keys_manager_ptr);
45485         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45486         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45487                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45488                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45489         }
45490         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
45491         *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
45492         return tag_ptr(ret_conv, true);
45493 }
45494
45495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45496         LDKBackgroundProcessor this_obj_conv;
45497         this_obj_conv.inner = untag_ptr(this_obj);
45498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45500         BackgroundProcessor_free(this_obj_conv);
45501 }
45502
45503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45504         if (!ptr_is_owned(this_ptr)) return;
45505         void* this_ptr_ptr = untag_ptr(this_ptr);
45506         CHECK_ACCESS(this_ptr_ptr);
45507         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
45508         FREE(untag_ptr(this_ptr));
45509         GossipSync_free(this_ptr_conv);
45510 }
45511
45512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
45513         LDKP2PGossipSync a_conv;
45514         a_conv.inner = untag_ptr(a);
45515         a_conv.is_owned = ptr_is_owned(a);
45516         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45517         a_conv.is_owned = false;
45518         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45519         *ret_copy = GossipSync_p2_p(&a_conv);
45520         int64_t ret_ref = tag_ptr(ret_copy, true);
45521         return ret_ref;
45522 }
45523
45524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
45525         LDKRapidGossipSync a_conv;
45526         a_conv.inner = untag_ptr(a);
45527         a_conv.is_owned = ptr_is_owned(a);
45528         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45529         a_conv.is_owned = false;
45530         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45531         *ret_copy = GossipSync_rapid(&a_conv);
45532         int64_t ret_ref = tag_ptr(ret_copy, true);
45533         return ret_ref;
45534 }
45535
45536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
45537         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45538         *ret_copy = GossipSync_none();
45539         int64_t ret_ref = tag_ptr(ret_copy, true);
45540         return ret_ref;
45541 }
45542
45543 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) {
45544         void* persister_ptr = untag_ptr(persister);
45545         CHECK_ACCESS(persister_ptr);
45546         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
45547         if (persister_conv.free == LDKPersister_JCalls_free) {
45548                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45549                 LDKPersister_JCalls_cloned(&persister_conv);
45550         }
45551         void* event_handler_ptr = untag_ptr(event_handler);
45552         CHECK_ACCESS(event_handler_ptr);
45553         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45554         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45555                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45556                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45557         }
45558         LDKChainMonitor chain_monitor_conv;
45559         chain_monitor_conv.inner = untag_ptr(chain_monitor);
45560         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
45561         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
45562         chain_monitor_conv.is_owned = false;
45563         LDKChannelManager channel_manager_conv;
45564         channel_manager_conv.inner = untag_ptr(channel_manager);
45565         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
45566         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
45567         channel_manager_conv.is_owned = false;
45568         void* gossip_sync_ptr = untag_ptr(gossip_sync);
45569         CHECK_ACCESS(gossip_sync_ptr);
45570         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
45571         // WARNING: we may need a move here but no clone is available for LDKGossipSync
45572         LDKPeerManager peer_manager_conv;
45573         peer_manager_conv.inner = untag_ptr(peer_manager);
45574         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
45575         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
45576         peer_manager_conv.is_owned = false;
45577         void* logger_ptr = untag_ptr(logger);
45578         CHECK_ACCESS(logger_ptr);
45579         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45580         if (logger_conv.free == LDKLogger_JCalls_free) {
45581                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45582                 LDKLogger_JCalls_cloned(&logger_conv);
45583         }
45584         LDKMultiThreadedLockableScore scorer_conv;
45585         scorer_conv.inner = untag_ptr(scorer);
45586         scorer_conv.is_owned = ptr_is_owned(scorer);
45587         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
45588         scorer_conv.is_owned = false;
45589         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);
45590         int64_t ret_ref = 0;
45591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45593         return ret_ref;
45594 }
45595
45596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
45597         LDKBackgroundProcessor this_arg_conv;
45598         this_arg_conv.inner = untag_ptr(this_arg);
45599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45601         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
45602         
45603         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
45604         *ret_conv = BackgroundProcessor_join(this_arg_conv);
45605         return tag_ptr(ret_conv, true);
45606 }
45607
45608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
45609         LDKBackgroundProcessor this_arg_conv;
45610         this_arg_conv.inner = untag_ptr(this_arg);
45611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45613         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
45614         
45615         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
45616         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
45617         return tag_ptr(ret_conv, true);
45618 }
45619
45620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45621         if (!ptr_is_owned(this_ptr)) return;
45622         void* this_ptr_ptr = untag_ptr(this_ptr);
45623         CHECK_ACCESS(this_ptr_ptr);
45624         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
45625         FREE(untag_ptr(this_ptr));
45626         ParseError_free(this_ptr_conv);
45627 }
45628
45629 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
45630         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45631         *ret_copy = ParseError_clone(arg);
45632         int64_t ret_ref = tag_ptr(ret_copy, true);
45633         return ret_ref;
45634 }
45635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45636         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
45637         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
45638         return ret_conv;
45639 }
45640
45641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45642         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
45643         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45644         *ret_copy = ParseError_clone(orig_conv);
45645         int64_t ret_ref = tag_ptr(ret_copy, true);
45646         return ret_ref;
45647 }
45648
45649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
45650         void* a_ptr = untag_ptr(a);
45651         CHECK_ACCESS(a_ptr);
45652         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
45653         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
45654         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45655         *ret_copy = ParseError_bech32_error(a_conv);
45656         int64_t ret_ref = tag_ptr(ret_copy, true);
45657         return ret_ref;
45658 }
45659
45660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
45661         
45662         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45663         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
45664         int64_t ret_ref = tag_ptr(ret_copy, true);
45665         return ret_ref;
45666 }
45667
45668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
45669         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
45670         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45671         *ret_copy = ParseError_malformed_signature(a_conv);
45672         int64_t ret_ref = tag_ptr(ret_copy, true);
45673         return ret_ref;
45674 }
45675
45676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
45677         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45678         *ret_copy = ParseError_bad_prefix();
45679         int64_t ret_ref = tag_ptr(ret_copy, true);
45680         return ret_ref;
45681 }
45682
45683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
45684         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45685         *ret_copy = ParseError_unknown_currency();
45686         int64_t ret_ref = tag_ptr(ret_copy, true);
45687         return ret_ref;
45688 }
45689
45690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
45691         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45692         *ret_copy = ParseError_unknown_si_prefix();
45693         int64_t ret_ref = tag_ptr(ret_copy, true);
45694         return ret_ref;
45695 }
45696
45697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
45698         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45699         *ret_copy = ParseError_malformed_hrp();
45700         int64_t ret_ref = tag_ptr(ret_copy, true);
45701         return ret_ref;
45702 }
45703
45704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
45705         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45706         *ret_copy = ParseError_too_short_data_part();
45707         int64_t ret_ref = tag_ptr(ret_copy, true);
45708         return ret_ref;
45709 }
45710
45711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
45712         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45713         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
45714         int64_t ret_ref = tag_ptr(ret_copy, true);
45715         return ret_ref;
45716 }
45717
45718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
45719         
45720         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45721         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
45722         int64_t ret_ref = tag_ptr(ret_copy, true);
45723         return ret_ref;
45724 }
45725
45726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
45727         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45728         *ret_copy = ParseError_padding_error();
45729         int64_t ret_ref = tag_ptr(ret_copy, true);
45730         return ret_ref;
45731 }
45732
45733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
45734         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45735         *ret_copy = ParseError_integer_overflow_error();
45736         int64_t ret_ref = tag_ptr(ret_copy, true);
45737         return ret_ref;
45738 }
45739
45740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
45741         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45742         *ret_copy = ParseError_invalid_seg_wit_program_length();
45743         int64_t ret_ref = tag_ptr(ret_copy, true);
45744         return ret_ref;
45745 }
45746
45747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
45748         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45749         *ret_copy = ParseError_invalid_pub_key_hash_length();
45750         int64_t ret_ref = tag_ptr(ret_copy, true);
45751         return ret_ref;
45752 }
45753
45754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
45755         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45756         *ret_copy = ParseError_invalid_script_hash_length();
45757         int64_t ret_ref = tag_ptr(ret_copy, true);
45758         return ret_ref;
45759 }
45760
45761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
45762         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45763         *ret_copy = ParseError_invalid_recovery_id();
45764         int64_t ret_ref = tag_ptr(ret_copy, true);
45765         return ret_ref;
45766 }
45767
45768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
45769         LDKStr a_conv = java_to_owned_str(env, a);
45770         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45771         *ret_copy = ParseError_invalid_slice_length(a_conv);
45772         int64_t ret_ref = tag_ptr(ret_copy, true);
45773         return ret_ref;
45774 }
45775
45776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
45777         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45778         *ret_copy = ParseError_skip();
45779         int64_t ret_ref = tag_ptr(ret_copy, true);
45780         return ret_ref;
45781 }
45782
45783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45784         if (!ptr_is_owned(this_ptr)) return;
45785         void* this_ptr_ptr = untag_ptr(this_ptr);
45786         CHECK_ACCESS(this_ptr_ptr);
45787         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
45788         FREE(untag_ptr(this_ptr));
45789         ParseOrSemanticError_free(this_ptr_conv);
45790 }
45791
45792 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
45793         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45794         *ret_copy = ParseOrSemanticError_clone(arg);
45795         int64_t ret_ref = tag_ptr(ret_copy, true);
45796         return ret_ref;
45797 }
45798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45799         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
45800         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
45801         return ret_conv;
45802 }
45803
45804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45805         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
45806         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45807         *ret_copy = ParseOrSemanticError_clone(orig_conv);
45808         int64_t ret_ref = tag_ptr(ret_copy, true);
45809         return ret_ref;
45810 }
45811
45812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
45813         void* a_ptr = untag_ptr(a);
45814         CHECK_ACCESS(a_ptr);
45815         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
45816         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
45817         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45818         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
45819         int64_t ret_ref = tag_ptr(ret_copy, true);
45820         return ret_ref;
45821 }
45822
45823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
45824         LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
45825         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45826         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
45827         int64_t ret_ref = tag_ptr(ret_copy, true);
45828         return ret_ref;
45829 }
45830
45831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45832         LDKInvoice 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         Invoice_free(this_obj_conv);
45837 }
45838
45839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45840         LDKInvoice a_conv;
45841         a_conv.inner = untag_ptr(a);
45842         a_conv.is_owned = ptr_is_owned(a);
45843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45844         a_conv.is_owned = false;
45845         LDKInvoice b_conv;
45846         b_conv.inner = untag_ptr(b);
45847         b_conv.is_owned = ptr_is_owned(b);
45848         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45849         b_conv.is_owned = false;
45850         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
45851         return ret_conv;
45852 }
45853
45854 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
45855         LDKInvoice ret_var = Invoice_clone(arg);
45856         int64_t ret_ref = 0;
45857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45859         return ret_ref;
45860 }
45861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45862         LDKInvoice arg_conv;
45863         arg_conv.inner = untag_ptr(arg);
45864         arg_conv.is_owned = ptr_is_owned(arg);
45865         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45866         arg_conv.is_owned = false;
45867         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
45868         return ret_conv;
45869 }
45870
45871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45872         LDKInvoice orig_conv;
45873         orig_conv.inner = untag_ptr(orig);
45874         orig_conv.is_owned = ptr_is_owned(orig);
45875         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45876         orig_conv.is_owned = false;
45877         LDKInvoice ret_var = Invoice_clone(&orig_conv);
45878         int64_t ret_ref = 0;
45879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45881         return ret_ref;
45882 }
45883
45884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45885         LDKSignedRawInvoice this_obj_conv;
45886         this_obj_conv.inner = untag_ptr(this_obj);
45887         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45889         SignedRawInvoice_free(this_obj_conv);
45890 }
45891
45892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45893         LDKSignedRawInvoice a_conv;
45894         a_conv.inner = untag_ptr(a);
45895         a_conv.is_owned = ptr_is_owned(a);
45896         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45897         a_conv.is_owned = false;
45898         LDKSignedRawInvoice b_conv;
45899         b_conv.inner = untag_ptr(b);
45900         b_conv.is_owned = ptr_is_owned(b);
45901         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45902         b_conv.is_owned = false;
45903         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
45904         return ret_conv;
45905 }
45906
45907 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
45908         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
45909         int64_t ret_ref = 0;
45910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45912         return ret_ref;
45913 }
45914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45915         LDKSignedRawInvoice arg_conv;
45916         arg_conv.inner = untag_ptr(arg);
45917         arg_conv.is_owned = ptr_is_owned(arg);
45918         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45919         arg_conv.is_owned = false;
45920         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
45921         return ret_conv;
45922 }
45923
45924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45925         LDKSignedRawInvoice orig_conv;
45926         orig_conv.inner = untag_ptr(orig);
45927         orig_conv.is_owned = ptr_is_owned(orig);
45928         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45929         orig_conv.is_owned = false;
45930         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
45931         int64_t ret_ref = 0;
45932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45934         return ret_ref;
45935 }
45936
45937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45938         LDKRawInvoice this_obj_conv;
45939         this_obj_conv.inner = untag_ptr(this_obj);
45940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45942         RawInvoice_free(this_obj_conv);
45943 }
45944
45945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
45946         LDKRawInvoice this_ptr_conv;
45947         this_ptr_conv.inner = untag_ptr(this_ptr);
45948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45950         this_ptr_conv.is_owned = false;
45951         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
45952         int64_t ret_ref = 0;
45953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45955         return ret_ref;
45956 }
45957
45958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45959         LDKRawInvoice this_ptr_conv;
45960         this_ptr_conv.inner = untag_ptr(this_ptr);
45961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45963         this_ptr_conv.is_owned = false;
45964         LDKRawDataPart val_conv;
45965         val_conv.inner = untag_ptr(val);
45966         val_conv.is_owned = ptr_is_owned(val);
45967         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45968         val_conv = RawDataPart_clone(&val_conv);
45969         RawInvoice_set_data(&this_ptr_conv, val_conv);
45970 }
45971
45972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45973         LDKRawInvoice a_conv;
45974         a_conv.inner = untag_ptr(a);
45975         a_conv.is_owned = ptr_is_owned(a);
45976         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45977         a_conv.is_owned = false;
45978         LDKRawInvoice b_conv;
45979         b_conv.inner = untag_ptr(b);
45980         b_conv.is_owned = ptr_is_owned(b);
45981         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45982         b_conv.is_owned = false;
45983         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
45984         return ret_conv;
45985 }
45986
45987 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
45988         LDKRawInvoice ret_var = RawInvoice_clone(arg);
45989         int64_t ret_ref = 0;
45990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45992         return ret_ref;
45993 }
45994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45995         LDKRawInvoice arg_conv;
45996         arg_conv.inner = untag_ptr(arg);
45997         arg_conv.is_owned = ptr_is_owned(arg);
45998         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45999         arg_conv.is_owned = false;
46000         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
46001         return ret_conv;
46002 }
46003
46004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46005         LDKRawInvoice orig_conv;
46006         orig_conv.inner = untag_ptr(orig);
46007         orig_conv.is_owned = ptr_is_owned(orig);
46008         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46009         orig_conv.is_owned = false;
46010         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
46011         int64_t ret_ref = 0;
46012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46014         return ret_ref;
46015 }
46016
46017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46018         LDKRawDataPart this_obj_conv;
46019         this_obj_conv.inner = untag_ptr(this_obj);
46020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46022         RawDataPart_free(this_obj_conv);
46023 }
46024
46025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
46026         LDKRawDataPart this_ptr_conv;
46027         this_ptr_conv.inner = untag_ptr(this_ptr);
46028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46030         this_ptr_conv.is_owned = false;
46031         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
46032         int64_t ret_ref = 0;
46033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46035         return ret_ref;
46036 }
46037
46038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46039         LDKRawDataPart this_ptr_conv;
46040         this_ptr_conv.inner = untag_ptr(this_ptr);
46041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46043         this_ptr_conv.is_owned = false;
46044         LDKPositiveTimestamp val_conv;
46045         val_conv.inner = untag_ptr(val);
46046         val_conv.is_owned = ptr_is_owned(val);
46047         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46048         val_conv = PositiveTimestamp_clone(&val_conv);
46049         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
46050 }
46051
46052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46053         LDKRawDataPart a_conv;
46054         a_conv.inner = untag_ptr(a);
46055         a_conv.is_owned = ptr_is_owned(a);
46056         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46057         a_conv.is_owned = false;
46058         LDKRawDataPart b_conv;
46059         b_conv.inner = untag_ptr(b);
46060         b_conv.is_owned = ptr_is_owned(b);
46061         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46062         b_conv.is_owned = false;
46063         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
46064         return ret_conv;
46065 }
46066
46067 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
46068         LDKRawDataPart ret_var = RawDataPart_clone(arg);
46069         int64_t ret_ref = 0;
46070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46072         return ret_ref;
46073 }
46074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46075         LDKRawDataPart arg_conv;
46076         arg_conv.inner = untag_ptr(arg);
46077         arg_conv.is_owned = ptr_is_owned(arg);
46078         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46079         arg_conv.is_owned = false;
46080         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
46081         return ret_conv;
46082 }
46083
46084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46085         LDKRawDataPart orig_conv;
46086         orig_conv.inner = untag_ptr(orig);
46087         orig_conv.is_owned = ptr_is_owned(orig);
46088         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46089         orig_conv.is_owned = false;
46090         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
46091         int64_t ret_ref = 0;
46092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46094         return ret_ref;
46095 }
46096
46097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46098         LDKPositiveTimestamp this_obj_conv;
46099         this_obj_conv.inner = untag_ptr(this_obj);
46100         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46102         PositiveTimestamp_free(this_obj_conv);
46103 }
46104
46105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46106         LDKPositiveTimestamp a_conv;
46107         a_conv.inner = untag_ptr(a);
46108         a_conv.is_owned = ptr_is_owned(a);
46109         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46110         a_conv.is_owned = false;
46111         LDKPositiveTimestamp b_conv;
46112         b_conv.inner = untag_ptr(b);
46113         b_conv.is_owned = ptr_is_owned(b);
46114         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46115         b_conv.is_owned = false;
46116         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
46117         return ret_conv;
46118 }
46119
46120 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
46121         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
46122         int64_t ret_ref = 0;
46123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46125         return ret_ref;
46126 }
46127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46128         LDKPositiveTimestamp arg_conv;
46129         arg_conv.inner = untag_ptr(arg);
46130         arg_conv.is_owned = ptr_is_owned(arg);
46131         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46132         arg_conv.is_owned = false;
46133         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
46134         return ret_conv;
46135 }
46136
46137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46138         LDKPositiveTimestamp orig_conv;
46139         orig_conv.inner = untag_ptr(orig);
46140         orig_conv.is_owned = ptr_is_owned(orig);
46141         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46142         orig_conv.is_owned = false;
46143         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
46144         int64_t ret_ref = 0;
46145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46147         return ret_ref;
46148 }
46149
46150 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46151         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
46152         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
46153         return ret_conv;
46154 }
46155
46156 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
46157         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
46158         return ret_conv;
46159 }
46160
46161 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
46162         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
46163         return ret_conv;
46164 }
46165
46166 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
46167         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
46168         return ret_conv;
46169 }
46170
46171 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
46172         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
46173         return ret_conv;
46174 }
46175
46176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46177         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
46178         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
46179         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
46180         return ret_conv;
46181 }
46182
46183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
46184         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
46185         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
46186         return ret_conv;
46187 }
46188
46189 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46190         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
46191         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
46192         return ret_conv;
46193 }
46194
46195 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
46196         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
46197         return ret_conv;
46198 }
46199
46200 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
46201         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
46202         return ret_conv;
46203 }
46204
46205 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
46206         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
46207         return ret_conv;
46208 }
46209
46210 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
46211         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
46212         return ret_conv;
46213 }
46214
46215 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
46216         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
46217         return ret_conv;
46218 }
46219
46220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
46221         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
46222         int64_t ret_conv = Currency_hash(o_conv);
46223         return ret_conv;
46224 }
46225
46226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46227         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
46228         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
46229         jboolean ret_conv = Currency_eq(a_conv, b_conv);
46230         return ret_conv;
46231 }
46232
46233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46234         LDKSha256 this_obj_conv;
46235         this_obj_conv.inner = untag_ptr(this_obj);
46236         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46238         Sha256_free(this_obj_conv);
46239 }
46240
46241 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
46242         LDKSha256 ret_var = Sha256_clone(arg);
46243         int64_t ret_ref = 0;
46244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46246         return ret_ref;
46247 }
46248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46249         LDKSha256 arg_conv;
46250         arg_conv.inner = untag_ptr(arg);
46251         arg_conv.is_owned = ptr_is_owned(arg);
46252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46253         arg_conv.is_owned = false;
46254         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
46255         return ret_conv;
46256 }
46257
46258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46259         LDKSha256 orig_conv;
46260         orig_conv.inner = untag_ptr(orig);
46261         orig_conv.is_owned = ptr_is_owned(orig);
46262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46263         orig_conv.is_owned = false;
46264         LDKSha256 ret_var = Sha256_clone(&orig_conv);
46265         int64_t ret_ref = 0;
46266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46268         return ret_ref;
46269 }
46270
46271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
46272         LDKSha256 o_conv;
46273         o_conv.inner = untag_ptr(o);
46274         o_conv.is_owned = ptr_is_owned(o);
46275         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46276         o_conv.is_owned = false;
46277         int64_t ret_conv = Sha256_hash(&o_conv);
46278         return ret_conv;
46279 }
46280
46281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46282         LDKSha256 a_conv;
46283         a_conv.inner = untag_ptr(a);
46284         a_conv.is_owned = ptr_is_owned(a);
46285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46286         a_conv.is_owned = false;
46287         LDKSha256 b_conv;
46288         b_conv.inner = untag_ptr(b);
46289         b_conv.is_owned = ptr_is_owned(b);
46290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46291         b_conv.is_owned = false;
46292         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
46293         return ret_conv;
46294 }
46295
46296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46297         LDKDescription this_obj_conv;
46298         this_obj_conv.inner = untag_ptr(this_obj);
46299         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46301         Description_free(this_obj_conv);
46302 }
46303
46304 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
46305         LDKDescription ret_var = Description_clone(arg);
46306         int64_t ret_ref = 0;
46307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46309         return ret_ref;
46310 }
46311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46312         LDKDescription arg_conv;
46313         arg_conv.inner = untag_ptr(arg);
46314         arg_conv.is_owned = ptr_is_owned(arg);
46315         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46316         arg_conv.is_owned = false;
46317         int64_t ret_conv = Description_clone_ptr(&arg_conv);
46318         return ret_conv;
46319 }
46320
46321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46322         LDKDescription orig_conv;
46323         orig_conv.inner = untag_ptr(orig);
46324         orig_conv.is_owned = ptr_is_owned(orig);
46325         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46326         orig_conv.is_owned = false;
46327         LDKDescription ret_var = Description_clone(&orig_conv);
46328         int64_t ret_ref = 0;
46329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46331         return ret_ref;
46332 }
46333
46334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
46335         LDKDescription o_conv;
46336         o_conv.inner = untag_ptr(o);
46337         o_conv.is_owned = ptr_is_owned(o);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46339         o_conv.is_owned = false;
46340         int64_t ret_conv = Description_hash(&o_conv);
46341         return ret_conv;
46342 }
46343
46344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46345         LDKDescription a_conv;
46346         a_conv.inner = untag_ptr(a);
46347         a_conv.is_owned = ptr_is_owned(a);
46348         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46349         a_conv.is_owned = false;
46350         LDKDescription b_conv;
46351         b_conv.inner = untag_ptr(b);
46352         b_conv.is_owned = ptr_is_owned(b);
46353         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46354         b_conv.is_owned = false;
46355         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
46356         return ret_conv;
46357 }
46358
46359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46360         LDKPayeePubKey this_obj_conv;
46361         this_obj_conv.inner = untag_ptr(this_obj);
46362         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46364         PayeePubKey_free(this_obj_conv);
46365 }
46366
46367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46368         LDKPayeePubKey this_ptr_conv;
46369         this_ptr_conv.inner = untag_ptr(this_ptr);
46370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46372         this_ptr_conv.is_owned = false;
46373         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46374         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
46375         return ret_arr;
46376 }
46377
46378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46379         LDKPayeePubKey this_ptr_conv;
46380         this_ptr_conv.inner = untag_ptr(this_ptr);
46381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46383         this_ptr_conv.is_owned = false;
46384         LDKPublicKey val_ref;
46385         CHECK((*env)->GetArrayLength(env, val) == 33);
46386         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46387         PayeePubKey_set_a(&this_ptr_conv, val_ref);
46388 }
46389
46390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
46391         LDKPublicKey a_arg_ref;
46392         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
46393         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
46394         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
46395         int64_t ret_ref = 0;
46396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46398         return ret_ref;
46399 }
46400
46401 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
46402         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
46403         int64_t ret_ref = 0;
46404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46406         return ret_ref;
46407 }
46408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46409         LDKPayeePubKey arg_conv;
46410         arg_conv.inner = untag_ptr(arg);
46411         arg_conv.is_owned = ptr_is_owned(arg);
46412         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46413         arg_conv.is_owned = false;
46414         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
46415         return ret_conv;
46416 }
46417
46418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46419         LDKPayeePubKey orig_conv;
46420         orig_conv.inner = untag_ptr(orig);
46421         orig_conv.is_owned = ptr_is_owned(orig);
46422         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46423         orig_conv.is_owned = false;
46424         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
46425         int64_t ret_ref = 0;
46426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46428         return ret_ref;
46429 }
46430
46431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
46432         LDKPayeePubKey o_conv;
46433         o_conv.inner = untag_ptr(o);
46434         o_conv.is_owned = ptr_is_owned(o);
46435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46436         o_conv.is_owned = false;
46437         int64_t ret_conv = PayeePubKey_hash(&o_conv);
46438         return ret_conv;
46439 }
46440
46441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46442         LDKPayeePubKey a_conv;
46443         a_conv.inner = untag_ptr(a);
46444         a_conv.is_owned = ptr_is_owned(a);
46445         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46446         a_conv.is_owned = false;
46447         LDKPayeePubKey b_conv;
46448         b_conv.inner = untag_ptr(b);
46449         b_conv.is_owned = ptr_is_owned(b);
46450         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46451         b_conv.is_owned = false;
46452         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
46453         return ret_conv;
46454 }
46455
46456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46457         LDKExpiryTime this_obj_conv;
46458         this_obj_conv.inner = untag_ptr(this_obj);
46459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46461         ExpiryTime_free(this_obj_conv);
46462 }
46463
46464 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
46465         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
46466         int64_t ret_ref = 0;
46467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46469         return ret_ref;
46470 }
46471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46472         LDKExpiryTime arg_conv;
46473         arg_conv.inner = untag_ptr(arg);
46474         arg_conv.is_owned = ptr_is_owned(arg);
46475         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46476         arg_conv.is_owned = false;
46477         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
46478         return ret_conv;
46479 }
46480
46481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46482         LDKExpiryTime orig_conv;
46483         orig_conv.inner = untag_ptr(orig);
46484         orig_conv.is_owned = ptr_is_owned(orig);
46485         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46486         orig_conv.is_owned = false;
46487         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
46488         int64_t ret_ref = 0;
46489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46491         return ret_ref;
46492 }
46493
46494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
46495         LDKExpiryTime o_conv;
46496         o_conv.inner = untag_ptr(o);
46497         o_conv.is_owned = ptr_is_owned(o);
46498         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46499         o_conv.is_owned = false;
46500         int64_t ret_conv = ExpiryTime_hash(&o_conv);
46501         return ret_conv;
46502 }
46503
46504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46505         LDKExpiryTime a_conv;
46506         a_conv.inner = untag_ptr(a);
46507         a_conv.is_owned = ptr_is_owned(a);
46508         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46509         a_conv.is_owned = false;
46510         LDKExpiryTime b_conv;
46511         b_conv.inner = untag_ptr(b);
46512         b_conv.is_owned = ptr_is_owned(b);
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46514         b_conv.is_owned = false;
46515         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
46516         return ret_conv;
46517 }
46518
46519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46520         LDKMinFinalCltvExpiry this_obj_conv;
46521         this_obj_conv.inner = untag_ptr(this_obj);
46522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46524         MinFinalCltvExpiry_free(this_obj_conv);
46525 }
46526
46527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46528         LDKMinFinalCltvExpiry this_ptr_conv;
46529         this_ptr_conv.inner = untag_ptr(this_ptr);
46530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46532         this_ptr_conv.is_owned = false;
46533         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
46534         return ret_conv;
46535 }
46536
46537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46538         LDKMinFinalCltvExpiry this_ptr_conv;
46539         this_ptr_conv.inner = untag_ptr(this_ptr);
46540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46542         this_ptr_conv.is_owned = false;
46543         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
46544 }
46545
46546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
46547         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
46548         int64_t ret_ref = 0;
46549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46551         return ret_ref;
46552 }
46553
46554 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
46555         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
46556         int64_t ret_ref = 0;
46557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46559         return ret_ref;
46560 }
46561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46562         LDKMinFinalCltvExpiry arg_conv;
46563         arg_conv.inner = untag_ptr(arg);
46564         arg_conv.is_owned = ptr_is_owned(arg);
46565         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46566         arg_conv.is_owned = false;
46567         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
46568         return ret_conv;
46569 }
46570
46571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46572         LDKMinFinalCltvExpiry orig_conv;
46573         orig_conv.inner = untag_ptr(orig);
46574         orig_conv.is_owned = ptr_is_owned(orig);
46575         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46576         orig_conv.is_owned = false;
46577         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
46578         int64_t ret_ref = 0;
46579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46581         return ret_ref;
46582 }
46583
46584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
46585         LDKMinFinalCltvExpiry o_conv;
46586         o_conv.inner = untag_ptr(o);
46587         o_conv.is_owned = ptr_is_owned(o);
46588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46589         o_conv.is_owned = false;
46590         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
46591         return ret_conv;
46592 }
46593
46594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46595         LDKMinFinalCltvExpiry a_conv;
46596         a_conv.inner = untag_ptr(a);
46597         a_conv.is_owned = ptr_is_owned(a);
46598         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46599         a_conv.is_owned = false;
46600         LDKMinFinalCltvExpiry b_conv;
46601         b_conv.inner = untag_ptr(b);
46602         b_conv.is_owned = ptr_is_owned(b);
46603         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46604         b_conv.is_owned = false;
46605         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
46606         return ret_conv;
46607 }
46608
46609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46610         if (!ptr_is_owned(this_ptr)) return;
46611         void* this_ptr_ptr = untag_ptr(this_ptr);
46612         CHECK_ACCESS(this_ptr_ptr);
46613         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
46614         FREE(untag_ptr(this_ptr));
46615         Fallback_free(this_ptr_conv);
46616 }
46617
46618 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
46619         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46620         *ret_copy = Fallback_clone(arg);
46621         int64_t ret_ref = tag_ptr(ret_copy, true);
46622         return ret_ref;
46623 }
46624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46625         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
46626         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
46627         return ret_conv;
46628 }
46629
46630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46631         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
46632         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46633         *ret_copy = Fallback_clone(orig_conv);
46634         int64_t ret_ref = tag_ptr(ret_copy, true);
46635         return ret_ref;
46636 }
46637
46638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
46639         
46640         LDKCVec_u8Z program_ref;
46641         program_ref.datalen = (*env)->GetArrayLength(env, program);
46642         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
46643         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
46644         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46645         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
46646         int64_t ret_ref = tag_ptr(ret_copy, true);
46647         return ret_ref;
46648 }
46649
46650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
46651         LDKTwentyBytes a_ref;
46652         CHECK((*env)->GetArrayLength(env, a) == 20);
46653         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
46654         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46655         *ret_copy = Fallback_pub_key_hash(a_ref);
46656         int64_t ret_ref = tag_ptr(ret_copy, true);
46657         return ret_ref;
46658 }
46659
46660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
46661         LDKTwentyBytes a_ref;
46662         CHECK((*env)->GetArrayLength(env, a) == 20);
46663         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
46664         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46665         *ret_copy = Fallback_script_hash(a_ref);
46666         int64_t ret_ref = tag_ptr(ret_copy, true);
46667         return ret_ref;
46668 }
46669
46670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
46671         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
46672         int64_t ret_conv = Fallback_hash(o_conv);
46673         return ret_conv;
46674 }
46675
46676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46677         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
46678         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
46679         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
46680         return ret_conv;
46681 }
46682
46683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46684         LDKInvoiceSignature this_obj_conv;
46685         this_obj_conv.inner = untag_ptr(this_obj);
46686         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46688         InvoiceSignature_free(this_obj_conv);
46689 }
46690
46691 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
46692         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
46693         int64_t ret_ref = 0;
46694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46696         return ret_ref;
46697 }
46698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46699         LDKInvoiceSignature arg_conv;
46700         arg_conv.inner = untag_ptr(arg);
46701         arg_conv.is_owned = ptr_is_owned(arg);
46702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46703         arg_conv.is_owned = false;
46704         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
46705         return ret_conv;
46706 }
46707
46708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46709         LDKInvoiceSignature orig_conv;
46710         orig_conv.inner = untag_ptr(orig);
46711         orig_conv.is_owned = ptr_is_owned(orig);
46712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46713         orig_conv.is_owned = false;
46714         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
46715         int64_t ret_ref = 0;
46716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46718         return ret_ref;
46719 }
46720
46721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46722         LDKInvoiceSignature a_conv;
46723         a_conv.inner = untag_ptr(a);
46724         a_conv.is_owned = ptr_is_owned(a);
46725         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46726         a_conv.is_owned = false;
46727         LDKInvoiceSignature b_conv;
46728         b_conv.inner = untag_ptr(b);
46729         b_conv.is_owned = ptr_is_owned(b);
46730         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46731         b_conv.is_owned = false;
46732         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
46733         return ret_conv;
46734 }
46735
46736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46737         LDKPrivateRoute this_obj_conv;
46738         this_obj_conv.inner = untag_ptr(this_obj);
46739         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46741         PrivateRoute_free(this_obj_conv);
46742 }
46743
46744 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
46745         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
46746         int64_t ret_ref = 0;
46747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46749         return ret_ref;
46750 }
46751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46752         LDKPrivateRoute arg_conv;
46753         arg_conv.inner = untag_ptr(arg);
46754         arg_conv.is_owned = ptr_is_owned(arg);
46755         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46756         arg_conv.is_owned = false;
46757         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
46758         return ret_conv;
46759 }
46760
46761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46762         LDKPrivateRoute orig_conv;
46763         orig_conv.inner = untag_ptr(orig);
46764         orig_conv.is_owned = ptr_is_owned(orig);
46765         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46766         orig_conv.is_owned = false;
46767         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
46768         int64_t ret_ref = 0;
46769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46771         return ret_ref;
46772 }
46773
46774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
46775         LDKPrivateRoute o_conv;
46776         o_conv.inner = untag_ptr(o);
46777         o_conv.is_owned = ptr_is_owned(o);
46778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46779         o_conv.is_owned = false;
46780         int64_t ret_conv = PrivateRoute_hash(&o_conv);
46781         return ret_conv;
46782 }
46783
46784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46785         LDKPrivateRoute a_conv;
46786         a_conv.inner = untag_ptr(a);
46787         a_conv.is_owned = ptr_is_owned(a);
46788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46789         a_conv.is_owned = false;
46790         LDKPrivateRoute b_conv;
46791         b_conv.inner = untag_ptr(b);
46792         b_conv.is_owned = ptr_is_owned(b);
46793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46794         b_conv.is_owned = false;
46795         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
46796         return ret_conv;
46797 }
46798
46799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
46800         LDKSignedRawInvoice this_arg_conv;
46801         this_arg_conv.inner = untag_ptr(this_arg);
46802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46804         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
46805         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
46806         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
46807         return tag_ptr(ret_conv, true);
46808 }
46809
46810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
46811         LDKSignedRawInvoice this_arg_conv;
46812         this_arg_conv.inner = untag_ptr(this_arg);
46813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46815         this_arg_conv.is_owned = false;
46816         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
46817         int64_t ret_ref = 0;
46818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46820         return ret_ref;
46821 }
46822
46823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46824         LDKSignedRawInvoice this_arg_conv;
46825         this_arg_conv.inner = untag_ptr(this_arg);
46826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46828         this_arg_conv.is_owned = false;
46829         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46830         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
46831         return ret_arr;
46832 }
46833
46834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46835         LDKSignedRawInvoice this_arg_conv;
46836         this_arg_conv.inner = untag_ptr(this_arg);
46837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46839         this_arg_conv.is_owned = false;
46840         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
46841         int64_t ret_ref = 0;
46842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46844         return ret_ref;
46845 }
46846
46847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46848         LDKSignedRawInvoice this_arg_conv;
46849         this_arg_conv.inner = untag_ptr(this_arg);
46850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46852         this_arg_conv.is_owned = false;
46853         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
46854         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
46855         return tag_ptr(ret_conv, true);
46856 }
46857
46858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46859         LDKSignedRawInvoice this_arg_conv;
46860         this_arg_conv.inner = untag_ptr(this_arg);
46861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46863         this_arg_conv.is_owned = false;
46864         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
46865         return ret_conv;
46866 }
46867
46868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46869         LDKRawInvoice this_arg_conv;
46870         this_arg_conv.inner = untag_ptr(this_arg);
46871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46873         this_arg_conv.is_owned = false;
46874         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46875         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
46876         return ret_arr;
46877 }
46878
46879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46880         LDKRawInvoice this_arg_conv;
46881         this_arg_conv.inner = untag_ptr(this_arg);
46882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46884         this_arg_conv.is_owned = false;
46885         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
46886         int64_t ret_ref = 0;
46887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46889         return ret_ref;
46890 }
46891
46892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
46893         LDKRawInvoice this_arg_conv;
46894         this_arg_conv.inner = untag_ptr(this_arg);
46895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46897         this_arg_conv.is_owned = false;
46898         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
46899         int64_t ret_ref = 0;
46900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46902         return ret_ref;
46903 }
46904
46905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46906         LDKRawInvoice this_arg_conv;
46907         this_arg_conv.inner = untag_ptr(this_arg);
46908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46910         this_arg_conv.is_owned = false;
46911         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
46912         int64_t ret_ref = 0;
46913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46915         return ret_ref;
46916 }
46917
46918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46919         LDKRawInvoice this_arg_conv;
46920         this_arg_conv.inner = untag_ptr(this_arg);
46921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46923         this_arg_conv.is_owned = false;
46924         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
46925         int64_t ret_ref = 0;
46926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46928         return ret_ref;
46929 }
46930
46931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
46932         LDKRawInvoice this_arg_conv;
46933         this_arg_conv.inner = untag_ptr(this_arg);
46934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46936         this_arg_conv.is_owned = false;
46937         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
46938         int64_t ret_ref = 0;
46939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46941         return ret_ref;
46942 }
46943
46944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
46945         LDKRawInvoice this_arg_conv;
46946         this_arg_conv.inner = untag_ptr(this_arg);
46947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46949         this_arg_conv.is_owned = false;
46950         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
46951         int64_t ret_ref = 0;
46952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46954         return ret_ref;
46955 }
46956
46957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
46958         LDKRawInvoice this_arg_conv;
46959         this_arg_conv.inner = untag_ptr(this_arg);
46960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46962         this_arg_conv.is_owned = false;
46963         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46964         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
46965         return ret_arr;
46966 }
46967
46968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
46969         LDKRawInvoice this_arg_conv;
46970         this_arg_conv.inner = untag_ptr(this_arg);
46971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46973         this_arg_conv.is_owned = false;
46974         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
46975         int64_t ret_ref = 0;
46976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46978         return ret_ref;
46979 }
46980
46981 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
46982         LDKRawInvoice this_arg_conv;
46983         this_arg_conv.inner = untag_ptr(this_arg);
46984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46986         this_arg_conv.is_owned = false;
46987         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
46988         int64_tArray ret_arr = NULL;
46989         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46990         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46991         for (size_t o = 0; o < ret_var.datalen; o++) {
46992                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
46993                 int64_t ret_conv_14_ref = 0;
46994                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46995                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46996                 ret_arr_ptr[o] = ret_conv_14_ref;
46997         }
46998         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46999         FREE(ret_var.data);
47000         return ret_arr;
47001 }
47002
47003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
47004         LDKRawInvoice this_arg_conv;
47005         this_arg_conv.inner = untag_ptr(this_arg);
47006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47008         this_arg_conv.is_owned = false;
47009         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47010         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
47011         int64_t ret_ref = tag_ptr(ret_copy, true);
47012         return ret_ref;
47013 }
47014
47015 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47016         LDKRawInvoice this_arg_conv;
47017         this_arg_conv.inner = untag_ptr(this_arg);
47018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47020         this_arg_conv.is_owned = false;
47021         jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
47022         return ret_conv;
47023 }
47024
47025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
47026         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47027         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
47028         return tag_ptr(ret_conv, true);
47029 }
47030
47031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
47032         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47033         *ret_conv = PositiveTimestamp_from_system_time(time);
47034         return tag_ptr(ret_conv, true);
47035 }
47036
47037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
47038         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47039         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
47040         return tag_ptr(ret_conv, true);
47041 }
47042
47043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
47044         LDKPositiveTimestamp this_arg_conv;
47045         this_arg_conv.inner = untag_ptr(this_arg);
47046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47048         this_arg_conv.is_owned = false;
47049         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
47050         return ret_conv;
47051 }
47052
47053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
47054         LDKPositiveTimestamp this_arg_conv;
47055         this_arg_conv.inner = untag_ptr(this_arg);
47056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47058         this_arg_conv.is_owned = false;
47059         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
47060         return ret_conv;
47061 }
47062
47063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47064         LDKPositiveTimestamp this_arg_conv;
47065         this_arg_conv.inner = untag_ptr(this_arg);
47066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47068         this_arg_conv.is_owned = false;
47069         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
47070         return ret_conv;
47071 }
47072
47073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
47074         LDKInvoice this_arg_conv;
47075         this_arg_conv.inner = untag_ptr(this_arg);
47076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47078         this_arg_conv = Invoice_clone(&this_arg_conv);
47079         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
47080         int64_t ret_ref = 0;
47081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47083         return ret_ref;
47084 }
47085
47086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
47087         LDKInvoice this_arg_conv;
47088         this_arg_conv.inner = untag_ptr(this_arg);
47089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47091         this_arg_conv.is_owned = false;
47092         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
47093         *ret_conv = Invoice_check_signature(&this_arg_conv);
47094         return tag_ptr(ret_conv, true);
47095 }
47096
47097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
47098         LDKSignedRawInvoice signed_invoice_conv;
47099         signed_invoice_conv.inner = untag_ptr(signed_invoice);
47100         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
47101         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
47102         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
47103         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
47104         *ret_conv = Invoice_from_signed(signed_invoice_conv);
47105         return tag_ptr(ret_conv, true);
47106 }
47107
47108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
47109         LDKInvoice this_arg_conv;
47110         this_arg_conv.inner = untag_ptr(this_arg);
47111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47113         this_arg_conv.is_owned = false;
47114         int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
47115         return ret_conv;
47116 }
47117
47118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
47119         LDKInvoice this_arg_conv;
47120         this_arg_conv.inner = untag_ptr(this_arg);
47121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47123         this_arg_conv.is_owned = false;
47124         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
47125         return ret_conv;
47126 }
47127
47128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47129         LDKInvoice this_arg_conv;
47130         this_arg_conv.inner = untag_ptr(this_arg);
47131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47133         this_arg_conv.is_owned = false;
47134         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47135         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
47136         return ret_arr;
47137 }
47138
47139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47140         LDKInvoice this_arg_conv;
47141         this_arg_conv.inner = untag_ptr(this_arg);
47142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47144         this_arg_conv.is_owned = false;
47145         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47146         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
47147         return ret_arr;
47148 }
47149
47150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
47151         LDKInvoice this_arg_conv;
47152         this_arg_conv.inner = untag_ptr(this_arg);
47153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47155         this_arg_conv.is_owned = false;
47156         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47157         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
47158         return ret_arr;
47159 }
47160
47161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
47162         LDKInvoice this_arg_conv;
47163         this_arg_conv.inner = untag_ptr(this_arg);
47164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47166         this_arg_conv.is_owned = false;
47167         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
47168         int64_t ret_ref = 0;
47169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47171         return ret_ref;
47172 }
47173
47174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47175         LDKInvoice this_arg_conv;
47176         this_arg_conv.inner = untag_ptr(this_arg);
47177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47179         this_arg_conv.is_owned = false;
47180         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47181         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
47182         return ret_arr;
47183 }
47184
47185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47186         LDKInvoice this_arg_conv;
47187         this_arg_conv.inner = untag_ptr(this_arg);
47188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47190         this_arg_conv.is_owned = false;
47191         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
47192         return ret_conv;
47193 }
47194
47195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
47196         LDKInvoice this_arg_conv;
47197         this_arg_conv.inner = untag_ptr(this_arg);
47198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47200         this_arg_conv.is_owned = false;
47201         jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
47202         return ret_conv;
47203 }
47204
47205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
47206         LDKInvoice this_arg_conv;
47207         this_arg_conv.inner = untag_ptr(this_arg);
47208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47210         this_arg_conv.is_owned = false;
47211         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
47212         return ret_conv;
47213 }
47214
47215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
47216         LDKInvoice this_arg_conv;
47217         this_arg_conv.inner = untag_ptr(this_arg);
47218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47220         this_arg_conv.is_owned = false;
47221         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
47222         return ret_conv;
47223 }
47224
47225 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
47226         LDKInvoice this_arg_conv;
47227         this_arg_conv.inner = untag_ptr(this_arg);
47228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47230         this_arg_conv.is_owned = false;
47231         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
47232         int64_tArray ret_arr = NULL;
47233         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47234         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47235         for (size_t o = 0; o < ret_var.datalen; o++) {
47236                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47237                 int64_t ret_conv_14_ref = 0;
47238                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47239                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47240                 ret_arr_ptr[o] = ret_conv_14_ref;
47241         }
47242         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47243         FREE(ret_var.data);
47244         return ret_arr;
47245 }
47246
47247 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
47248         LDKInvoice this_arg_conv;
47249         this_arg_conv.inner = untag_ptr(this_arg);
47250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47252         this_arg_conv.is_owned = false;
47253         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
47254         int64_tArray ret_arr = NULL;
47255         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47256         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47257         for (size_t l = 0; l < ret_var.datalen; l++) {
47258                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
47259                 int64_t ret_conv_11_ref = 0;
47260                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
47261                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
47262                 ret_arr_ptr[l] = ret_conv_11_ref;
47263         }
47264         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47265         FREE(ret_var.data);
47266         return ret_arr;
47267 }
47268
47269 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47270         LDKInvoice this_arg_conv;
47271         this_arg_conv.inner = untag_ptr(this_arg);
47272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47274         this_arg_conv.is_owned = false;
47275         jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
47276         return ret_conv;
47277 }
47278
47279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
47280         LDKInvoice this_arg_conv;
47281         this_arg_conv.inner = untag_ptr(this_arg);
47282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47284         this_arg_conv.is_owned = false;
47285         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47286         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
47287         int64_t ret_ref = tag_ptr(ret_copy, true);
47288         return ret_ref;
47289 }
47290
47291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
47292         LDKStr description_conv = java_to_owned_str(env, description);
47293         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
47294         *ret_conv = Description_new(description_conv);
47295         return tag_ptr(ret_conv, true);
47296 }
47297
47298 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47299         LDKDescription this_arg_conv;
47300         this_arg_conv.inner = untag_ptr(this_arg);
47301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47303         this_arg_conv = Description_clone(&this_arg_conv);
47304         LDKStr ret_str = Description_into_inner(this_arg_conv);
47305         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47306         Str_free(ret_str);
47307         return ret_conv;
47308 }
47309
47310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
47311         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
47312         int64_t ret_ref = 0;
47313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47315         return ret_ref;
47316 }
47317
47318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
47319         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
47320         int64_t ret_ref = 0;
47321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47323         return ret_ref;
47324 }
47325
47326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
47327         LDKExpiryTime this_arg_conv;
47328         this_arg_conv.inner = untag_ptr(this_arg);
47329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47331         this_arg_conv.is_owned = false;
47332         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
47333         return ret_conv;
47334 }
47335
47336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
47337         LDKExpiryTime this_arg_conv;
47338         this_arg_conv.inner = untag_ptr(this_arg);
47339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47341         this_arg_conv.is_owned = false;
47342         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
47343         return ret_conv;
47344 }
47345
47346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
47347         LDKRouteHint hops_conv;
47348         hops_conv.inner = untag_ptr(hops);
47349         hops_conv.is_owned = ptr_is_owned(hops);
47350         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
47351         hops_conv = RouteHint_clone(&hops_conv);
47352         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
47353         *ret_conv = PrivateRoute_new(hops_conv);
47354         return tag_ptr(ret_conv, true);
47355 }
47356
47357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47358         LDKPrivateRoute this_arg_conv;
47359         this_arg_conv.inner = untag_ptr(this_arg);
47360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47362         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
47363         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_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 jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47371         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
47372         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
47373         return ret_conv;
47374 }
47375
47376 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
47377         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
47378         return ret_conv;
47379 }
47380
47381 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
47382         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
47383         return ret_conv;
47384 }
47385
47386 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
47387         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
47388         return ret_conv;
47389 }
47390
47391 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
47392         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
47393         return ret_conv;
47394 }
47395
47396 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
47397         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
47398         return ret_conv;
47399 }
47400
47401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47402         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
47403         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
47404         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
47405         return ret_conv;
47406 }
47407
47408 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47409         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
47410         LDKStr ret_str = CreationError_to_str(o_conv);
47411         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47412         Str_free(ret_str);
47413         return ret_conv;
47414 }
47415
47416 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47417         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
47418         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
47419         return ret_conv;
47420 }
47421
47422 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
47423         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
47424         return ret_conv;
47425 }
47426
47427 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
47428         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
47429         return ret_conv;
47430 }
47431
47432 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
47433         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
47434         return ret_conv;
47435 }
47436
47437 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
47438         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
47439         return ret_conv;
47440 }
47441
47442 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
47443         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
47444         return ret_conv;
47445 }
47446
47447 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
47448         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
47449         return ret_conv;
47450 }
47451
47452 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
47453         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
47454         return ret_conv;
47455 }
47456
47457 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
47458         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
47459         return ret_conv;
47460 }
47461
47462 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
47463         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
47464         return ret_conv;
47465 }
47466
47467 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
47468         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
47469         return ret_conv;
47470 }
47471
47472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47473         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
47474         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
47475         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
47476         return ret_conv;
47477 }
47478
47479 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47480         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
47481         LDKStr ret_str = SemanticError_to_str(o_conv);
47482         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47483         Str_free(ret_str);
47484         return ret_conv;
47485 }
47486
47487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47488         if (!ptr_is_owned(this_ptr)) return;
47489         void* this_ptr_ptr = untag_ptr(this_ptr);
47490         CHECK_ACCESS(this_ptr_ptr);
47491         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
47492         FREE(untag_ptr(this_ptr));
47493         SignOrCreationError_free(this_ptr_conv);
47494 }
47495
47496 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
47497         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47498         *ret_copy = SignOrCreationError_clone(arg);
47499         int64_t ret_ref = tag_ptr(ret_copy, true);
47500         return ret_ref;
47501 }
47502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47503         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
47504         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
47505         return ret_conv;
47506 }
47507
47508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47509         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
47510         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47511         *ret_copy = SignOrCreationError_clone(orig_conv);
47512         int64_t ret_ref = tag_ptr(ret_copy, true);
47513         return ret_ref;
47514 }
47515
47516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
47517         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47518         *ret_copy = SignOrCreationError_sign_error();
47519         int64_t ret_ref = tag_ptr(ret_copy, true);
47520         return ret_ref;
47521 }
47522
47523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
47524         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
47525         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47526         *ret_copy = SignOrCreationError_creation_error(a_conv);
47527         int64_t ret_ref = tag_ptr(ret_copy, true);
47528         return ret_ref;
47529 }
47530
47531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47532         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
47533         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
47534         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
47535         return ret_conv;
47536 }
47537
47538 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47539         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
47540         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
47541         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47542         Str_free(ret_str);
47543         return ret_conv;
47544 }
47545
47546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47547         LDKInvoicePayer this_obj_conv;
47548         this_obj_conv.inner = untag_ptr(this_obj);
47549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47551         InvoicePayer_free(this_obj_conv);
47552 }
47553
47554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47555         if (!ptr_is_owned(this_ptr)) return;
47556         void* this_ptr_ptr = untag_ptr(this_ptr);
47557         CHECK_ACCESS(this_ptr_ptr);
47558         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
47559         FREE(untag_ptr(this_ptr));
47560         Payer_free(this_ptr_conv);
47561 }
47562
47563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47564         if (!ptr_is_owned(this_ptr)) return;
47565         void* this_ptr_ptr = untag_ptr(this_ptr);
47566         CHECK_ACCESS(this_ptr_ptr);
47567         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
47568         FREE(untag_ptr(this_ptr));
47569         Router_free(this_ptr_conv);
47570 }
47571
47572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47573         if (!ptr_is_owned(this_ptr)) return;
47574         void* this_ptr_ptr = untag_ptr(this_ptr);
47575         CHECK_ACCESS(this_ptr_ptr);
47576         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
47577         FREE(untag_ptr(this_ptr));
47578         Retry_free(this_ptr_conv);
47579 }
47580
47581 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
47582         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47583         *ret_copy = Retry_clone(arg);
47584         int64_t ret_ref = tag_ptr(ret_copy, true);
47585         return ret_ref;
47586 }
47587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47588         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
47589         int64_t ret_conv = Retry_clone_ptr(arg_conv);
47590         return ret_conv;
47591 }
47592
47593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47594         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
47595         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47596         *ret_copy = Retry_clone(orig_conv);
47597         int64_t ret_ref = tag_ptr(ret_copy, true);
47598         return ret_ref;
47599 }
47600
47601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
47602         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47603         *ret_copy = Retry_attempts(a);
47604         int64_t ret_ref = tag_ptr(ret_copy, true);
47605         return ret_ref;
47606 }
47607
47608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
47609         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47610         *ret_copy = Retry_timeout(a);
47611         int64_t ret_ref = tag_ptr(ret_copy, true);
47612         return ret_ref;
47613 }
47614
47615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47616         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
47617         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
47618         jboolean ret_conv = Retry_eq(a_conv, b_conv);
47619         return ret_conv;
47620 }
47621
47622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
47623         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
47624         int64_t ret_conv = Retry_hash(o_conv);
47625         return ret_conv;
47626 }
47627
47628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47629         if (!ptr_is_owned(this_ptr)) return;
47630         void* this_ptr_ptr = untag_ptr(this_ptr);
47631         CHECK_ACCESS(this_ptr_ptr);
47632         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
47633         FREE(untag_ptr(this_ptr));
47634         PaymentError_free(this_ptr_conv);
47635 }
47636
47637 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
47638         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47639         *ret_copy = PaymentError_clone(arg);
47640         int64_t ret_ref = tag_ptr(ret_copy, true);
47641         return ret_ref;
47642 }
47643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47644         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
47645         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
47646         return ret_conv;
47647 }
47648
47649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47650         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
47651         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47652         *ret_copy = PaymentError_clone(orig_conv);
47653         int64_t ret_ref = tag_ptr(ret_copy, true);
47654         return ret_ref;
47655 }
47656
47657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
47658         LDKStr a_conv = java_to_owned_str(env, a);
47659         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47660         *ret_copy = PaymentError_invoice(a_conv);
47661         int64_t ret_ref = tag_ptr(ret_copy, true);
47662         return ret_ref;
47663 }
47664
47665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
47666         LDKLightningError a_conv;
47667         a_conv.inner = untag_ptr(a);
47668         a_conv.is_owned = ptr_is_owned(a);
47669         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47670         a_conv = LightningError_clone(&a_conv);
47671         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47672         *ret_copy = PaymentError_routing(a_conv);
47673         int64_t ret_ref = tag_ptr(ret_copy, true);
47674         return ret_ref;
47675 }
47676
47677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
47678         void* a_ptr = untag_ptr(a);
47679         CHECK_ACCESS(a_ptr);
47680         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
47681         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
47682         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47683         *ret_copy = PaymentError_sending(a_conv);
47684         int64_t ret_ref = tag_ptr(ret_copy, true);
47685         return ret_ref;
47686 }
47687
47688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t scorer, int64_t logger, int64_t event_handler, int64_t retry) {
47689         void* payer_ptr = untag_ptr(payer);
47690         CHECK_ACCESS(payer_ptr);
47691         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
47692         if (payer_conv.free == LDKPayer_JCalls_free) {
47693                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47694                 LDKPayer_JCalls_cloned(&payer_conv);
47695         }
47696         void* router_ptr = untag_ptr(router);
47697         CHECK_ACCESS(router_ptr);
47698         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
47699         if (router_conv.free == LDKRouter_JCalls_free) {
47700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47701                 LDKRouter_JCalls_cloned(&router_conv);
47702         }
47703         LDKMultiThreadedLockableScore scorer_conv;
47704         scorer_conv.inner = untag_ptr(scorer);
47705         scorer_conv.is_owned = ptr_is_owned(scorer);
47706         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
47707         scorer_conv.is_owned = false;
47708         void* logger_ptr = untag_ptr(logger);
47709         CHECK_ACCESS(logger_ptr);
47710         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47711         if (logger_conv.free == LDKLogger_JCalls_free) {
47712                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47713                 LDKLogger_JCalls_cloned(&logger_conv);
47714         }
47715         void* event_handler_ptr = untag_ptr(event_handler);
47716         CHECK_ACCESS(event_handler_ptr);
47717         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
47718         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47719                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47720                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47721         }
47722         void* retry_ptr = untag_ptr(retry);
47723         CHECK_ACCESS(retry_ptr);
47724         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
47725         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
47726         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
47727         int64_t ret_ref = 0;
47728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47730         return ret_ref;
47731 }
47732
47733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
47734         LDKInvoicePayer this_arg_conv;
47735         this_arg_conv.inner = untag_ptr(this_arg);
47736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47738         this_arg_conv.is_owned = false;
47739         LDKInvoice invoice_conv;
47740         invoice_conv.inner = untag_ptr(invoice);
47741         invoice_conv.is_owned = ptr_is_owned(invoice);
47742         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47743         invoice_conv.is_owned = false;
47744         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47745         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
47746         return tag_ptr(ret_conv, true);
47747 }
47748
47749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats) {
47750         LDKInvoicePayer this_arg_conv;
47751         this_arg_conv.inner = untag_ptr(this_arg);
47752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47754         this_arg_conv.is_owned = false;
47755         LDKInvoice invoice_conv;
47756         invoice_conv.inner = untag_ptr(invoice);
47757         invoice_conv.is_owned = ptr_is_owned(invoice);
47758         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47759         invoice_conv.is_owned = false;
47760         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47761         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
47762         return tag_ptr(ret_conv, true);
47763 }
47764
47765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) {
47766         LDKInvoicePayer this_arg_conv;
47767         this_arg_conv.inner = untag_ptr(this_arg);
47768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47770         this_arg_conv.is_owned = false;
47771         LDKPublicKey pubkey_ref;
47772         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
47773         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
47774         LDKThirtyTwoBytes payment_preimage_ref;
47775         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
47776         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
47777         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47778         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
47779         return tag_ptr(ret_conv, true);
47780 }
47781
47782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
47783         LDKInvoicePayer this_arg_conv;
47784         this_arg_conv.inner = untag_ptr(this_arg);
47785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47787         this_arg_conv.is_owned = false;
47788         unsigned char payment_hash_arr[32];
47789         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47790         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
47791         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
47792         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
47793 }
47794
47795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
47796         LDKInvoicePayer this_arg_conv;
47797         this_arg_conv.inner = untag_ptr(this_arg);
47798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47800         this_arg_conv.is_owned = false;
47801         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
47802         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
47803         return tag_ptr(ret_ret, true);
47804 }
47805
47806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) {
47807         void* amt_msat_ptr = untag_ptr(amt_msat);
47808         CHECK_ACCESS(amt_msat_ptr);
47809         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47810         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47811         LDKThirtyTwoBytes payment_hash_ref;
47812         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47813         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47814         LDKStr description_conv = java_to_owned_str(env, description);
47815         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
47816         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
47817         if (phantom_route_hints_constr.datalen > 0)
47818                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
47819         else
47820                 phantom_route_hints_constr.data = NULL;
47821         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
47822         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
47823                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
47824                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
47825                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
47826                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
47827                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
47828                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
47829                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
47830         }
47831         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
47832         void* keys_manager_ptr = untag_ptr(keys_manager);
47833         CHECK_ACCESS(keys_manager_ptr);
47834         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47835         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47836                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47837                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47838         }
47839         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47840         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47841         *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, keys_manager_conv, network_conv);
47842         return tag_ptr(ret_conv, true);
47843 }
47844
47845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) {
47846         void* amt_msat_ptr = untag_ptr(amt_msat);
47847         CHECK_ACCESS(amt_msat_ptr);
47848         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47849         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47850         LDKThirtyTwoBytes payment_hash_ref;
47851         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47852         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47853         LDKSha256 description_hash_conv;
47854         description_hash_conv.inner = untag_ptr(description_hash);
47855         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47856         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47857         description_hash_conv = Sha256_clone(&description_hash_conv);
47858         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
47859         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
47860         if (phantom_route_hints_constr.datalen > 0)
47861                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
47862         else
47863                 phantom_route_hints_constr.data = NULL;
47864         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
47865         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
47866                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
47867                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
47868                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
47869                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
47870                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
47871                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
47872                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
47873         }
47874         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
47875         void* keys_manager_ptr = untag_ptr(keys_manager);
47876         CHECK_ACCESS(keys_manager_ptr);
47877         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47878         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47880                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47881         }
47882         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47883         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47884         *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, keys_manager_conv, network_conv);
47885         return tag_ptr(ret_conv, true);
47886 }
47887
47888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs) {
47889         LDKChannelManager channelmanager_conv;
47890         channelmanager_conv.inner = untag_ptr(channelmanager);
47891         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47892         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47893         channelmanager_conv.is_owned = false;
47894         void* keys_manager_ptr = untag_ptr(keys_manager);
47895         CHECK_ACCESS(keys_manager_ptr);
47896         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47897         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47898                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47899                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47900         }
47901         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47902         void* amt_msat_ptr = untag_ptr(amt_msat);
47903         CHECK_ACCESS(amt_msat_ptr);
47904         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47905         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47906         LDKStr description_conv = java_to_owned_str(env, description);
47907         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47908         *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs);
47909         return tag_ptr(ret_conv, true);
47910 }
47911
47912 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 keys_manager, jclass network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs) {
47913         LDKChannelManager channelmanager_conv;
47914         channelmanager_conv.inner = untag_ptr(channelmanager);
47915         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47916         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47917         channelmanager_conv.is_owned = false;
47918         void* keys_manager_ptr = untag_ptr(keys_manager);
47919         CHECK_ACCESS(keys_manager_ptr);
47920         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47921         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47922                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47923                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47924         }
47925         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47926         void* amt_msat_ptr = untag_ptr(amt_msat);
47927         CHECK_ACCESS(amt_msat_ptr);
47928         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47929         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47930         LDKSha256 description_hash_conv;
47931         description_hash_conv.inner = untag_ptr(description_hash);
47932         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47933         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47934         description_hash_conv = Sha256_clone(&description_hash_conv);
47935         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47936         *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs);
47937         return tag_ptr(ret_conv, true);
47938 }
47939
47940 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 keys_manager, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) {
47941         LDKChannelManager channelmanager_conv;
47942         channelmanager_conv.inner = untag_ptr(channelmanager);
47943         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47944         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47945         channelmanager_conv.is_owned = false;
47946         void* keys_manager_ptr = untag_ptr(keys_manager);
47947         CHECK_ACCESS(keys_manager_ptr);
47948         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47949         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47950                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47951                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47952         }
47953         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47954         void* amt_msat_ptr = untag_ptr(amt_msat);
47955         CHECK_ACCESS(amt_msat_ptr);
47956         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47957         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47958         LDKSha256 description_hash_conv;
47959         description_hash_conv.inner = untag_ptr(description_hash);
47960         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47961         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47962         description_hash_conv = Sha256_clone(&description_hash_conv);
47963         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47964         *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs);
47965         return tag_ptr(ret_conv, true);
47966 }
47967
47968 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 keys_manager, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) {
47969         LDKChannelManager channelmanager_conv;
47970         channelmanager_conv.inner = untag_ptr(channelmanager);
47971         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47972         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47973         channelmanager_conv.is_owned = false;
47974         void* keys_manager_ptr = untag_ptr(keys_manager);
47975         CHECK_ACCESS(keys_manager_ptr);
47976         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47977         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47978                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47979                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47980         }
47981         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47982         void* amt_msat_ptr = untag_ptr(amt_msat);
47983         CHECK_ACCESS(amt_msat_ptr);
47984         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47985         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47986         LDKStr description_conv = java_to_owned_str(env, description);
47987         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47988         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs);
47989         return tag_ptr(ret_conv, true);
47990 }
47991
47992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47993         LDKDefaultRouter this_obj_conv;
47994         this_obj_conv.inner = untag_ptr(this_obj);
47995         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47997         DefaultRouter_free(this_obj_conv);
47998 }
47999
48000 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) {
48001         LDKNetworkGraph network_graph_conv;
48002         network_graph_conv.inner = untag_ptr(network_graph);
48003         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48004         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48005         network_graph_conv.is_owned = false;
48006         void* logger_ptr = untag_ptr(logger);
48007         CHECK_ACCESS(logger_ptr);
48008         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48009         if (logger_conv.free == LDKLogger_JCalls_free) {
48010                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48011                 LDKLogger_JCalls_cloned(&logger_conv);
48012         }
48013         LDKThirtyTwoBytes random_seed_bytes_ref;
48014         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
48015         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
48016         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
48017         int64_t ret_ref = 0;
48018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48020         return ret_ref;
48021 }
48022
48023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
48024         LDKDefaultRouter this_arg_conv;
48025         this_arg_conv.inner = untag_ptr(this_arg);
48026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48028         this_arg_conv.is_owned = false;
48029         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
48030         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
48031         return tag_ptr(ret_ret, true);
48032 }
48033
48034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
48035         LDKChannelManager this_arg_conv;
48036         this_arg_conv.inner = untag_ptr(this_arg);
48037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48039         this_arg_conv.is_owned = false;
48040         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
48041         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
48042         return tag_ptr(ret_ret, true);
48043 }
48044
48045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48046         LDKStr s_conv = java_to_owned_str(env, s);
48047         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
48048         *ret_conv = SiPrefix_from_str(s_conv);
48049         return tag_ptr(ret_conv, true);
48050 }
48051
48052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48053         LDKStr s_conv = java_to_owned_str(env, s);
48054         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
48055         *ret_conv = Invoice_from_str(s_conv);
48056         return tag_ptr(ret_conv, true);
48057 }
48058
48059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48060         LDKStr s_conv = java_to_owned_str(env, s);
48061         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
48062         *ret_conv = SignedRawInvoice_from_str(s_conv);
48063         return tag_ptr(ret_conv, true);
48064 }
48065
48066 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48067         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
48068         LDKStr ret_str = ParseError_to_str(o_conv);
48069         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48070         Str_free(ret_str);
48071         return ret_conv;
48072 }
48073
48074 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48075         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
48076         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
48077         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48078         Str_free(ret_str);
48079         return ret_conv;
48080 }
48081
48082 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48083         LDKInvoice o_conv;
48084         o_conv.inner = untag_ptr(o);
48085         o_conv.is_owned = ptr_is_owned(o);
48086         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48087         o_conv.is_owned = false;
48088         LDKStr ret_str = Invoice_to_str(&o_conv);
48089         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48090         Str_free(ret_str);
48091         return ret_conv;
48092 }
48093
48094 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48095         LDKSignedRawInvoice o_conv;
48096         o_conv.inner = untag_ptr(o);
48097         o_conv.is_owned = ptr_is_owned(o);
48098         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48099         o_conv.is_owned = false;
48100         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
48101         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48102         Str_free(ret_str);
48103         return ret_conv;
48104 }
48105
48106 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48107         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
48108         LDKStr ret_str = Currency_to_str(o_conv);
48109         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48110         Str_free(ret_str);
48111         return ret_conv;
48112 }
48113
48114 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48115         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
48116         LDKStr ret_str = SiPrefix_to_str(o_conv);
48117         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48118         Str_free(ret_str);
48119         return ret_conv;
48120 }
48121
48122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48123         LDKRapidGossipSync this_obj_conv;
48124         this_obj_conv.inner = untag_ptr(this_obj);
48125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48127         RapidGossipSync_free(this_obj_conv);
48128 }
48129
48130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) {
48131         LDKNetworkGraph network_graph_conv;
48132         network_graph_conv.inner = untag_ptr(network_graph);
48133         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48134         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48135         network_graph_conv.is_owned = false;
48136         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
48137         int64_t ret_ref = 0;
48138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48140         return ret_ref;
48141 }
48142
48143 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) {
48144         LDKRapidGossipSync this_arg_conv;
48145         this_arg_conv.inner = untag_ptr(this_arg);
48146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48148         this_arg_conv.is_owned = false;
48149         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
48150         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48151         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
48152         return tag_ptr(ret_conv, true);
48153 }
48154
48155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
48156         LDKRapidGossipSync this_arg_conv;
48157         this_arg_conv.inner = untag_ptr(this_arg);
48158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48160         this_arg_conv.is_owned = false;
48161         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
48162         return ret_conv;
48163 }
48164
48165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48166         if (!ptr_is_owned(this_ptr)) return;
48167         void* this_ptr_ptr = untag_ptr(this_ptr);
48168         CHECK_ACCESS(this_ptr_ptr);
48169         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
48170         FREE(untag_ptr(this_ptr));
48171         GraphSyncError_free(this_ptr_conv);
48172 }
48173
48174 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
48175         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48176         *ret_copy = GraphSyncError_clone(arg);
48177         int64_t ret_ref = tag_ptr(ret_copy, true);
48178         return ret_ref;
48179 }
48180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48181         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
48182         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
48183         return ret_conv;
48184 }
48185
48186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48187         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
48188         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48189         *ret_copy = GraphSyncError_clone(orig_conv);
48190         int64_t ret_ref = tag_ptr(ret_copy, true);
48191         return ret_ref;
48192 }
48193
48194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
48195         LDKDecodeError a_conv;
48196         a_conv.inner = untag_ptr(a);
48197         a_conv.is_owned = ptr_is_owned(a);
48198         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48199         a_conv = DecodeError_clone(&a_conv);
48200         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48201         *ret_copy = GraphSyncError_decode_error(a_conv);
48202         int64_t ret_ref = tag_ptr(ret_copy, true);
48203         return ret_ref;
48204 }
48205
48206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
48207         LDKLightningError a_conv;
48208         a_conv.inner = untag_ptr(a);
48209         a_conv.is_owned = ptr_is_owned(a);
48210         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48211         a_conv = LightningError_clone(&a_conv);
48212         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48213         *ret_copy = GraphSyncError_lightning_error(a_conv);
48214         int64_t ret_ref = tag_ptr(ret_copy, true);
48215         return ret_ref;
48216 }
48217
48218 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) {
48219         LDKRapidGossipSync this_arg_conv;
48220         this_arg_conv.inner = untag_ptr(this_arg);
48221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48223         this_arg_conv.is_owned = false;
48224         LDKu8slice update_data_ref;
48225         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
48226         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
48227         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48228         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
48229         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
48230         return tag_ptr(ret_conv, true);
48231 }
48232